Skip to content

Commit 4ab07f2

Browse files
committed
exit testsuite gracefully, when oc setup fails
The nounset shell option needs to be set after the OC login attempt, because (from man shopt): -u If expansion is attempted on an unset variable or parameter, the shell prints an error message, and, if not interactive exits with a non-zero status. That is in this matter inconvenient, as we do not really know from log what has happened if the oc login fails and moreover the test suite ends with success, as only the first failed test sets TESTSUITE_RESULT to 1. If we check login with the ct_os_check_login function, it handles the situation conveniently.
1 parent b1ffed0 commit 4ab07f2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/run-openshift-remote-cluster

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ test_postgresql_integration
1616
test_postgresql_imagestream
1717
"
1818

19-
set -u
20-
2119
trap ct_os_cleanup EXIT SIGINT
2220

2321
ct_os_set_ocp4
2422

2523
ct_os_check_compulsory_vars
2624

27-
oc status || false "It looks like oc is not properly logged in."
25+
ct_os_check_login || exit 1
26+
27+
set -u
2828

2929
# For testing on OpenShift 4 we use internal registry
3030
export CT_OCP4_TEST=true

0 commit comments

Comments
 (0)