@@ -40,7 +40,6 @@ export annotation_input="tests/tmp/annotation.input"
40
40
rm " ${annotation_input} "
41
41
}
42
42
43
-
44
43
@test " can define a special context" {
45
44
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
46
45
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_CONTEXT=" junit_custom_context"
@@ -67,6 +66,7 @@ export annotation_input="tests/tmp/annotation.input"
67
66
unstub docker
68
67
rm " ${annotation_input} "
69
68
}
69
+
70
70
@test " can pass through optional job uuid file pattern" {
71
71
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
72
72
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN=" custom_(*)_pattern.xml"
@@ -143,6 +143,32 @@ export annotation_input="tests/tmp/annotation.input"
143
143
unstub docker
144
144
}
145
145
146
+ @test " creates annotation with no failures but always annotate" {
147
+ export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
148
+ export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ALWAYS_ANNOTATE=1
149
+
150
+ stub mktemp \
151
+ " -d \* : mkdir -p '$artifacts_tmp '; echo '$artifacts_tmp '" \
152
+ " -d \* : mkdir -p '$annotation_tmp '; echo '$annotation_tmp '"
153
+
154
+ stub buildkite-agent \
155
+ " artifact download \* \* : echo Downloaded artifact \$ 3 to \$ 4" \
156
+ " annotate --context \* --style \* : cat >'${annotation_input} '; echo Annotation added with context \$ 3 and style \$ 5, content saved"
157
+
158
+ stub docker \
159
+ " --log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo No test errors"
160
+
161
+ run " $PWD /hooks/command"
162
+
163
+ assert_success
164
+ assert_output --partial " No tests errors"
165
+ assert_output --partial " Will create annotation anyways"
166
+
167
+ unstub mktemp
168
+ unstub buildkite-agent
169
+ unstub docker
170
+ }
171
+
146
172
@test " errors without the 'artifacts' property set" {
147
173
run " $PWD /hooks/command"
148
174
@@ -262,8 +288,6 @@ export annotation_input="tests/tmp/annotation.input"
262
288
unstub docker
263
289
}
264
290
265
-
266
-
267
291
@test " error bubbles up when agent download fails" {
268
292
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
269
293
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAIL_BUILD_ON_ERROR=false
0 commit comments