Skip to content

Commit

Permalink
chore(#132): implement retry logic for Docker image pulls
Browse files Browse the repository at this point in the history
  • Loading branch information
Maria Lorena Rodriguez Viruel committed Sep 18, 2024
1 parent 84170fc commit 3ae1475
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions mediator/test/e2e-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,33 @@ MEDIATORDIR="${BASEDIR}/mediator"
export NODE_ENV=integration
export NODE_TLS_REJECT_UNAUTHORIZED=0

# Cleanup from last test, in case of interruptions
retry_startup() {
max_attempts=5
count=0
until ./startup.sh init || [ $count -eq $max_attempts ]; do
echo "Attempt $((count+1)) of $max_attempts to start containers failed, retrying in 30 seconds..."
count=$((count+1))
sleep 30
done

if [ $count -eq $max_attempts ]; then
echo "Failed to start containers after $max_attempts attempts."
exit 1
fi
}

echo 'Cleanup from last test, in case of interruptions...'
cd $BASEDIR
./startup.sh destroy

# Starting the interoperability containers
echo 'Starting the interoperability containers...'
cd $BASEDIR
./startup.sh init
retry_startup

# Waiting for configurator to finish
echo 'Waiting for configurator to finish...'
docker container wait chis-interop-configurator-1

# Executing mediator e2e tests
echo 'Executing mediator e2e tests...'
cd $MEDIATORDIR
export OPENHIM_API_URL='https://localhost:8080'
export FHIR_URL='http://localhost:5001'
Expand All @@ -31,7 +45,7 @@ export CHT_USERNAME='admin'
export CHT_PASSWORD='password'
npm test ltfu-flow.spec.ts

# Cleanup
echo 'Cleanup after test...'
unset NODE_ENV
unset NODE_TLS_REJECT_UNAUTHORIZED
unset OPENHIM_API_URL
Expand Down

0 comments on commit 3ae1475

Please sign in to comment.