Skip to content

Commit 2aacc02

Browse files
committed
[CI] Buildkite: Adds failing test files to test results
1 parent 08c5cba commit 2aacc02

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

.buildkite/log-results.sh

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,38 @@
11
#!/usr/bin/env bash
22
#
33
# This script is intended to be run after the build in a Buildkite pipeline
4-
buildkite-agent annotate "## :rspec: Tests summary :rspec:
4+
buildkite-agent annotate --style info "## :rspec: Tests summary :rspec:
55
"
6-
buildkite-agent artifact download "elasticsearch-api/tmp/*.html" .
6+
buildkite-agent artifact download "elasticsearch-api/tmp/*" .
77

8+
# Test result summary:
89
files="elasticsearch-api/tmp/*.html"
910
for f in $files; do
1011
TEST_SUITE=`echo $f | grep -o "\(free\|platinum\)"`
1112
RUBY_VERSION=`echo $f | grep -Po "(\d+\.)+\d+"`
1213
EXAMPLES=`cat $f | grep -o "[0-9]\+ examples\?" | tail -1`
1314
FAILURES=`cat $f | grep -o "[0-9]\+ failures\?" | tail -1`
1415
PENDING=`cat $f | grep -o "[0-9]\+ pending" | tail -1`
15-
buildkite-agent annotate --style info --append "
16+
buildkite-agent annotate --append "
1617
:ruby: $RUBY_VERSION :test_tube: $TEST_SUITE :rspec: $EXAMPLES - :x: $FAILURES - :suspect: $PENDING
1718
"
1819
done
20+
21+
# Get file names for failing tests
22+
# FAILED_TESTS=`awk 'BEGIN { FS = " | "}; /\| failed \|/{ print $1 }' 'elasticsearch-api/tmp/rspec_log.log' | uniq`
23+
24+
files="elasticsearch-api/tmp/*.log"
25+
for f in $files; do
26+
FAILED_TESTS=`awk 'BEGIN { FS = " | "}; /\| failed \|/{ print $1 }' $f | uniq`
27+
if [[ -n "$FAILED_TESTS" ]]; then
28+
buildkite-agent annotate --append "
29+
#### Failures in $f
30+
"
31+
for f in "${FAILED_TESTS[@]}"
32+
do
33+
buildkite-agent annotate --append "
34+
$f
35+
"
36+
done
37+
fi
38+
done

0 commit comments

Comments
 (0)