Blame


1 5565365c 2024-03-27 op #!/bin/sh
2 5565365c 2024-03-27 op #
3 5565365c 2024-03-27 op # Copyright (c) 2024 Omar Polo <op@openbsd.org>
4 5565365c 2024-03-27 op #
5 5565365c 2024-03-27 op # Permission to use, copy, modify, and distribute this software for any
6 5565365c 2024-03-27 op # purpose with or without fee is hereby granted, provided that the above
7 5565365c 2024-03-27 op # copyright notice and this permission notice appear in all copies.
8 5565365c 2024-03-27 op #
9 5565365c 2024-03-27 op # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 5565365c 2024-03-27 op # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 5565365c 2024-03-27 op # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 5565365c 2024-03-27 op # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 5565365c 2024-03-27 op # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 5565365c 2024-03-27 op # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 5565365c 2024-03-27 op # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 5565365c 2024-03-27 op
17 5565365c 2024-03-27 op . ../cmdline/common.sh
18 5565365c 2024-03-27 op . ./common.sh
19 5565365c 2024-03-27 op
20 050c0b8c 2024-04-16 op # flan:password encoded in base64
21 050c0b8c 2024-04-16 op AUTH="ZmxhbjpwYXNzd29yZA=="
22 050c0b8c 2024-04-16 op
23 5565365c 2024-03-27 op test_file_changed() {
24 5565365c 2024-03-27 op local testroot=`test_init file_changed 1`
25 5565365c 2024-03-27 op
26 5565365c 2024-03-27 op got clone -a -q ${GOTD_TEST_REPO_URL} $testroot/repo-clone
27 5565365c 2024-03-27 op ret=$?
28 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
29 5565365c 2024-03-27 op echo "got clone failed unexpectedly" >&2
30 5565365c 2024-03-27 op test_done "$testroot" 1
31 5565365c 2024-03-27 op return 1
32 5565365c 2024-03-27 op fi
33 5565365c 2024-03-27 op
34 5565365c 2024-03-27 op got checkout -q $testroot/repo-clone $testroot/wt >/dev/null
35 5565365c 2024-03-27 op ret=$?
36 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
37 5565365c 2024-03-27 op echo "got checkout failed unexpectedly" >&2
38 5565365c 2024-03-27 op test_done "$testroot" 1
39 5565365c 2024-03-27 op return 1
40 5565365c 2024-03-27 op fi
41 5565365c 2024-03-27 op
42 5565365c 2024-03-27 op echo "change alpha" > $testroot/wt/alpha
43 5565365c 2024-03-27 op (cd $testroot/wt && got commit -m 'make changes' > /dev/null)
44 5565365c 2024-03-27 op local commit_id=`git_show_head $testroot/repo-clone`
45 5565365c 2024-03-27 op local author_time=`git_show_author_time $testroot/repo-clone`
46 5565365c 2024-03-27 op
47 050c0b8c 2024-04-16 op timeout 5 ./http-server -a $AUTH -p $GOTD_TEST_HTTP_PORT \
48 5565365c 2024-03-27 op > $testroot/stdout &
49 5565365c 2024-03-27 op
50 5a430400 2024-05-12 naddy sleep 1 # server starts up
51 5a430400 2024-05-12 naddy
52 5565365c 2024-03-27 op got send -b main -q -r $testroot/repo-clone
53 5565365c 2024-03-27 op ret=$?
54 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
55 5565365c 2024-03-27 op echo "got send failed unexpectedly" >&2
56 5565365c 2024-03-27 op test_done "$testroot" "1"
57 5565365c 2024-03-27 op return 1
58 5565365c 2024-03-27 op fi
59 5565365c 2024-03-27 op
60 5565365c 2024-03-27 op wait %1 # wait for the http "server"
61 5565365c 2024-03-27 op
62 87890bc2 2024-03-28 op touch "$testroot/stdout.expected"
63 87890bc2 2024-03-28 op ed -s "$testroot/stdout.expected" <<-EOF
64 87890bc2 2024-03-28 op a
65 87890bc2 2024-03-28 op {"notifications":[{
66 93623901 2024-03-28 op "type":"commit",
67 87890bc2 2024-03-28 op "short":false,
68 c1003102 2024-04-15 op "repo":"test-repo",
69 841969e1 2024-04-30 op "authenticated_user":"${GOTD_DEVUSER}",
70 87890bc2 2024-03-28 op "id":"$commit_id",
71 ac0a4dfc 2024-03-28 op "author":{
72 ac0a4dfc 2024-03-28 op "full":"$GOT_AUTHOR",
73 ac0a4dfc 2024-03-28 op "name":"$GIT_AUTHOR_NAME",
74 ac0a4dfc 2024-03-28 op "mail":"$GIT_AUTHOR_EMAIL",
75 ac0a4dfc 2024-03-28 op "user":"$GOT_AUTHOR_11"
76 ac0a4dfc 2024-03-28 op },
77 ac0a4dfc 2024-03-28 op "committer":{
78 ac0a4dfc 2024-03-28 op "full":"$GOT_AUTHOR",
79 ac0a4dfc 2024-03-28 op "name":"$GIT_AUTHOR_NAME",
80 ac0a4dfc 2024-03-28 op "mail":"$GIT_AUTHOR_EMAIL",
81 ac0a4dfc 2024-03-28 op "user":"$GOT_AUTHOR_11"
82 ac0a4dfc 2024-03-28 op },
83 939d3016 2024-04-23 op "date":$author_time,
84 ac0a4dfc 2024-03-28 op "short_message":"make changes",
85 87890bc2 2024-03-28 op "message":"make changes\n",
86 763b7f49 2024-03-28 op "diffstat":{
87 763b7f49 2024-03-28 op "files":[{
88 763b7f49 2024-03-28 op "action":"modified",
89 763b7f49 2024-03-28 op "file":"alpha",
90 763b7f49 2024-03-28 op "added":1,
91 763b7f49 2024-03-28 op "removed":1
92 763b7f49 2024-03-28 op }],
93 763b7f49 2024-03-28 op "total":{
94 763b7f49 2024-03-28 op "added":1,
95 763b7f49 2024-03-28 op "removed":1
96 763b7f49 2024-03-28 op }
97 763b7f49 2024-03-28 op }
98 ea5e974d 2024-03-28 op }]}
99 ea5e974d 2024-03-28 op .
100 ea5e974d 2024-03-28 op ,j
101 ea5e974d 2024-03-28 op w
102 ea5e974d 2024-03-28 op EOF
103 ea5e974d 2024-03-28 op
104 ea5e974d 2024-03-28 op cmp -s $testroot/stdout.expected $testroot/stdout
105 ea5e974d 2024-03-28 op ret=$?
106 ea5e974d 2024-03-28 op if [ $ret -ne 0 ]; then
107 ea5e974d 2024-03-28 op diff -u $testroot/stdout.expected $testroot/stdout
108 ea5e974d 2024-03-28 op test_done "$testroot" "$ret"
109 ea5e974d 2024-03-28 op return 1
110 ea5e974d 2024-03-28 op fi
111 c3cc85a3 2024-04-30 stsp
112 c3cc85a3 2024-04-30 stsp # Try the same thing again with 'git push' instead of 'got send'
113 c3cc85a3 2024-04-30 stsp echo "change alpha once more" > $testroot/wt/alpha
114 c3cc85a3 2024-04-30 stsp (cd $testroot/wt && got commit -m 'make more changes' > /dev/null)
115 c3cc85a3 2024-04-30 stsp local commit_id=`git_show_head $testroot/repo-clone`
116 c3cc85a3 2024-04-30 stsp local author_time=`git_show_author_time $testroot/repo-clone`
117 c3cc85a3 2024-04-30 stsp
118 c3cc85a3 2024-04-30 stsp timeout 5 ./http-server -a $AUTH -p $GOTD_TEST_HTTP_PORT \
119 c3cc85a3 2024-04-30 stsp > $testroot/stdout &
120 c3cc85a3 2024-04-30 stsp
121 5a430400 2024-05-12 naddy sleep 1 # server starts up
122 5a430400 2024-05-12 naddy
123 c3cc85a3 2024-04-30 stsp git -C $testroot/repo-clone push -q origin main
124 c3cc85a3 2024-04-30 stsp ret=$?
125 c3cc85a3 2024-04-30 stsp if [ $ret -ne 0 ]; then
126 c3cc85a3 2024-04-30 stsp echo "git push failed unexpectedly" >&2
127 c3cc85a3 2024-04-30 stsp test_done "$testroot" "1"
128 c3cc85a3 2024-04-30 stsp return 1
129 c3cc85a3 2024-04-30 stsp fi
130 c3cc85a3 2024-04-30 stsp
131 c3cc85a3 2024-04-30 stsp wait %1 # wait for the http "server"
132 c3cc85a3 2024-04-30 stsp
133 c3cc85a3 2024-04-30 stsp echo -n > "$testroot/stdout.expected"
134 c3cc85a3 2024-04-30 stsp ed -s "$testroot/stdout.expected" <<-EOF
135 c3cc85a3 2024-04-30 stsp a
136 c3cc85a3 2024-04-30 stsp {"notifications":[{
137 c3cc85a3 2024-04-30 stsp "type":"commit",
138 c3cc85a3 2024-04-30 stsp "short":false,
139 c3cc85a3 2024-04-30 stsp "repo":"test-repo",
140 841969e1 2024-04-30 op "authenticated_user":"${GOTD_DEVUSER}",
141 c3cc85a3 2024-04-30 stsp "id":"$commit_id",
142 c3cc85a3 2024-04-30 stsp "author":{
143 c3cc85a3 2024-04-30 stsp "full":"$GOT_AUTHOR",
144 c3cc85a3 2024-04-30 stsp "name":"$GIT_AUTHOR_NAME",
145 c3cc85a3 2024-04-30 stsp "mail":"$GIT_AUTHOR_EMAIL",
146 c3cc85a3 2024-04-30 stsp "user":"$GOT_AUTHOR_11"
147 c3cc85a3 2024-04-30 stsp },
148 c3cc85a3 2024-04-30 stsp "committer":{
149 c3cc85a3 2024-04-30 stsp "full":"$GOT_AUTHOR",
150 c3cc85a3 2024-04-30 stsp "name":"$GIT_AUTHOR_NAME",
151 c3cc85a3 2024-04-30 stsp "mail":"$GIT_AUTHOR_EMAIL",
152 c3cc85a3 2024-04-30 stsp "user":"$GOT_AUTHOR_11"
153 c3cc85a3 2024-04-30 stsp },
154 c3cc85a3 2024-04-30 stsp "date":$author_time,
155 c3cc85a3 2024-04-30 stsp "short_message":"make more changes",
156 c3cc85a3 2024-04-30 stsp "message":"make more changes\n",
157 c3cc85a3 2024-04-30 stsp "diffstat":{
158 c3cc85a3 2024-04-30 stsp "files":[{
159 c3cc85a3 2024-04-30 stsp "action":"modified",
160 c3cc85a3 2024-04-30 stsp "file":"alpha",
161 c3cc85a3 2024-04-30 stsp "added":1,
162 c3cc85a3 2024-04-30 stsp "removed":1
163 c3cc85a3 2024-04-30 stsp }],
164 c3cc85a3 2024-04-30 stsp "total":{
165 c3cc85a3 2024-04-30 stsp "added":1,
166 c3cc85a3 2024-04-30 stsp "removed":1
167 c3cc85a3 2024-04-30 stsp }
168 c3cc85a3 2024-04-30 stsp }
169 c3cc85a3 2024-04-30 stsp }]}
170 c3cc85a3 2024-04-30 stsp .
171 c3cc85a3 2024-04-30 stsp ,j
172 c3cc85a3 2024-04-30 stsp w
173 c3cc85a3 2024-04-30 stsp EOF
174 ea5e974d 2024-03-28 op
175 c3cc85a3 2024-04-30 stsp cmp -s $testroot/stdout.expected $testroot/stdout
176 c3cc85a3 2024-04-30 stsp ret=$?
177 c3cc85a3 2024-04-30 stsp if [ $ret -ne 0 ]; then
178 c3cc85a3 2024-04-30 stsp diff -u $testroot/stdout.expected $testroot/stdout
179 c3cc85a3 2024-04-30 stsp fi
180 ea5e974d 2024-03-28 op test_done "$testroot" "$ret"
181 ea5e974d 2024-03-28 op }
182 ea5e974d 2024-03-28 op
183 ea5e974d 2024-03-28 op test_bad_utf8() {
184 ea5e974d 2024-03-28 op local testroot=`test_init bad_utf8 1`
185 ea5e974d 2024-03-28 op
186 ea5e974d 2024-03-28 op got clone -a -q ${GOTD_TEST_REPO_URL} $testroot/repo-clone
187 ea5e974d 2024-03-28 op ret=$?
188 ea5e974d 2024-03-28 op if [ $ret -ne 0 ]; then
189 ea5e974d 2024-03-28 op echo "got clone failed unexpectedly" >&2
190 ea5e974d 2024-03-28 op test_done "$testroot" 1
191 ea5e974d 2024-03-28 op return 1
192 ea5e974d 2024-03-28 op fi
193 ea5e974d 2024-03-28 op
194 ea5e974d 2024-03-28 op got checkout -q $testroot/repo-clone $testroot/wt >/dev/null
195 ea5e974d 2024-03-28 op ret=$?
196 ea5e974d 2024-03-28 op if [ $ret -ne 0 ]; then
197 ea5e974d 2024-03-28 op echo "got checkout failed unexpectedly" >&2
198 ea5e974d 2024-03-28 op test_done "$testroot" 1
199 ea5e974d 2024-03-28 op fi
200 ea5e974d 2024-03-28 op
201 cdaefb15 2024-03-28 stsp # invalid utf8 sequence
202 ea5e974d 2024-03-28 op commit_msg="make$(printf '\xED\xA0\x80')changes"
203 ea5e974d 2024-03-28 op
204 ea5e974d 2024-03-28 op echo "changed" > $testroot/wt/alpha
205 ea5e974d 2024-03-28 op (cd $testroot/wt && got commit -m "$commit_msg" > /dev/null)
206 ea5e974d 2024-03-28 op local commit_id=`git_show_head $testroot/repo-clone`
207 ea5e974d 2024-03-28 op local author_time=`git_show_author_time $testroot/repo-clone`
208 ea5e974d 2024-03-28 op
209 050c0b8c 2024-04-16 op timeout 5 ./http-server -a $AUTH -p $GOTD_TEST_HTTP_PORT \
210 ea5e974d 2024-03-28 op > $testroot/stdout &
211 ea5e974d 2024-03-28 op
212 5a430400 2024-05-12 naddy sleep 1 # server starts up
213 5a430400 2024-05-12 naddy
214 ea5e974d 2024-03-28 op got send -b main -q -r $testroot/repo-clone
215 ea5e974d 2024-03-28 op ret=$?
216 ea5e974d 2024-03-28 op if [ $ret -ne 0 ]; then
217 ea5e974d 2024-03-28 op echo "got send failed unexpectedly" >&2
218 ea5e974d 2024-03-28 op test_done "$testroot" "1"
219 ea5e974d 2024-03-28 op return 1
220 ea5e974d 2024-03-28 op fi
221 ea5e974d 2024-03-28 op
222 ea5e974d 2024-03-28 op wait %1 # wait for the http "server"
223 ea5e974d 2024-03-28 op
224 ea5e974d 2024-03-28 op touch "$testroot/stdout.expected"
225 ea5e974d 2024-03-28 op ed -s "$testroot/stdout.expected" <<-EOF
226 ea5e974d 2024-03-28 op a
227 ea5e974d 2024-03-28 op {"notifications":[{
228 93623901 2024-03-28 op "type":"commit",
229 ea5e974d 2024-03-28 op "short":false,
230 c1003102 2024-04-15 op "repo":"test-repo",
231 841969e1 2024-04-30 op "authenticated_user":"${GOTD_DEVUSER}",
232 ea5e974d 2024-03-28 op "id":"$commit_id",
233 ac0a4dfc 2024-03-28 op "author":{
234 ac0a4dfc 2024-03-28 op "full":"$GOT_AUTHOR",
235 ac0a4dfc 2024-03-28 op "name":"$GIT_AUTHOR_NAME",
236 ac0a4dfc 2024-03-28 op "mail":"$GIT_AUTHOR_EMAIL",
237 ac0a4dfc 2024-03-28 op "user":"$GOT_AUTHOR_11"
238 ac0a4dfc 2024-03-28 op },
239 ac0a4dfc 2024-03-28 op "committer":{
240 ac0a4dfc 2024-03-28 op "full":"$GOT_AUTHOR",
241 ac0a4dfc 2024-03-28 op "name":"$GIT_AUTHOR_NAME",
242 ac0a4dfc 2024-03-28 op "mail":"$GIT_AUTHOR_EMAIL",
243 ac0a4dfc 2024-03-28 op "user":"$GOT_AUTHOR_11"
244 ac0a4dfc 2024-03-28 op },
245 939d3016 2024-04-23 op "date":$author_time,
246 ac0a4dfc 2024-03-28 op "short_message":"make\uFFFD\uFFFDchanges",
247 ea5e974d 2024-03-28 op "message":"make\uFFFD\uFFFDchanges\n",
248 763b7f49 2024-03-28 op "diffstat":{
249 763b7f49 2024-03-28 op "files":[{
250 763b7f49 2024-03-28 op "action":"modified",
251 763b7f49 2024-03-28 op "file":"alpha",
252 763b7f49 2024-03-28 op "added":1,
253 763b7f49 2024-03-28 op "removed":1
254 763b7f49 2024-03-28 op }],
255 763b7f49 2024-03-28 op "total":{
256 763b7f49 2024-03-28 op "added":1,
257 763b7f49 2024-03-28 op "removed":1
258 763b7f49 2024-03-28 op }
259 763b7f49 2024-03-28 op }
260 87890bc2 2024-03-28 op }]}
261 87890bc2 2024-03-28 op .
262 87890bc2 2024-03-28 op ,j
263 87890bc2 2024-03-28 op w
264 5565365c 2024-03-27 op EOF
265 5565365c 2024-03-27 op
266 5565365c 2024-03-27 op cmp -s $testroot/stdout.expected $testroot/stdout
267 5565365c 2024-03-27 op ret=$?
268 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
269 5565365c 2024-03-27 op diff -u $testroot/stdout.expected $testroot/stdout
270 5565365c 2024-03-27 op test_done "$testroot" "$ret"
271 5565365c 2024-03-27 op return 1
272 5565365c 2024-03-27 op fi
273 5565365c 2024-03-27 op
274 5565365c 2024-03-27 op test_done "$testroot" "$ret"
275 5565365c 2024-03-27 op }
276 5565365c 2024-03-27 op
277 5565365c 2024-03-27 op test_many_commits_not_summarized() {
278 5565365c 2024-03-27 op local testroot=`test_init many_commits_not_summarized 1`
279 5565365c 2024-03-27 op
280 5565365c 2024-03-27 op got clone -a -q ${GOTD_TEST_REPO_URL} $testroot/repo-clone
281 5565365c 2024-03-27 op ret=$?
282 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
283 5565365c 2024-03-27 op echo "got clone failed unexpectedly" >&2
284 5565365c 2024-03-27 op test_done "$testroot" 1
285 5565365c 2024-03-27 op return 1
286 5565365c 2024-03-27 op fi
287 5565365c 2024-03-27 op
288 5565365c 2024-03-27 op got checkout -q $testroot/repo-clone $testroot/wt >/dev/null
289 5565365c 2024-03-27 op ret=$?
290 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
291 5565365c 2024-03-27 op echo "got checkout failed unexpectedly" >&2
292 5565365c 2024-03-27 op test_done "$testroot" 1
293 5565365c 2024-03-27 op return 1
294 5565365c 2024-03-27 op fi
295 5565365c 2024-03-27 op
296 5565365c 2024-03-27 op for i in `seq 1 24`; do
297 5565365c 2024-03-27 op echo "alpha $i" > $testroot/wt/alpha
298 5565365c 2024-03-27 op (cd $testroot/wt && got commit -m 'make changes' > /dev/null)
299 5565365c 2024-03-27 op local commit_id=`git_show_head $testroot/repo-clone`
300 5565365c 2024-03-27 op local author_time=`git_show_author_time $testroot/repo-clone`
301 939d3016 2024-04-23 op set -- "$@" "$commit_id $author_time"
302 5565365c 2024-03-27 op done
303 5565365c 2024-03-27 op
304 050c0b8c 2024-04-16 op timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
305 5565365c 2024-03-27 op > $testroot/stdout &
306 5565365c 2024-03-27 op
307 5a430400 2024-05-12 naddy sleep 1 # server starts up
308 5a430400 2024-05-12 naddy
309 5565365c 2024-03-27 op got send -b main -q -r $testroot/repo-clone
310 5565365c 2024-03-27 op ret=$?
311 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
312 5565365c 2024-03-27 op echo "got send failed unexpectedly" >&2
313 5565365c 2024-03-27 op test_done "$testroot" "1"
314 5565365c 2024-03-27 op return 1
315 5565365c 2024-03-27 op fi
316 5565365c 2024-03-27 op
317 5565365c 2024-03-27 op wait %1 # wait for the http "server"
318 5565365c 2024-03-27 op
319 9e88f9d9 2024-03-28 op printf '{"notifications":[' > $testroot/stdout.expected
320 5565365c 2024-03-27 op comma=""
321 5565365c 2024-03-27 op for i in `seq 1 24`; do
322 5565365c 2024-03-27 op s=`pop_idx $i "$@"`
323 5565365c 2024-03-27 op commit_id=$(echo $s | cut -d' ' -f1)
324 166674b8 2024-04-09 stsp commit_time=$(echo "$s" | sed -e "s/^$commit_id //g")
325 87890bc2 2024-03-28 op
326 87890bc2 2024-03-28 op echo "$comma"
327 87890bc2 2024-03-28 op comma=','
328 87890bc2 2024-03-28 op
329 87890bc2 2024-03-28 op cat <<-EOF
330 87890bc2 2024-03-28 op {
331 93623901 2024-03-28 op "type":"commit",
332 87890bc2 2024-03-28 op "short":false,
333 c1003102 2024-04-15 op "repo":"test-repo",
334 841969e1 2024-04-30 op "authenticated_user":"${GOTD_DEVUSER}",
335 87890bc2 2024-03-28 op "id":"$commit_id",
336 ac0a4dfc 2024-03-28 op "author":{
337 ac0a4dfc 2024-03-28 op "full":"$GOT_AUTHOR",
338 ac0a4dfc 2024-03-28 op "name":"$GIT_AUTHOR_NAME",
339 ac0a4dfc 2024-03-28 op "mail":"$GIT_AUTHOR_EMAIL",
340 ac0a4dfc 2024-03-28 op "user":"$GOT_AUTHOR_11"
341 ac0a4dfc 2024-03-28 op },
342 ac0a4dfc 2024-03-28 op "committer":{
343 ac0a4dfc 2024-03-28 op "full":"$GOT_AUTHOR",
344 ac0a4dfc 2024-03-28 op "name":"$GIT_AUTHOR_NAME",
345 ac0a4dfc 2024-03-28 op "mail":"$GIT_AUTHOR_EMAIL",
346 ac0a4dfc 2024-03-28 op "user":"$GOT_AUTHOR_11"
347 ac0a4dfc 2024-03-28 op },
348 939d3016 2024-04-23 op "date":$commit_time,
349 ac0a4dfc 2024-03-28 op "short_message":"make changes",
350 87890bc2 2024-03-28 op "message":"make changes\n",
351 763b7f49 2024-03-28 op "diffstat":{
352 763b7f49 2024-03-28 op "files":[{
353 763b7f49 2024-03-28 op "action":"modified",
354 763b7f49 2024-03-28 op "file":"alpha",
355 763b7f49 2024-03-28 op "added":1,
356 763b7f49 2024-03-28 op "removed":1
357 763b7f49 2024-03-28 op }],
358 763b7f49 2024-03-28 op "total":{
359 763b7f49 2024-03-28 op "added":1,
360 763b7f49 2024-03-28 op "removed":1
361 763b7f49 2024-03-28 op }
362 763b7f49 2024-03-28 op }
363 87890bc2 2024-03-28 op }
364 87890bc2 2024-03-28 op EOF
365 5565365c 2024-03-27 op done >> $testroot/stdout.expected
366 5565365c 2024-03-27 op echo "]}" >> $testroot/stdout.expected
367 87890bc2 2024-03-28 op ed -s "$testroot/stdout.expected" <<-EOF
368 87890bc2 2024-03-28 op ,j
369 87890bc2 2024-03-28 op w
370 87890bc2 2024-03-28 op EOF
371 5565365c 2024-03-27 op
372 5565365c 2024-03-27 op cmp -s $testroot/stdout.expected $testroot/stdout
373 5565365c 2024-03-27 op ret=$?
374 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
375 5565365c 2024-03-27 op diff -u $testroot/stdout.expected $testroot/stdout
376 5565365c 2024-03-27 op test_done "$testroot" "$ret"
377 5565365c 2024-03-27 op return 1
378 5565365c 2024-03-27 op fi
379 5565365c 2024-03-27 op
380 5565365c 2024-03-27 op test_done "$testroot" "$ret"
381 5565365c 2024-03-27 op }
382 5565365c 2024-03-27 op
383 5565365c 2024-03-27 op test_many_commits_summarized() {
384 5565365c 2024-03-27 op local testroot=`test_init many_commits_summarized 1`
385 5565365c 2024-03-27 op
386 5565365c 2024-03-27 op got clone -a -q ${GOTD_TEST_REPO_URL} $testroot/repo-clone
387 5565365c 2024-03-27 op ret=$?
388 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
389 5565365c 2024-03-27 op echo "got clone failed unexpectedly" >&2
390 5565365c 2024-03-27 op test_done "$testroot" 1
391 5565365c 2024-03-27 op return 1
392 5565365c 2024-03-27 op fi
393 5565365c 2024-03-27 op
394 5565365c 2024-03-27 op got checkout -q $testroot/repo-clone $testroot/wt >/dev/null
395 5565365c 2024-03-27 op ret=$?
396 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
397 5565365c 2024-03-27 op echo "got checkout failed unexpectedly" >&2
398 5565365c 2024-03-27 op test_done "$testroot" 1
399 5565365c 2024-03-27 op return 1
400 5565365c 2024-03-27 op fi
401 5565365c 2024-03-27 op
402 5565365c 2024-03-27 op for i in `seq 1 51`; do
403 5565365c 2024-03-27 op echo "alpha $i" > $testroot/wt/alpha
404 5565365c 2024-03-27 op (cd $testroot/wt && got commit -m 'make changes' > /dev/null)
405 5565365c 2024-03-27 op local commit_id=`git_show_head $testroot/repo-clone`
406 5565365c 2024-03-27 op local short_commit_id=`trim_obj_id 33 $commit_id`
407 5565365c 2024-03-27 op local author_time=`git_show_author_time $testroot/repo-clone`
408 939d3016 2024-04-23 op set -- "$@" "$short_commit_id $author_time"
409 5565365c 2024-03-27 op done
410 5565365c 2024-03-27 op
411 050c0b8c 2024-04-16 op timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
412 5565365c 2024-03-27 op > $testroot/stdout &
413 5a430400 2024-05-12 naddy
414 5a430400 2024-05-12 naddy sleep 1 # server starts up
415 5565365c 2024-03-27 op
416 5565365c 2024-03-27 op got send -b main -q -r $testroot/repo-clone
417 5565365c 2024-03-27 op ret=$?
418 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
419 5565365c 2024-03-27 op echo "got send failed unexpectedly" >&2
420 5565365c 2024-03-27 op test_done "$testroot" "1"
421 5565365c 2024-03-27 op return 1
422 5565365c 2024-03-27 op fi
423 5565365c 2024-03-27 op
424 5565365c 2024-03-27 op wait %1 # wait for the http "server"
425 5565365c 2024-03-27 op
426 9e88f9d9 2024-03-28 op printf '{"notifications":[' > $testroot/stdout.expected
427 5565365c 2024-03-27 op comma=""
428 5565365c 2024-03-27 op for i in `seq 1 51`; do
429 5565365c 2024-03-27 op s=`pop_idx $i "$@"`
430 5565365c 2024-03-27 op commit_id=$(echo $s | cut -d' ' -f1)
431 939d3016 2024-04-23 op commit_time=$(echo "$s" | cut -d' ' -f2)
432 87890bc2 2024-03-28 op
433 87890bc2 2024-03-28 op echo "$comma"
434 87890bc2 2024-03-28 op comma=','
435 87890bc2 2024-03-28 op
436 87890bc2 2024-03-28 op cat <<-EOF
437 87890bc2 2024-03-28 op {
438 93623901 2024-03-28 op "type":"commit",
439 87890bc2 2024-03-28 op "short":true,
440 c1003102 2024-04-15 op "repo":"test-repo",
441 841969e1 2024-04-30 op "authenticated_user":"${GOTD_DEVUSER}",
442 87890bc2 2024-03-28 op "id":"$commit_id",
443 ac0a4dfc 2024-03-28 op "committer":{
444 ac0a4dfc 2024-03-28 op "user":"$GOT_AUTHOR_8"
445 ac0a4dfc 2024-03-28 op },
446 939d3016 2024-04-23 op "date":$commit_time,
447 ac0a4dfc 2024-03-28 op "short_message":"make changes"
448 87890bc2 2024-03-28 op }
449 87890bc2 2024-03-28 op EOF
450 5565365c 2024-03-27 op done >> $testroot/stdout.expected
451 5565365c 2024-03-27 op echo "]}" >> $testroot/stdout.expected
452 914bfd3d 2024-03-28 op ed -s "$testroot/stdout.expected" <<-EOF
453 914bfd3d 2024-03-28 op ,j
454 914bfd3d 2024-03-28 op w
455 914bfd3d 2024-03-28 op EOF
456 914bfd3d 2024-03-28 op
457 914bfd3d 2024-03-28 op cmp -s $testroot/stdout.expected $testroot/stdout
458 914bfd3d 2024-03-28 op ret=$?
459 914bfd3d 2024-03-28 op if [ $ret -ne 0 ]; then
460 914bfd3d 2024-03-28 op diff -u $testroot/stdout.expected $testroot/stdout
461 914bfd3d 2024-03-28 op test_done "$testroot" "$ret"
462 914bfd3d 2024-03-28 op return 1
463 914bfd3d 2024-03-28 op fi
464 914bfd3d 2024-03-28 op
465 914bfd3d 2024-03-28 op test_done "$testroot" "$ret"
466 914bfd3d 2024-03-28 op }
467 914bfd3d 2024-03-28 op
468 914bfd3d 2024-03-28 op test_branch_created() {
469 914bfd3d 2024-03-28 op local testroot=`test_init branch_created 1`
470 914bfd3d 2024-03-28 op
471 914bfd3d 2024-03-28 op got clone -a -q ${GOTD_TEST_REPO_URL} $testroot/repo-clone
472 914bfd3d 2024-03-28 op ret=$?
473 914bfd3d 2024-03-28 op if [ $ret -ne 0 ]; then
474 914bfd3d 2024-03-28 op echo "got clone failed unexpectedly" >&2
475 914bfd3d 2024-03-28 op test_done "$testroot" 1
476 914bfd3d 2024-03-28 op return 1
477 914bfd3d 2024-03-28 op fi
478 914bfd3d 2024-03-28 op
479 914bfd3d 2024-03-28 op got checkout -q $testroot/repo-clone $testroot/wt >/dev/null
480 914bfd3d 2024-03-28 op ret=$?
481 914bfd3d 2024-03-28 op if [ $ret -ne 0 ]; then
482 914bfd3d 2024-03-28 op echo "got checkout failed unexpectedly" >&2
483 914bfd3d 2024-03-28 op test_done "$testroot" 1
484 914bfd3d 2024-03-28 op return 1
485 914bfd3d 2024-03-28 op fi
486 914bfd3d 2024-03-28 op
487 914bfd3d 2024-03-28 op (cd $testroot/wt && got branch newbranch > /dev/null)
488 914bfd3d 2024-03-28 op
489 914bfd3d 2024-03-28 op echo "change alpha on branch" > $testroot/wt/alpha
490 914bfd3d 2024-03-28 op (cd $testroot/wt && got commit -m 'newbranch' > /dev/null)
491 914bfd3d 2024-03-28 op local commit_id=`git_show_branch_head $testroot/repo-clone newbranch`
492 914bfd3d 2024-03-28 op local author_time=`git_show_author_time $testroot/repo-clone $commit_id`
493 914bfd3d 2024-03-28 op
494 050c0b8c 2024-04-16 op timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
495 914bfd3d 2024-03-28 op > $testroot/stdout &
496 914bfd3d 2024-03-28 op
497 5a430400 2024-05-12 naddy sleep 1 # server starts up
498 5a430400 2024-05-12 naddy
499 914bfd3d 2024-03-28 op got send -b newbranch -q -r $testroot/repo-clone
500 914bfd3d 2024-03-28 op ret=$?
501 914bfd3d 2024-03-28 op if [ $ret -ne 0 ]; then
502 914bfd3d 2024-03-28 op echo "got send failed unexpectedly" >&2
503 914bfd3d 2024-03-28 op test_done "$testroot" "1"
504 914bfd3d 2024-03-28 op return 1
505 914bfd3d 2024-03-28 op fi
506 914bfd3d 2024-03-28 op
507 914bfd3d 2024-03-28 op wait %1 # wait for the http "server"
508 914bfd3d 2024-03-28 op
509 914bfd3d 2024-03-28 op # in the future it should contain something like this too
510 914bfd3d 2024-03-28 op # {
511 914bfd3d 2024-03-28 op # "type":"new-branch",
512 914bfd3d 2024-03-28 op # "user":"${GOTD_DEVUSER}",
513 914bfd3d 2024-03-28 op # "ref":"refs/heads/newbranch"
514 914bfd3d 2024-03-28 op # },
515 914bfd3d 2024-03-28 op
516 914bfd3d 2024-03-28 op touch "$testroot/stdout.expected"
517 87890bc2 2024-03-28 op ed -s "$testroot/stdout.expected" <<-EOF
518 914bfd3d 2024-03-28 op a
519 914bfd3d 2024-03-28 op {"notifications":[
520 914bfd3d 2024-03-28 op {
521 914bfd3d 2024-03-28 op "type":"commit",
522 914bfd3d 2024-03-28 op "short":false,
523 c1003102 2024-04-15 op "repo":"test-repo",
524 841969e1 2024-04-30 op "authenticated_user":"${GOTD_DEVUSER}",
525 914bfd3d 2024-03-28 op "id":"$commit_id",
526 914bfd3d 2024-03-28 op "author":{
527 914bfd3d 2024-03-28 op "full":"$GOT_AUTHOR",
528 914bfd3d 2024-03-28 op "name":"$GIT_AUTHOR_NAME",
529 914bfd3d 2024-03-28 op "mail":"$GIT_AUTHOR_EMAIL",
530 914bfd3d 2024-03-28 op "user":"$GOT_AUTHOR_11"
531 914bfd3d 2024-03-28 op },
532 914bfd3d 2024-03-28 op "committer":{
533 914bfd3d 2024-03-28 op "full":"$GOT_AUTHOR",
534 914bfd3d 2024-03-28 op "name":"$GIT_AUTHOR_NAME",
535 914bfd3d 2024-03-28 op "mail":"$GIT_AUTHOR_EMAIL",
536 914bfd3d 2024-03-28 op "user":"$GOT_AUTHOR_11"
537 914bfd3d 2024-03-28 op },
538 939d3016 2024-04-23 op "date":$author_time,
539 914bfd3d 2024-03-28 op "short_message":"newbranch",
540 914bfd3d 2024-03-28 op "message":"newbranch\n",
541 763b7f49 2024-03-28 op "diffstat":{
542 763b7f49 2024-03-28 op "files":[{
543 763b7f49 2024-03-28 op "action":"modified",
544 763b7f49 2024-03-28 op "file":"alpha",
545 763b7f49 2024-03-28 op "added":1,
546 763b7f49 2024-03-28 op "removed":1
547 763b7f49 2024-03-28 op }],
548 763b7f49 2024-03-28 op "total":{
549 763b7f49 2024-03-28 op "added":1,
550 763b7f49 2024-03-28 op "removed":1
551 763b7f49 2024-03-28 op }
552 763b7f49 2024-03-28 op }
553 914bfd3d 2024-03-28 op }
554 914bfd3d 2024-03-28 op ]}
555 914bfd3d 2024-03-28 op .
556 87890bc2 2024-03-28 op ,j
557 87890bc2 2024-03-28 op w
558 87890bc2 2024-03-28 op EOF
559 5565365c 2024-03-27 op
560 5565365c 2024-03-27 op cmp -s $testroot/stdout.expected $testroot/stdout
561 5565365c 2024-03-27 op ret=$?
562 5565365c 2024-03-27 op if [ $ret -ne 0 ]; then
563 5565365c 2024-03-27 op diff -u $testroot/stdout.expected $testroot/stdout
564 5565365c 2024-03-27 op test_done "$testroot" "$ret"
565 5565365c 2024-03-27 op return 1
566 5565365c 2024-03-27 op fi
567 5565365c 2024-03-27 op
568 5565365c 2024-03-27 op test_done "$testroot" "$ret"
569 5565365c 2024-03-27 op }
570 d6057084 2024-03-28 op
571 d6057084 2024-03-28 op test_branch_removed() {
572 d6057084 2024-03-28 op local testroot=`test_init branch_removed 1`
573 d6057084 2024-03-28 op
574 d6057084 2024-03-28 op got clone -a -q ${GOTD_TEST_REPO_URL} $testroot/repo-clone
575 d6057084 2024-03-28 op ret=$?
576 d6057084 2024-03-28 op if [ $ret -ne 0 ]; then
577 d6057084 2024-03-28 op echo "got clone failed unexpectedly" >&2
578 d6057084 2024-03-28 op test_done "$testroot" 1
579 d6057084 2024-03-28 op return 1
580 d6057084 2024-03-28 op fi
581 5565365c 2024-03-27 op
582 050c0b8c 2024-04-16 op timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
583 d6057084 2024-03-28 op > $testroot/stdout &
584 5a430400 2024-05-12 naddy
585 5a430400 2024-05-12 naddy sleep 1 # server starts up
586 d6057084 2024-03-28 op
587 d6057084 2024-03-28 op local commit_id=`git_show_branch_head $testroot/repo-clone newbranch`
588 d6057084 2024-03-28 op
589 d6057084 2024-03-28 op got send -d newbranch -q -r $testroot/repo-clone
590 d6057084 2024-03-28 op ret=$?
591 d6057084 2024-03-28 op if [ $ret -ne 0 ]; then
592 d6057084 2024-03-28 op echo "got send failed unexpectedly" >&2
593 d6057084 2024-03-28 op test_done "$testroot" "1"
594 d6057084 2024-03-28 op return 1
595 d6057084 2024-03-28 op fi
596 d6057084 2024-03-28 op
597 d6057084 2024-03-28 op wait %1 # wait for the http "server"
598 d6057084 2024-03-28 op
599 d6057084 2024-03-28 op touch "$testroot/stdout.expected"
600 d6057084 2024-03-28 op ed -s "$testroot/stdout.expected" <<-EOF
601 d6057084 2024-03-28 op a
602 d6057084 2024-03-28 op {"notifications":[{
603 d6057084 2024-03-28 op "type":"branch-deleted",
604 c1003102 2024-04-15 op "repo":"test-repo",
605 841969e1 2024-04-30 op "authenticated_user":"${GOTD_DEVUSER}",
606 d6057084 2024-03-28 op "ref":"refs/heads/newbranch",
607 d6057084 2024-03-28 op "id":"$commit_id"
608 553d8347 2024-03-28 op }]}
609 553d8347 2024-03-28 op .
610 553d8347 2024-03-28 op ,j
611 553d8347 2024-03-28 op w
612 553d8347 2024-03-28 op EOF
613 553d8347 2024-03-28 op
614 553d8347 2024-03-28 op cmp -s $testroot/stdout.expected $testroot/stdout
615 553d8347 2024-03-28 op ret=$?
616 553d8347 2024-03-28 op if [ $ret -ne 0 ]; then
617 553d8347 2024-03-28 op diff -u $testroot/stdout.expected $testroot/stdout
618 553d8347 2024-03-28 op test_done "$testroot" "$ret"
619 553d8347 2024-03-28 op return 1
620 553d8347 2024-03-28 op fi
621 553d8347 2024-03-28 op
622 553d8347 2024-03-28 op test_done "$testroot" "$ret"
623 553d8347 2024-03-28 op }
624 553d8347 2024-03-28 op
625 553d8347 2024-03-28 op test_tag_created() {
626 553d8347 2024-03-28 op local testroot=`test_init tag_created 1`
627 553d8347 2024-03-28 op
628 553d8347 2024-03-28 op got clone -a -q ${GOTD_TEST_REPO_URL} $testroot/repo-clone
629 553d8347 2024-03-28 op ret=$?
630 553d8347 2024-03-28 op if [ $ret -ne 0 ]; then
631 553d8347 2024-03-28 op echo "got clone failed unexpectedly" >&2
632 553d8347 2024-03-28 op test_done "$testroot" 1
633 553d8347 2024-03-28 op return 1
634 553d8347 2024-03-28 op fi
635 553d8347 2024-03-28 op
636 553d8347 2024-03-28 op got tag -r $testroot/repo-clone -m "new tag" 1.0 > /dev/null
637 553d8347 2024-03-28 op local commit_id=`git_show_head $testroot/repo-clone`
638 553d8347 2024-03-28 op local tagger_time=`git_show_tagger_time $testroot/repo-clone 1.0`
639 553d8347 2024-03-28 op
640 050c0b8c 2024-04-16 op timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
641 553d8347 2024-03-28 op >$testroot/stdout &
642 553d8347 2024-03-28 op
643 5a430400 2024-05-12 naddy sleep 1 # server starts up
644 5a430400 2024-05-12 naddy
645 553d8347 2024-03-28 op got send -t 1.0 -q -r $testroot/repo-clone
646 553d8347 2024-03-28 op ret=$?
647 553d8347 2024-03-28 op if [ $ret -ne 0 ]; then
648 553d8347 2024-03-28 op echo "got send failed unexpectedly" >&2
649 553d8347 2024-03-28 op test_done "$testroot" "1"
650 553d8347 2024-03-28 op return 1
651 553d8347 2024-03-28 op fi
652 553d8347 2024-03-28 op
653 553d8347 2024-03-28 op wait %1 # wait for the http "server"
654 553d8347 2024-03-28 op
655 553d8347 2024-03-28 op touch "$testroot/stdout.expected"
656 553d8347 2024-03-28 op ed -s "$testroot/stdout.expected" <<-EOF
657 553d8347 2024-03-28 op a
658 553d8347 2024-03-28 op {"notifications":[{
659 553d8347 2024-03-28 op "type":"tag",
660 c1003102 2024-04-15 op "repo":"test-repo",
661 841969e1 2024-04-30 op "authenticated_user":"${GOTD_DEVUSER}",
662 553d8347 2024-03-28 op "tag":"refs/tags/1.0",
663 553d8347 2024-03-28 op "tagger":{
664 553d8347 2024-03-28 op "full":"$GOT_AUTHOR",
665 553d8347 2024-03-28 op "name":"$GIT_AUTHOR_NAME",
666 553d8347 2024-03-28 op "mail":"$GIT_AUTHOR_EMAIL",
667 553d8347 2024-03-28 op "user":"$GOT_AUTHOR_11"
668 553d8347 2024-03-28 op },
669 939d3016 2024-04-23 op "date":$tagger_time,
670 553d8347 2024-03-28 op "object":{
671 553d8347 2024-03-28 op "type":"commit",
672 553d8347 2024-03-28 op "id":"$commit_id"
673 553d8347 2024-03-28 op },
674 553d8347 2024-03-28 op "message":"new tag\n\n"
675 d6057084 2024-03-28 op }]}
676 d6057084 2024-03-28 op .
677 d6057084 2024-03-28 op ,j
678 d6057084 2024-03-28 op w
679 d6057084 2024-03-28 op EOF
680 d6057084 2024-03-28 op
681 d6057084 2024-03-28 op cmp -s $testroot/stdout.expected $testroot/stdout
682 d6057084 2024-03-28 op ret=$?
683 d6057084 2024-03-28 op if [ $ret -ne 0 ]; then
684 d6057084 2024-03-28 op diff -u $testroot/stdout.expected $testroot/stdout
685 d6057084 2024-03-28 op test_done "$testroot" "$ret"
686 d6057084 2024-03-28 op return 1
687 d6057084 2024-03-28 op fi
688 d6057084 2024-03-28 op
689 d6057084 2024-03-28 op test_done "$testroot" "$ret"
690 d6057084 2024-03-28 op }
691 cd182532 2024-03-28 op
692 cd182532 2024-03-28 op test_tag_changed() {
693 cd182532 2024-03-28 op local testroot=`test_init tag_changed 1`
694 cd182532 2024-03-28 op
695 cd182532 2024-03-28 op got clone -a -q ${GOTD_TEST_REPO_URL} $testroot/repo-clone
696 cd182532 2024-03-28 op ret=$?
697 cd182532 2024-03-28 op if [ $ret -ne 0 ]; then
698 cd182532 2024-03-28 op echo "got clone failed unexpectedly" >&2
699 cd182532 2024-03-28 op test_done "$testroot" 1
700 cd182532 2024-03-28 op return 1
701 cd182532 2024-03-28 op fi
702 cd182532 2024-03-28 op
703 cd182532 2024-03-28 op got checkout -q $testroot/repo-clone $testroot/wt >/dev/null
704 cd182532 2024-03-28 op ret=$?
705 cd182532 2024-03-28 op if [ $ret -ne 0 ]; then
706 cd182532 2024-03-28 op echo "got checkout failed unexpectedly" >&2
707 cd182532 2024-03-28 op test_done "$testroot" 1
708 cd182532 2024-03-28 op return 1
709 cd182532 2024-03-28 op fi
710 cd182532 2024-03-28 op
711 cd182532 2024-03-28 op echo "change alpha" > $testroot/wt/alpha
712 cd182532 2024-03-28 op (cd $testroot/wt && got commit -m 'make changes' > /dev/null)
713 cd182532 2024-03-28 op local commit_id=`git_show_head $testroot/repo-clone`
714 d6057084 2024-03-28 op
715 cd182532 2024-03-28 op got ref -r $testroot/repo-clone -d refs/tags/1.0 >/dev/null
716 cd182532 2024-03-28 op got tag -r $testroot/repo-clone -m "new tag" 1.0 > /dev/null
717 cd182532 2024-03-28 op local tagger_time=`git_show_tagger_time $testroot/repo-clone 1.0`
718 cd182532 2024-03-28 op
719 050c0b8c 2024-04-16 op timeout 5 ./http-server -a $AUTH -p "$GOTD_TEST_HTTP_PORT" \
720 cd182532 2024-03-28 op > $testroot/stdout &
721 cd182532 2024-03-28 op
722 5a430400 2024-05-12 naddy sleep 1 # server starts up
723 5a430400 2024-05-12 naddy
724 cd182532 2024-03-28 op got send -f -t 1.0 -q -r $testroot/repo-clone
725 cd182532 2024-03-28 op ret=$?
726 cd182532 2024-03-28 op if [ $ret -ne 0 ]; then
727 cd182532 2024-03-28 op echo "got send failed unexpectedly" >&2
728 cd182532 2024-03-28 op test_done "$testroot" "1"
729 cd182532 2024-03-28 op return 1
730 cd182532 2024-03-28 op fi
731 cd182532 2024-03-28 op
732 cd182532 2024-03-28 op wait %1 # wait for the http "server"
733 cd182532 2024-03-28 op
734 cd182532 2024-03-28 op # XXX: at the moment this is exactly the same as the "new tag"
735 cd182532 2024-03-28 op # notification
736 cd182532 2024-03-28 op
737 cd182532 2024-03-28 op touch "$testroot/stdout.expected"
738 cd182532 2024-03-28 op ed -s "$testroot/stdout.expected" <<-EOF
739 cd182532 2024-03-28 op a
740 cd182532 2024-03-28 op {"notifications":[{
741 cd182532 2024-03-28 op "type":"tag",
742 c1003102 2024-04-15 op "repo":"test-repo",
743 841969e1 2024-04-30 op "authenticated_user":"${GOTD_DEVUSER}",
744 cd182532 2024-03-28 op "tag":"refs/tags/1.0",
745 cd182532 2024-03-28 op "tagger":{
746 cd182532 2024-03-28 op "full":"$GOT_AUTHOR",
747 cd182532 2024-03-28 op "name":"$GIT_AUTHOR_NAME",
748 cd182532 2024-03-28 op "mail":"$GIT_AUTHOR_EMAIL",
749 cd182532 2024-03-28 op "user":"$GOT_AUTHOR_11"
750 cd182532 2024-03-28 op },
751 939d3016 2024-04-23 op "date":$tagger_time,
752 cd182532 2024-03-28 op "object":{
753 cd182532 2024-03-28 op "type":"commit",
754 cd182532 2024-03-28 op "id":"$commit_id"
755 cd182532 2024-03-28 op },
756 cd182532 2024-03-28 op "message":"new tag\n\n"
757 cd182532 2024-03-28 op }]}
758 cd182532 2024-03-28 op .
759 cd182532 2024-03-28 op ,j
760 cd182532 2024-03-28 op w
761 cd182532 2024-03-28 op EOF
762 cd182532 2024-03-28 op
763 cd182532 2024-03-28 op cmp -s $testroot/stdout.expected $testroot/stdout
764 cd182532 2024-03-28 op ret=$?
765 cd182532 2024-03-28 op if [ $ret -ne 0 ]; then
766 cd182532 2024-03-28 op diff -u $testroot/stdout.expected $testroot/stdout
767 cd182532 2024-03-28 op test_done "$testroot" "$ret"
768 cd182532 2024-03-28 op return 1
769 cd182532 2024-03-28 op fi
770 cd182532 2024-03-28 op
771 cd182532 2024-03-28 op test_done "$testroot" "$ret"
772 cd182532 2024-03-28 op }
773 cd182532 2024-03-28 op
774 5565365c 2024-03-27 op test_parseargs "$@"
775 5565365c 2024-03-27 op run_test test_file_changed
776 ea5e974d 2024-03-28 op run_test test_bad_utf8
777 5565365c 2024-03-27 op run_test test_many_commits_not_summarized
778 5565365c 2024-03-27 op run_test test_many_commits_summarized
779 914bfd3d 2024-03-28 op run_test test_branch_created
780 d6057084 2024-03-28 op run_test test_branch_removed
781 553d8347 2024-03-28 op run_test test_tag_created
782 cd182532 2024-03-28 op run_test test_tag_changed