Skip to content

Commit

Permalink
tests.e2e: Ensure we don't skip on kubectl failure
Browse files Browse the repository at this point in the history
recent issues in CI indicate that kubectl might sometimes fail which
results in wait_for_process interrupting the loop. Let's improve the
command to ensure kubectl command passed and only then grep for the
(un)expected output.

Note the positive commands do not need to be treated as the output
should not contain the pod names on failure.

Fixes: #339

Signed-off-by: Lukáš Doktor <[email protected]>
  • Loading branch information
ldoktor committed Jan 31, 2024
1 parent db80d13 commit 62d67be
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/e2e/operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ uninstall_ccruntime() {
popd >/dev/null

# Wait and ensure ccruntime pods are gone
#
local cmd="! sudo -E kubectl get pods -n $op_ns |"
cmd+="grep -q -e cc-operator-daemon-install"
# (ensure failing kubectl keeps iterating)
local cmd="_OUT=\$(sudo -E kubectl get pods -n '$op_ns')"
cmd+=" && ! echo \$_OUT | grep -q -e cc-operator-daemon-install"
cmd+=" -e cc-operator-pre-install-daemon"
if ! wait_for_process 720 30 "$cmd"; then
echo "ERROR: there are ccruntime pods still running"
Expand Down Expand Up @@ -242,10 +242,9 @@ uninstall_operator() {
popd >/dev/null

# Wait and ensure the controller pod is gone
#
local pod="cc-operator-controller-manager"
local cmd="! kubectl get pods -n $op_ns |"
cmd+="grep -q $pod"
# (ensure failing kubectl keeps iterating)
local cmd="_OUT=\$(sudo -E kubectl get pods -n '$op_ns')"
cmd+="&& ! echo \$_OUT | grep -q -e cc-operator-controller-manager"
if ! wait_for_process 180 30 "$cmd"; then
echo "ERROR: the controller manager is still running"

Expand Down

0 comments on commit 62d67be

Please sign in to comment.