Skip to content

Commit 908821c

Browse files
committed
Corrected tests now that output is important
1 parent 434c978 commit 908821c

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

tests/command.bats

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export annotation_input="tests/tmp/annotation.input"
5353
"annotate --context \* --style \* : cat >'${annotation_input}'; echo Annotation added with context \$3 and style \$5, content saved"
5454

5555
stub docker \
56-
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
56+
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
5757

5858
run "$PWD/hooks/command"
5959

@@ -80,7 +80,7 @@ export annotation_input="tests/tmp/annotation.input"
8080
"annotate --context \* --style \* : cat >'${annotation_input}'; echo Annotation added with context \$3 and style \$5, content saved"
8181

8282
stub docker \
83-
"--log-level error run --rm --volume \* --volume \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN='custom_(*)_pattern.xml' --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
83+
"--log-level error run --rm --volume \* --volume \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_JOB_UUID_FILE_PATTERN='custom_(*)_pattern.xml' --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
8484

8585
run "$PWD/hooks/command"
8686

@@ -107,7 +107,7 @@ export annotation_input="tests/tmp/annotation.input"
107107
"annotate --context \* --style \* : cat >'${annotation_input}'; echo Annotation added with context \$3 and style \$5, content saved"
108108

109109
stub docker \
110-
"--log-level error run --rm --volume \* --volume \* --env \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_FORMAT='file' --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
110+
"--log-level error run --rm --volume \* --volume \* --env \* --env BUILDKITE_PLUGIN_JUNIT_ANNOTATE_FAILURE_FORMAT='file' --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
111111

112112
run "$PWD/hooks/command"
113113

@@ -132,7 +132,7 @@ export annotation_input="tests/tmp/annotation.input"
132132
"artifact download \* \* : echo Downloaded artifact \$3 to \$4"
133133

134134
stub docker \
135-
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo No test errors"
135+
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
136136

137137
run "$PWD/hooks/command"
138138

@@ -156,13 +156,14 @@ export annotation_input="tests/tmp/annotation.input"
156156
"annotate --context \* --style \* : cat >'${annotation_input}'; echo Annotation added with context \$3 and style \$5, content saved"
157157

158158
stub docker \
159-
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo No test errors"
159+
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo 'Total tests: 0'"
160160

161161
run "$PWD/hooks/command"
162162

163163
assert_success
164-
assert_output --partial "No test errors"
164+
assert_output --partial "Total tests: 0"
165165
assert_output --partial "Will create annotation anyways"
166+
assert_equal "$(cat "${annotation_input}")" 'Total tests: 0'
166167

167168
unstub mktemp
168169
unstub buildkite-agent
@@ -194,7 +195,7 @@ export annotation_input="tests/tmp/annotation.input"
194195
"artifact download \* \* : echo Downloaded artifact \$3 to \$4"
195196

196197
stub docker \
197-
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
198+
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
198199

199200
run "$PWD/hooks/command"
200201

@@ -256,7 +257,7 @@ export annotation_input="tests/tmp/annotation.input"
256257
"annotate --context \* --style \* : cat >'${annotation_input}'; echo Annotation added with context \$3 and style \$5, content saved"
257258

258259
stub docker \
259-
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
260+
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
260261

261262
run "$PWD/hooks/command"
262263

@@ -285,7 +286,7 @@ export annotation_input="tests/tmp/annotation.input"
285286
"artifact download \* \* : echo Downloaded artifact \$3 to \$4"
286287

287288
stub docker \
288-
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 64"
289+
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 64"
289290

290291
run "$PWD/hooks/command"
291292

@@ -311,7 +312,7 @@ export annotation_input="tests/tmp/annotation.input"
311312
"artifact download \* \* : echo Downloaded artifact \$3 to \$4"
312313

313314
stub docker \
314-
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : echo '<details>Failure</details>' && exit 147"
315+
"--log-level error run --rm --volume \* --volume \* --env \* --env \* --env \* ruby:2.7-alpine ruby /src/bin/annotate /junits : cat tests/2-tests-1-failure.output && exit 147"
315316

316317
run "$PWD/hooks/command"
317318

0 commit comments

Comments
 (0)