-
Notifications
You must be signed in to change notification settings - Fork 216
/
acceptance_test.sh
executable file
·63 lines (45 loc) · 2.2 KB
/
acceptance_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env bash
set -e
. tools/lib/lib.sh
assert_root
if [[ ! -z "$CI" ]]; then
CI_MODE_FLAG='-DciMode=true'
fi
## Helper functions
get_epoch_time() {
date +'%s'
}
check_success() {
docker compose ps --all | grep "^$1" | grep -ie 'exit 0' -ie 'exited (0)' >/dev/null || (echo "$1 didn't run successfully"; exit 1)
}
##
echo "Starting app..."
# Detach so we can run subsequent commands
# NOTE: this passes APPLY_FIELD_SELECTION=true, which enables a feature -- field selection -- which is currently disabled by default.
# We want to run our CI tests against the new feature while we prepare to release it.
VERSION=dev STORAGE_BUCKET_ACTIVITY_PAYLOAD=payload STORAGE_BUCKET_LOG=log STORAGE_BUCKET_STATE=state STORAGE_BUCKET_WORKLOAD_OUTPUT=workload TRACKING_STRATEGY=logging BASIC_AUTH_USERNAME="" BASIC_AUTH_PASSWORD="" APPLY_FIELD_SELECTION=true FEATURE_FLAG_PATH=tools/bin/acceptance-test-flags.yml docker compose -f docker-compose.yaml -f docker-compose.workloads.yaml -f docker-compose.acceptance-test.yaml up -d
# Sometimes source/dest containers using airbyte volumes survive shutdown, which need to be killed in order to shut down properly.
shutdown_cmd="docker compose down -v || docker kill \$(docker ps -a -f volume=airbyte_workspace -f volume=airbyte_data -f volume=airbyte_db -q) && docker compose down -v"
# Uncomment for debugging. Warning, this is verbose.
# trap "echo 'docker compose logs:' && docker compose logs -t --tail 1000 && $shutdown_cmd" EXIT
echo "Waiting for services to begin"
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"
USE_EXTERNAL_DEPLOYMENT=true ./gradlew :oss:airbyte-tests:acceptanceTest --rerun-tasks --scan "$CI_MODE_FLAG"