Skip to content

Commit 75274bf

Browse files
danishedbDanish Khanhh24kjsilvelafcanovai
authored
ci: fix report name for upgrade test
Fix an issue where the result of the upgrade test was not displayed Co-authored-by: Danish Khan <danish.khan@Danishs-MacBook-Pro.local> Co-authored-by: Hai He <hai.he@enterprisedb.com> Co-authored-by: Jaime Silvela <jaime.silvela@enterprisedb.com> Co-authored-by: Francesco Canovai <francesco.canovai@enterprisedb.com>
1 parent 1435c94 commit 75274bf

File tree

3 files changed

+55
-28
lines changed

3 files changed

+55
-28
lines changed

.github/report-failed-test.sh

+23-16
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,26 @@
66
##
77

88
echo '::echo::off'
9-
jq -c -f "hack/e2e/filter-failures.jq" "tests/e2e/out/report.json" | while read -rs failure; do
10-
echo "$failure" | jq -r '. | { Test: .Test, Error: .Error, Location: (.File + ":" + .Line) } | to_entries[] | "\(.key): \(.value )"'
11-
## The below line will print an annotation
12-
## on the relevant source code line of the
13-
## test that has failed. The annotation will
14-
## be printed in the "changed files" tab of
15-
## the Pull Request. We are commenting this
16-
## to avoid generating noise when tests fail
17-
## during workflows of PRs unrelated to that
18-
## specific test.
19-
# echo "$failure" | jq -r '. | "::notice file=" + .File + ",line=" + .Line + "::" + (.Error | @json )'
20-
echo "::group::Stack trace"
21-
echo "$failure" | jq -r .Stack
22-
echo "::endgroup::"
23-
echo "-----"
24-
done
9+
for ff in "tests/e2e/out/upgrade_report.json" "tests/e2e/out/report.json"
10+
do
11+
# the upgrade_report.json file may not exist depending on the test level
12+
if [ ! -f $ff ] && [ $ff = "tests/e2e/out/upgrade_report.json" ]; then
13+
continue
14+
fi
15+
jq -c -f "hack/e2e/filter-failures.jq" $ff | while read -rs failure; do
16+
echo "$failure" | jq -r '. | { Test: .Test, Error: .Error, Location: (.File + ":" + .Line) } | to_entries[] | "\(.key): \(.value )"'
17+
## The below line will print an annotation
18+
## on the relevant source code line of the
19+
## test that has failed. The annotation will
20+
## be printed in the "changed files" tab of
21+
## the Pull Request. We are commenting this
22+
## to avoid generating noise when tests fail
23+
## during workflows of PRs unrelated to that
24+
## specific test.
25+
# echo "$failure" | jq -r '. | "::notice file=" + .File + ",line=" + .Line + "::" + (.Error | @json )'
26+
echo "::group::Stack trace"
27+
echo "$failure" | jq -r .Stack
28+
echo "::endgroup::"
29+
echo "-----"
30+
done
31+
done

.github/workflows/continuous-delivery.yml

+30-10
Original file line numberDiff line numberDiff line change
@@ -574,9 +574,13 @@ jobs:
574574
./.github/report-failed-test.sh
575575
-
576576
name: Cleanup ginkgo JSON report
577-
# Delete report.json after the analysis. Step should fail if file is not there
577+
# Delete report.json after the analysis. File should always exist.
578+
# Delete upgrade_report.json. It may not exist depending on test level.
578579
if: always()
579-
run:
580+
run: |
581+
if [ -f tests/e2e/out/upgrade_report.json ]; then
582+
rm tests/e2e/out/upgrade_report.json
583+
fi
580584
rm tests/e2e/out/report.json
581585
582586
-
@@ -740,9 +744,13 @@ jobs:
740744
./.github/report-failed-test.sh
741745
-
742746
name: Cleanup ginkgo JSON report
743-
# Delete report.json after the analysis. Step should fail if file is not there
747+
# Delete report.json after the analysis. File should always exist.
748+
# Delete upgrade_report.json. It may not exist depending on test level.
744749
if: always()
745-
run:
750+
run: |
751+
if [ -f tests/e2e/out/upgrade_report.json ]; then
752+
rm tests/e2e/out/upgrade_report.json
753+
fi
746754
rm tests/e2e/out/report.json
747755
-
748756
name: Archive e2e failure contexts
@@ -878,9 +886,13 @@ jobs:
878886
./.github/report-failed-test.sh
879887
-
880888
name: Cleanup ginkgo JSON report
881-
# Delete report.json after the analysis. Step should fail if file is not there
889+
# Delete report.json after the analysis. File should always exist.
890+
# Delete upgrade_report.json. It may not exist depending on test level.
882891
if: always()
883-
run:
892+
run: |
893+
if [ -f tests/e2e/out/upgrade_report.json ]; then
894+
rm tests/e2e/out/upgrade_report.json
895+
fi
884896
rm tests/e2e/out/report.json
885897
-
886898
name: Archive e2e failure contexts
@@ -1072,9 +1084,13 @@ jobs:
10721084
./.github/report-failed-test.sh
10731085
-
10741086
name: Cleanup ginkgo JSON report
1075-
# Delete report.json after the analysis. Step should fail if file is not there
1087+
# Delete report.json after the analysis. File should always exist.
1088+
# Delete upgrade_report.json. It may not exist depending on test level.
10761089
if: always()
1077-
run:
1090+
run: |
1091+
if [ -f tests/e2e/out/upgrade_report.json ]; then
1092+
rm tests/e2e/out/upgrade_report.json
1093+
fi
10781094
rm tests/e2e/out/report.json
10791095
-
10801096
name: Archive e2e failure contexts
@@ -1212,9 +1228,13 @@ jobs:
12121228
./.github/report-failed-test.sh
12131229
-
12141230
name: Cleanup ginkgo JSON report
1215-
# Delete report.json after the analysis. Step should fail if file is not there
1231+
# Delete report.json after the analysis. File should always exist.
1232+
# Delete upgrade_report.json. It may not exist depending on test level.
12161233
if: always()
1217-
run:
1234+
run: |
1235+
if [ -f tests/e2e/out/upgrade_report.json ]; then
1236+
rm tests/e2e/out/upgrade_report.json
1237+
fi
12181238
rm tests/e2e/out/report.json
12191239
-
12201240
name: Wait for PVs to be released

hack/e2e/run-e2e.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ if [[ "${TEST_UPGRADE_TO_V1}" != "false" ]]; then
9191
mkdir -p "${ROOT_DIR}/tests/e2e/out"
9292
# Unset DEBUG to prevent k8s from spamming messages
9393
unset DEBUG
94-
ginkgo --nodes=1 --slow-spec-threshold=5m --label-filter "upgrade" --output-dir "${ROOT_DIR}/tests/e2e/out/" --json-report "report.json" -v "${ROOT_DIR}/tests/e2e/..." || true
94+
ginkgo --nodes=1 --slow-spec-threshold=5m --label-filter "upgrade" --output-dir "${ROOT_DIR}/tests/e2e/out" --json-report "upgrade_report.json" -v "${ROOT_DIR}/tests/e2e/..." || true
9595

9696
# Report if there are any tests that failed and did NOT have an "ignore-fails" label
97-
jq -e -c -f "${ROOT_DIR}/hack/e2e/test-report.jq" "${ROOT_DIR}/tests/e2e/out/report.json" || RC=$?
97+
jq -e -c -f "${ROOT_DIR}/hack/e2e/test-report.jq" "${ROOT_DIR}/tests/e2e/out/upgrade_report.json" || RC=$?
9898
fi
9999

100100
CONTROLLER_IMG="${CONTROLLER_IMG}" \

0 commit comments

Comments
 (0)