-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-ci-test.sh
executable file
·71 lines (53 loc) · 2.95 KB
/
run-ci-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
63
64
65
66
67
68
69
70
71
#!/bin/bash
set -e
./gradlew :test-server:bootJar
JAR_PATH="./test-server/build/libs/test-server.jar"
JAVA_CMD="java"
if [ -n "$JAVA_HOME" ]; then
JAVA_CMD="$JAVA_HOME/bin/java"
fi
"$JAVA_CMD" -version # make sure java is executable
TEST_SERVER_OPTS='-Xmx400m -Dio.netty.maxDirectMemory=314572800'
"$JAVA_CMD" $TEST_SERVER_OPTS -jar "$JAR_PATH" &
TEST_SERVER_PID=$!
"$JAVA_CMD" $TEST_SERVER_OPTS -jar "$JAR_PATH" "--spring.profiles.active=h1" &
TEST_SERVER_H1_PID=$!
"$JAVA_CMD" $TEST_SERVER_OPTS -jar "$JAR_PATH" "--spring.profiles.active=h1-ssl" &
TEST_SERVER_H1_SSL_PID=$!
"$JAVA_CMD" $TEST_SERVER_OPTS -jar "$JAR_PATH" "--spring.profiles.active=ssl" &
TEST_SERVER_SSL_PID=$!
"$JAVA_CMD" $TEST_SERVER_OPTS -jar "$JAR_PATH" "--spring.profiles.active=mtls" &
TEST_SERVER_MTLS_PID=$!
function cleanup {
set +e # on error resume next
[ "$TEST_SERVER_PID" ] && kill $TEST_SERVER_PID
[ "$TEST_SERVER_H1_PID" ] && kill $TEST_SERVER_H1_PID
[ "$TEST_SERVER_H1_SSL_PID" ] && kill $TEST_SERVER_H1_SSL_PID
[ "$TEST_SERVER_SSL_PID" ] && kill $TEST_SERVER_SSL_PID
[ "$TEST_SERVER_MTLS_PID" ] && kill $TEST_SERVER_MTLS_PID
}
trap cleanup EXIT
READY=false
for attempt in {1..90}; do sleep 1; if curl -sSI --fail-early -f http://localhost:18081/actuator/health/; then READY=true; break; fi; echo "Waiting for Test Server to be UP"; done
[ "$READY" = true ] || (echo "Test Server is not UP" && exit 1)
echo "Test Server is UP"
READY=false
for attempt in {1..60}; do sleep 1; if curl -sSI --fail-early -f http://localhost:18083/actuator/health/; then READY=true; break; fi; echo "Waiting for Test Server (HTTP/1) to be UP"; done
[ "$READY" = true ] || (echo "Test Server (HTTP/1) is not UP" && exit 1)
echo "Test Server (HTTP/1) is UP"
READY=false
for attempt in {1..60}; do sleep 1; if curl -sSI --insecure --fail-early -f https://localhost:18088/actuator/health/; then READY=true; break; fi; echo "Waiting for Test Server (HTTP/1 SSL) to be UP"; done
[ "$READY" = true ] || (echo "Test Server (HTTP/1 SSL) is not UP" && exit 1)
echo "Test Server (HTTP/1 SSL) is UP"
READY=false
for attempt in {1..60}; do sleep 1; if curl -sSI --insecure --fail-early -f https://localhost:18084/actuator/health/; then READY=true; break; fi; echo "Waiting for Test Server (SSL) to be UP"; done
[ "$READY" = true ] || (echo "Test Server (SSL) is not UP" && exit 1)
echo "Test Server (SSL) is UP"
# Windows runner's default curl does not work with OpenSSL. Workaround by sleeping.
#READY=false
#for attempt in {1..60}; do sleep 1; if curl -sSI --insecure --cert ./test-common/src/main/resources/tls/clientKeyAndCert.pem --fail-early -f https://localhost:18086/actuator/health/; then READY=true; break; fi; echo "Waiting for Test Server (mTLS) to be UP"; done
#[ "$READY" = true ] || (echo "Test Server (mTLS) is not UP" && exit 1)
#echo "Test Server (mTLS) is UP"
sleep 10
export GRADLE_OPTS='-Xmx64m -Dorg.gradle.daemon=false -Dorg.gradle.jvmargs="-Xmx3072m -XX:+HeapDumpOnOutOfMemoryError"'
./gradlew check -PisCI=true