From f6ceb2ff45a71938f6949abcd15aa0a1b0f79842 Mon Sep 17 00:00:00 2001 From: Nahshon Unna Tsameret <60659093+nunnatsa@users.noreply.github.com> Date: Thu, 2 Nov 2023 07:50:21 -0400 Subject: [PATCH] Add sleeps to automation/create_workloads.sh (#202) The e2e test fails from time to time, waiting for vmi that was not created yet. This PR changes the script so it will retry reading the vmi before waiting for it to be ready. Signed-off-by: Nahshon Unna-Tsameret --- automation/create_workloads.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/automation/create_workloads.sh b/automation/create_workloads.sh index 0688ec44..80836b53 100755 --- a/automation/create_workloads.sh +++ b/automation/create_workloads.sh @@ -27,7 +27,23 @@ done # wait for the execution of the first 5 VMs for ns in {001..005}; do - ${CMD} wait -n "ns${ns}" vmi "testvm-ns${ns}-vm001" --for condition=Ready --timeout="300s" + found=false + for tries in {1..5}; do + if ${CMD} get -n "ns${ns}" vmi "testvm-ns${ns}-vm001"; then + found=true + break + else + echo "vmi ns${ns}/testvm-ns${ns}-vm001 does not exist yet. waiting 10 second" + sleep 10 + fi + done + + if [[ $found != "true" ]]; then + echo "vmi ns${ns}/testvm-ns${ns}-vm001 was not created" + exit 1 + fi + + ${CMD} wait -n "ns${ns}" vmi "testvm-ns${ns}-vm001" --for condition=Ready --timeout=300s done ${CMD} get vmis --all-namespaces