Skip to content

Commit 4f6f35d

Browse files
committed
Added test for special ruby image
1 parent bfddd4b commit 4f6f35d

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/command.bats

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,4 +343,32 @@ export annotation_input="tests/tmp/annotation.input"
343343

344344
unstub mktemp
345345
unstub buildkite-agent
346+
}
347+
348+
@test "runs the annotator and creates the annotation with special image" {
349+
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS="junits/*.xml"
350+
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_RUBY_IMAGE="ruby:special"
351+
352+
stub mktemp \
353+
"-d \* : mkdir -p '$artifacts_tmp'; echo '$artifacts_tmp'" \
354+
"-d \* : mkdir -p '$annotation_tmp'; echo '$annotation_tmp'"
355+
356+
stub buildkite-agent \
357+
"artifact download \* \* : echo Downloaded artifact \$3 to \$4" \
358+
"annotate --context \* --style \* : cat >'${annotation_input}'; echo Annotation added with context \$3 and style \$5, content saved"
359+
360+
stub docker \
361+
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:special ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
362+
363+
run "$PWD/hooks/command"
364+
365+
assert_success
366+
367+
assert_output --partial "Annotation added with context junit and style error"
368+
assert_equal "$(cat "${annotation_input}")" '<details>Failure</details>'
369+
370+
unstub mktemp
371+
unstub buildkite-agent
372+
unstub docker
373+
rm "${annotation_input}"
346374
}

0 commit comments

Comments
 (0)