Skip to content

Commit

Permalink
test/cases: implement retry for ssh connection in api test
Browse files Browse the repository at this point in the history
Fixing this by implementing a retry for the whole ssh connection
attempt.
  • Loading branch information
jrusz committed Sep 16, 2024
1 parent 0273908 commit f58193d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/cases/api/common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ function _instanceCheck() {
echo "✔️ Instance checking"
local _ssh="$1"

# Retry loop to wait for instance to be ready
# This is here especially because of gcp test
RETRIES=10
for i in $(seq 1 $RETRIES); do
echo "Attempt $i of $RETRIES: Checking instance status..."
if eval "$_ssh true"; then
echo "Instance is up and ready!"
break
else
echo "Instance is still booting or SSH key not propagated, retrying in 30 seconds..."
sleep 30
fi
done

# Check if postgres is installed
$_ssh rpm -q postgresql dummy

Expand Down

0 comments on commit f58193d

Please sign in to comment.