Skip to content

Commit 03e24fe

Browse files
authored
Force conformance tests to fail properly (#1786)
Problem: If the conformance test Pod runner failed, the `make` process would still pass. This is because the failure code would not propagate to outside of the Pod. Solution: After the Pod runs, check the exit code and fail it it's non-zero. Used a bash script for this because running the `kubectl get pod` command in the Makefile would not return an Errored Pod for some reason. Only worked in bash.
1 parent 72381e2 commit 03e24fe

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

conformance/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ run-conformance-tests: ## Run conformance tests
103103
--restart=Never -- sh -c "go test -v . -tags conformance,experimental -args --gateway-class=$(GATEWAY_CLASS) \
104104
--supported-features=$(SUPPORTED_FEATURES) --version=$(VERSION) \
105105
--report-output=output.txt; cat output.txt" | tee output.txt
106+
bash scripts/check-pod-exit-code.sh
106107
sed -e '1,/CONFORMANCE PROFILE/d' output.txt > conformance-profile.yaml
107108
rm output.txt
108109
[ $(shell cat conformance-profile.yaml | yq '.profiles[0].core.result') != "failure" ] \
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
CODE=$(kubectl get pod conformance -o jsonpath='{.status.containerStatuses[].state.terminated.exitCode}')
4+
if [ $CODE -ne 0 ]; then
5+
exit 2
6+
fi

0 commit comments

Comments
 (0)