@@ -40,7 +40,6 @@ export annotation_input="tests/tmp/annotation.input"
4040 rm " ${annotation_input} "
4141}
4242
43-
4443@test " can define a special context" {
4544 export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
4645 export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_CONTEXT=" junit_custom_context"
@@ -67,6 +66,7 @@ export annotation_input="tests/tmp/annotation.input"
6766 unstub docker
6867 rm " ${annotation_input} "
6968}
69+
7070@test " can pass through optional job uuid file pattern" {
7171 export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
7272 export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN=" custom_(*)_pattern.xml"
@@ -143,6 +143,32 @@ export annotation_input="tests/tmp/annotation.input"
143143 unstub docker
144144}
145145
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+
146172@test " errors without the 'artifacts' property set" {
147173 run " $PWD /hooks/command"
148174
@@ -262,8 +288,6 @@ export annotation_input="tests/tmp/annotation.input"
262288 unstub docker
263289}
264290
265-
266-
267291@test " error bubbles up when agent download fails" {
268292 export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
269293 export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAIL_BUILD_ON_ERROR=false
0 commit comments