Skip to content

Commit

Permalink
test: fix GA annotation parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adirelle committed May 11, 2024
1 parent e0663db commit 4575a68
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 20 deletions.
2 changes: 1 addition & 1 deletion e2e/assert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
source "$TEST_ROOT/style.sh"

fail() {
title="assertion failed" err "$*"
title="E2E assertion failed" err "$*"
exit 1
}

Expand Down
20 changes: 5 additions & 15 deletions e2e/run_all_tests
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ source "$SCRIPT_DIR/style.sh"

FILES="$(find "$SCRIPT_DIR" -name 'test_*' -type f -printf '%P\n' | sort)"
test_count=0
passed_tests=()
failed_tests=()
status=0

if [ -n "${GITHUB_STEP_SUMMARY:-}" ]; then
{
Expand All @@ -26,20 +25,11 @@ for f in $FILES; do
continue
fi
fi
if "$ROOT/e2e/run_test" "$f"; then
passed_tests=("${passed_tests[@]}" "$f")
else
failed_tests=("${failed_tests[@]}" "$f")
if ! "$ROOT/e2e/run_test" "$f"; then
status=1
fi
test_count=$((test_count + 1))
done

echo "e2e: ran $test_count tests" >&2

if [[ -n "${passed_tests[*]}" ]]; then
ok "e2e: ${#passed_tests[*]} tests passed: ${passed_tests[*]}"
fi
if [[ -n "${failed_tests[*]}" ]]; then
err "e2e: ${#failed_tests[*]} tests failed: ${failed_tests[*]}"
exit 1
fi
echo "E2E: ran $test_count tests" >&2
exit $status
3 changes: 2 additions & 1 deletion e2e/run_test
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ run_test() {
remove_isolated_env
STATUS_MSG=":white_check_mark:"
else
title="E2E test failed" err "Test exited with status code $status"
title="E2E test failed: $TEST" err "Exited with status code $status"
STATUS_MSG=":x:"
echo "Test environment can be examined in $TEST_ISOLATED_DIR" >&2
fi
if [[ -n "${GITHUB_STEP_SUMMARY:-}" ]]; then
echo "| $TEST | $((END - START))s | $STATUS_MSG" >>"$GITHUB_STEP_SUMMARY"
Expand Down
7 changes: 4 additions & 3 deletions e2e/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
if [[ -n ${GITHUB_ACTION:-} ]]; then
# Output Github action annotations
annotate() {
: "${file:=${TEST_SCRIPT:-}}"
: "${title:=}"
echo "::${type:?}${file:+ file=${file}}${title:+ title=${title}}::$*" >&2
local parameters=""
[[ -n ${file:=${TEST_SCRIPT:-}} ]] && parameters="file=${file}"
[[ -n ${title:-} ]] && parameters="${parameters:+,}title=${title}"
echo "::${type:-debug}${parameters:+ ${parameters}}::$*" >&2
}
err() { type=error annotate "$*"; }
warn() { type=warning annotate "$*"; }
Expand Down

0 comments on commit 4575a68

Please sign in to comment.