File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ load "$BATS_PATH/load.bash"
6
6
# export MKTEMP_STUB_DEBUG=/dev/tty
7
7
# export BUILDKITE_AGENT_STUB_DEBUG=/dev/tty
8
8
# export DOCKER_STUB_DEBUG=/dev/tty
9
+ # export DU_STUB_DEBUG=/dev/tty
9
10
10
11
@test " runs the annotator and creates the annotation" {
11
12
export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
@@ -118,3 +119,32 @@ load "$BATS_PATH/load.bash"
118
119
119
120
assert_output --partial " BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS: unbound variable"
120
121
}
122
+
123
+ @test " fails if the annotation is larger than " {
124
+ export BUILDKITE_PLUGIN_JUNIT_ANNOTATE_ARTIFACTS=" junits/*.xml"
125
+
126
+ artifacts_tmp=" tests/tmp/$PWD /junit-artifacts"
127
+ annotation_tmp=" tests/tmp/$PWD /junit-annotation"
128
+
129
+ stub mktemp \
130
+ " -d junit-annotate-plugin-artifacts-tmp.XXXXXXXXXX : mkdir -p $artifacts_tmp ; echo $artifacts_tmp " \
131
+ " -d junit-annotate-plugin-annotation-tmp.XXXXXXXXXX : mkdir -p $annotation_tmp ; echo $annotation_tmp "
132
+
133
+ # 1kb over the 100k size limit of annotations
134
+ stub du " -k /plugin/tests/tmp//plugin/junit-annotation/annotation.md : echo 101 /plugin/tests/tmp//plugin/junit-annotation/annotation.md"
135
+
136
+ stub buildkite-agent " artifact download junits/*.xml /plugin/tests/tmp//plugin/junit-artifacts : echo Downloaded artifacts"
137
+
138
+ 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= --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_FORMAT= ruby:2.5-alpine /src/bin/annotate /junits : echo '<details>Failure</details>'"
139
+
140
+ run " $PWD /hooks/command"
141
+
142
+ assert_success
143
+
144
+ assert_output --partial " Failures too large to annotate"
145
+
146
+ unstub docker
147
+ unstub buildkite-agent
148
+ unstub du
149
+ unstub mktemp
150
+ }
You can’t perform that action at this time.
0 commit comments