Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some services start validation to acceptance_tests.sh #17425

Merged
merged 1 commit into from
Sep 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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