File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,8 @@ docker \
35
35
36
36
cat " $annotation_path "
37
37
38
+ buildkite-agent artifact upload " $annotation_path "
39
+
38
40
if ! grep -q " There were no failures" " $annotation_path " ; then
39
41
echo " --- :buildkite: Creating annotation"
40
42
# shellcheck disable=SC2002
Original file line number Diff line number Diff line change @@ -28,6 +28,31 @@ load "$BATS_PATH/load.bash"
28
28
29
29
assert_output --partial " Annotation added"
30
30
31
+ unstub mktemp
32
+ unstub buildkite-agent
33
+ unstub docker
34
+ }
35
+
36
+ @test " doesn't create annotation unless there's failures" {
37
+ export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
38
+
39
+ artifacts_tmp=" tests/tmp/$PWD /junit-artifacts"
40
+ annotation_tmp=" tests/tmp/$PWD /junit-annotation"
41
+
42
+ stub mktemp \
43
+ " -d junit-annotate-plugin-artifacts-tmp.XXXXXXXXXX : mkdir -p $artifacts_tmp ; echo $artifacts_tmp " \
44
+ " -d junit-annotate-plugin-annotation-tmp.XXXXXXXXXX : mkdir -p $annotation_tmp ; echo $annotation_tmp "
45
+
46
+ stub buildkite-agent " artifact download junits/*.xml /plugin/tests/tmp//plugin/junit-artifacts : echo Downloaded artifacts"
47
+
48
+ 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= ruby:2.5-alpine /src/bin/annotate /junits : echo There were no failures"
49
+
50
+ run " $PWD /hooks/command"
51
+
52
+ assert_success
53
+
54
+ assert_output --partial " There were no failures"
55
+
31
56
unstub mktemp
32
57
unstub buildkite-agent
33
58
unstub docker
You can’t perform that action at this time.
0 commit comments