File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,34 @@ load "$BATS_PATH/load.bash"
33
33
unstub docker
34
34
}
35
35
36
+ @test " can pass through optional params" {
37
+ export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
38
+ export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN=" custom_(*)_pattern.xml"
39
+ export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_OUTPUT=" file"
40
+
41
+ artifacts_tmp=" tests/tmp/$PWD /junit-artifacts"
42
+ annotation_tmp=" tests/tmp/$PWD /junit-annotation"
43
+
44
+ stub mktemp \
45
+ " -d junit-annotate-plugin-artifacts-tmp.XXXXXXXXXX : mkdir -p $artifacts_tmp ; echo $artifacts_tmp " \
46
+ " -d junit-annotate-plugin-annotation-tmp.XXXXXXXXXX : mkdir -p $annotation_tmp ; echo $annotation_tmp "
47
+
48
+ stub buildkite-agent " artifact download junits/*.xml /plugin/tests/tmp//plugin/junit-artifacts : echo Downloaded artifacts" \
49
+ " annotate --context junit --style error : echo Annotation added"
50
+
51
+ stub docker " --log-level error run --rm --volume /plugin/tests/tmp//plugin/junit-artifacts:/junits --volume /plugin/hooks/../ruby:/src --env " BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN=${BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN:- } " --env " BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_OUTPUT=${BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_OUTPUT:- } " ruby:2.5-alpine /src/bin/annotate /junits : echo '<details>Failure</details>'"
52
+
53
+ run " $PWD /hooks/command"
54
+
55
+ assert_success
56
+
57
+ assert_output --partial " Annotation added"
58
+
59
+ unstub mktemp
60
+ unstub buildkite-agent
61
+ unstub docker
62
+ }
63
+
36
64
@test " doesn't create annotation unless there's failures" {
37
65
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
38
66
You can’t perform that action at this time.
0 commit comments