@@ -12,6 +12,8 @@ export artifacts_tmp="tests/tmp/junit-artifacts"
12
12
export annotation_tmp=" tests/tmp/junit-annotation"
13
13
export annotation_input=" tests/tmp/annotation.input"
14
14
15
+ DOCKER_STUB_DEFAULT_OPTIONS=' --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* --env \* \*'
16
+
15
17
@test " runs the annotator and creates the annotation" {
16
18
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
17
19
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAIL_BUILD_ON_ERROR=false
@@ -25,7 +27,7 @@ export annotation_input="tests/tmp/annotation.input"
25
27
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
26
28
27
29
stub docker \
28
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
30
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
29
31
30
32
run " $PWD /hooks/command"
31
33
@@ -53,14 +55,14 @@ export annotation_input="tests/tmp/annotation.input"
53
55
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
54
56
55
57
stub docker \
56
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
58
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
57
59
58
60
run " $PWD /hooks/command"
59
61
60
62
assert_success
61
63
62
64
assert_output --partial " Annotation added with context junit_custom_context"
63
-
65
+
64
66
unstub mktemp
65
67
unstub buildkite-agent
66
68
unstub docker
@@ -80,7 +82,7 @@ export annotation_input="tests/tmp/annotation.input"
80
82
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
81
83
82
84
stub docker \
83
- " --log-level error run --rm --volume \* --volume \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN='custom_(*)_pattern.xml' --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
85
+ " --log-level error run --rm --volume \* --volume \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN='custom_(*)_pattern.xml' --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
84
86
85
87
run " $PWD /hooks/command"
86
88
@@ -107,7 +109,7 @@ export annotation_input="tests/tmp/annotation.input"
107
109
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
108
110
109
111
stub docker \
110
- " --log-level error run --rm --volume \* --volume \* --env \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_FORMAT='file' --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
112
+ " --log-level error run --rm --volume \* --volume \* --env \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_FORMAT='file' --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
111
113
112
114
run " $PWD /hooks/command"
113
115
@@ -132,7 +134,7 @@ export annotation_input="tests/tmp/annotation.input"
132
134
" artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4"
133
135
134
136
stub docker \
135
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
137
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
136
138
137
139
run " $PWD /hooks/command"
138
140
@@ -156,7 +158,7 @@ export annotation_input="tests/tmp/annotation.input"
156
158
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
157
159
158
160
stub docker \
159
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
161
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
160
162
161
163
run " $PWD /hooks/command"
162
164
@@ -195,7 +197,7 @@ export annotation_input="tests/tmp/annotation.input"
195
197
" artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4"
196
198
197
199
stub docker \
198
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
200
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
199
201
200
202
run " $PWD /hooks/command"
201
203
@@ -227,7 +229,7 @@ export annotation_input="tests/tmp/annotation.input"
227
229
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
228
230
229
231
stub docker \
230
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
232
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
231
233
232
234
run " $PWD /hooks/command"
233
235
@@ -257,7 +259,7 @@ export annotation_input="tests/tmp/annotation.input"
257
259
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
258
260
259
261
stub docker \
260
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
262
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
261
263
262
264
run " $PWD /hooks/command"
263
265
@@ -281,12 +283,12 @@ export annotation_input="tests/tmp/annotation.input"
281
283
stub du \
282
284
" -k \* : echo 1025$'\t'\$ 2" \
283
285
" -k \* : echo 1025$'\t'\$ 2"
284
-
286
+
285
287
stub buildkite-agent \
286
288
" artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4"
287
289
288
290
stub docker \
289
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
291
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
290
292
291
293
run " $PWD /hooks/command"
292
294
@@ -312,7 +314,7 @@ export annotation_input="tests/tmp/annotation.input"
312
314
" artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4"
313
315
314
316
stub docker \
315
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 147"
317
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 147"
316
318
317
319
run " $PWD /hooks/command"
318
320
@@ -380,7 +382,7 @@ export annotation_input="tests/tmp/annotation.input"
380
382
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
381
383
382
384
stub docker \
383
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
385
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
384
386
385
387
run " $PWD /hooks/command"
386
388
@@ -406,7 +408,7 @@ export annotation_input="tests/tmp/annotation.input"
406
408
" artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4"
407
409
408
410
stub docker \
409
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : echo 'Total tests: 100'"
411
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : echo 'Total tests: 100'"
410
412
411
413
run " $PWD /hooks/command"
412
414
@@ -432,7 +434,7 @@ export annotation_input="tests/tmp/annotation.input"
432
434
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
433
435
434
436
stub docker \
435
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* \* ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
437
+ " ${DOCKER_STUB_DEFAULT_OPTIONS} ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
436
438
437
439
run " $PWD /hooks/command"
438
440
@@ -457,7 +459,7 @@ export annotation_input="tests/tmp/annotation.input"
457
459
" annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
458
460
459
461
stub docker \
460
- " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:special ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
462
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* --env \* ruby:special ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
461
463
462
464
run " $PWD /hooks/command"
463
465
@@ -470,4 +472,4 @@ export annotation_input="tests/tmp/annotation.input"
470
472
unstub buildkite-agent
471
473
unstub docker
472
474
rm " ${annotation_input} "
473
- }
475
+ }
0 commit comments