Skip to content

Commit

Permalink
Add some services start validation to acceptance_tests.sh (airbytehq#…
Browse files Browse the repository at this point in the history
  • Loading branch information
gosusnp authored and jhammarstedt committed Oct 31, 2022
1 parent 1ad4de2 commit fac1577
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion tools/bin/acceptance_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ set -e

assert_root

## Helper functions

get_epoch_time() {
date +'%s'
}

check_success() {
docker-compose ps | grep "^$1" | grep 'Exit 0' >/dev/null || (echo "$1 didn't run successfully"; exit 1)
}

##

echo "Starting app..."

# Detach so we can run subsequent commands
Expand All @@ -17,7 +29,26 @@ shutdown_cmd="docker-compose down -v || docker kill \$(docker ps -a -f volume=ai
# trap "echo 'docker-compose logs:' && docker-compose logs -t --tail 1000 && $shutdown_cmd" EXIT

echo "Waiting for services to begin"
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8000/api/v1/health)" != "200" ]]; do echo "Waiting for docker deployment.."; sleep 5; done
starttime=`get_epoch_time`
maxtime=300
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8000/api/v1/health)" != "200" ]];
do
echo "Waiting for docker deployment.."
currenttime=`get_epoch_time`
if [[ $(( $currenttime - $starttime )) -gt $maxtime ]]; then
docker-compose ps
echo "Platform is taking more than ${maxtime}s to start. Aborting..."
exit 1
fi
sleep 5
done

# Getting a snapshot of the docker compose state
docker-compose ps

# Make sure init containers ran successfully
check_success 'init'
check_success 'airbyte-bootloader'

echo "Running e2e tests via gradle"
SUB_BUILD=PLATFORM USE_EXTERNAL_DEPLOYMENT=true ./gradlew :airbyte-tests:acceptanceTests --rerun-tasks --scan

0 comments on commit fac1577

Please sign in to comment.