-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathintegration-tests.sh
More file actions
executable file
·65 lines (53 loc) · 1.41 KB
/
integration-tests.sh
File metadata and controls
executable file
·65 lines (53 loc) · 1.41 KB
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
63
64
65
#!/bin/bash
## This script is used to run integration tests for the steem load balancer
## It builds the docker image, runs the server, and sends a GET request to the server
## It checks if the server is up and running and if the response is correct.
## required env var STEEM_LB_PATH
if [ -z "$STEEM_LB_PATH" ]; then
echo "STEEM_LB_PATH is not set"
exit 1
fi
source ./retry-tests.sh
## build-and-run
if ! pushd $STEEM_LB_PATH; then
echo "Failed to pushd to $STEEM_LB_PATH"
exit 1
fi
echo "Stopping any existing server..."
./stop.sh || true
echo "Building the docker image..."
if ! ./build.sh; then
echo "Failed to build the docker image"
exit 1
fi
echo "Starting the server..."
./run.sh &
MAX_TIMEOUT_SEC=300
while :
do
echo "Waiting for the server to start..."
# check $DOCKER_IMAGE status via docker ps
status=$(docker ps | grep $DOCKER_IMAGE | awk '{print $7}')
if [ "$status" == "Up" ]; then
break
fi
## check if timeout
if [ $MAX_TIMEOUT_SEC -le 0 ]; then
echo "Timeout: Server did not start"
exit 1
fi
MAX_TIMEOUT_SEC=$((MAX_TIMEOUT_SEC-1))
sleep 1
done
echo "Server is up and running"
## Run the integration tests
source $STEEM_LB_PATH/tests/tests.sh
popd
echo "Stopping the server..."
$STEEM_LB_PATH/stop.sh
if [ "$RESULT" != "true" ]; then
echo "Integration tests failed!"
exit 1
fi
echo "All integration tests passed!"
exit 0