Skip to content

Commit

Permalink
Added test for special ruby image
Browse files Browse the repository at this point in the history
  • Loading branch information
toote committed Oct 28, 2022
1 parent bfddd4b commit 4f6f35d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/command.bats
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,32 @@ export annotation_input="tests/tmp/annotation.input"

unstub mktemp
unstub buildkite-agent
}

@test "runs the annotator and creates the annotation with special image" {
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS="junits/*.xml"
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_RUBY_IMAGE="ruby:special"

stub mktemp \
"-d \* : mkdir -p '$artifacts_tmp'; echo '$artifacts_tmp'" \
"-d \* : mkdir -p '$annotation_tmp'; echo '$annotation_tmp'"

stub buildkite-agent \
"artifact download \* \* : echo Downloaded artifact \$3 to \$4" \
"annotate --context \* --style \* : cat >'${annotation_input}'; echo Annotation added with context \$3 and style \$5, content saved"

stub docker \
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:special ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"

run "$PWD/hooks/command"

assert_success

assert_output --partial "Annotation added with context junit and style error"
assert_equal "$(cat "${annotation_input}")" '<details>Failure</details>'

unstub mktemp
unstub buildkite-agent
unstub docker
rm "${annotation_input}"
}

0 comments on commit 4f6f35d

Please sign in to comment.