Skip to content

Commit

Permalink
test/e2e: allow expected helm-launch (getting available) errors.
Browse files Browse the repository at this point in the history
Signed-off-by: Krisztian Litkey <[email protected]>
  • Loading branch information
klihub committed Nov 22, 2024
1 parent a1eaf95 commit edd0ad3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/e2e/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ helm-launch() { # script API
# default: 20s
# cfgresource: config custom resource to wait for node status to change in
# default: balloonspolicies/default or topologyawarepolicies/default
# expect_error: don't exit, expect availability error
#
# Example:
# helm_config=$(instantiate helm-config.yaml) helm-launch balloons
Expand All @@ -361,6 +362,7 @@ helm-launch() { # script API
local helm_config="${helm_config:-$TEST_DIR/helm-config.yaml}"
local ds_name="${daemonset_name:-}" ctr_name="${container_name:-nri-resource-policy-$1}"
local helm_name="${helm_name:-test}" timeout="${launch_timeout:-20s}"
local expect_error="${expect_error:-0}"
local plugin="$1" cfgresource=${cfgresource:-} cfgstatus
local deadline
shift
Expand Down Expand Up @@ -403,8 +405,15 @@ helm-launch() { # script API

deadline=$(deadline-for-timeout $timeout)
vm-command "kubectl wait -n kube-system ds/${ds_name} --timeout=$timeout \
--for=jsonpath='{.status.numberAvailable}'=1" || \
error "Timeout while waiting daemonset/${ds_name} to be available"
--for=jsonpath='{.status.numberAvailable}'=1"

if [ "$COMMAND_STATUS" != "0" ]; then
if [ "$expect_error" != "1" ]; then
error "Timeout while waiting daemonset/${ds_name} to be available"
else
return 1
fi
fi

timeout=$(timeout-for-deadline $deadline)
timeout=$timeout wait-config-node-status $cfgresource
Expand All @@ -413,7 +422,6 @@ helm-launch() { # script API
if [ "$result" != "Success" ]; then
reason=$(get-config-node-status-error $cfgresource)
error "Plugin $plugin configuration failed: $reason"
return 1
fi

vm-start-log-collection -n kube-system ds/$ds_name -c $ctr_name
Expand Down

0 comments on commit edd0ad3

Please sign in to comment.