diff --git a/tests/e2e/lib.sh b/tests/e2e/lib.sh index 0452644d..7a0181b4 100644 --- a/tests/e2e/lib.sh +++ b/tests/e2e/lib.sh @@ -104,9 +104,9 @@ wait_pods() { # Note: copied from kata-containers/tests/lib/common.bash # wait_for_process() { - wait_time="$1" - sleep_time="$2" - cmd="$3" + local wait_time="$1" + local sleep_time="$2" + local cmd="$3" while [ "$wait_time" -gt 0 ]; do if eval "$cmd"; then return 0 diff --git a/tests/e2e/operator.sh b/tests/e2e/operator.sh index 601c808d..a4e17f3d 100755 --- a/tests/e2e/operator.sh +++ b/tests/e2e/operator.sh @@ -147,7 +147,7 @@ install_ccruntime() { # Check if the runtime is up. # There could be a case where it is not even if the pods above are running. - cmd="kubectl get runtimeclass | grep -q ${runtimeclass}" + local cmd="kubectl get runtimeclass | grep -q ${runtimeclass}" if ! wait_for_process 300 30 "$cmd"; then echo "::error:: runtimeclass ${runtimeclass} is not up" return 1 @@ -260,11 +260,11 @@ uninstall_operator() { # wait_for_stabilization() { declare -A restart_counts - iteration=0 - count=0 + local iteration=0 + local count=0 while true; do - change=0 - pod_info=$(kubectl get pods -n "$op_ns" -o=jsonpath='{range .items[*]}{.metadata.name}{" "}{range .status.containerStatuses[*]}{.name}{" "}{.restartCount}{"\n"}{end}{end}') + local change=0 + local pod_info=$(kubectl get pods -n "$op_ns" -o=jsonpath='{range .items[*]}{.metadata.name}{" "}{range .status.containerStatuses[*]}{.name}{" "}{.restartCount}{"\n"}{end}{end}') while read -r pod container restart_count; do if [ "${restart_counts[$pod-$container]--1}" != "$restart_count" ]; then diff --git a/tests/e2e/run-local.sh b/tests/e2e/run-local.sh index 1b11d519..fe407d4d 100755 --- a/tests/e2e/run-local.sh +++ b/tests/e2e/run-local.sh @@ -114,7 +114,7 @@ main() { run 20m sudo -E PATH="$PATH" bash -c './operator.sh' echo "::info:: Run tests" - cmd="run 20m sudo -E PATH=\"$PATH\" bash -c " + local cmd="run 20m sudo -E PATH=\"$PATH\" bash -c " if [ -z "$runtimeclass" ]; then cmd+="'./tests_runner.sh'" else