Skip to content

Commit

Permalink
Merge pull request #346 from GabyCT/topic/ilibs
Browse files Browse the repository at this point in the history
tests: Improve variable definition in tests/e2e scripts
  • Loading branch information
wainersm committed Feb 21, 2024
2 parents 31a4efa + 0f92c9c commit 016a7d4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions tests/e2e/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions tests/e2e/operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/run-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 016a7d4

Please sign in to comment.