-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-test-container.sh
executable file
·58 lines (44 loc) · 1.31 KB
/
run-test-container.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
#!/bin/bash
export IMAGE="${1:-gcr.io/neo4j-pivotal/causal-cluster/tester:3.5.5}"
export NAMESPACE="${2:-default}"
export NAME="${3:-testrun}"
export CORES=3
export READ_REPLICAS=1
export HTTP_PORT=7474
export HTTPS_PORT=7473
export BOLT_PORT=7687
cat test/tester.yaml | envsubst > target/tester.yaml
# Delete pod if it happens to be leftover from a previous test run.
kubectl delete pod testrun-tester --ignore-not-found=true
# Kick off new test.
kubectl apply -f target/tester.yaml --namespace $NAMESPACE
if [ $? -ne 0 ] ; then
echo "Failed to run test container"
exit 1
fi
result=null
while true
do
result=$(kubectl get pod $NAME-tester --namespace $NAMESPACE --output=json | jq -r '.status.containerStatuses[0].state.terminated.reason')
if [ "$result" != "null" ] ; then
break
else
echo "Test container is creating or still running. Waiting..."
fi
sleep 4
done
echo "Dumping logs"
kubectl logs $NAME-tester --namespace $NAMESPACE
echo "=========================================="
echo "FINAL TEST POD STATUS IS $result"
echo "=========================================="
if [ "$result" = "Error" ] ; then
echo "Tests failed"
exit 1
fi
if [ "$result" = "Completed" ] ; then
echo "Tests succeeded, mazel tov\!"
exit 0
fi
echo "Uncertain test pod result $result"
exit 1