-
Notifications
You must be signed in to change notification settings - Fork 827
/
run-integration-tests.sh
executable file
·54 lines (44 loc) · 1.29 KB
/
run-integration-tests.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
#!/bin/bash
set -xeu -o pipefail
DB="${1:-hsqldb}"
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CONTAINER_SCRIPT_DIR='/root/uaa'
GRADLE_LOCK_DIR='/root/uaa/.gradle/'
case "${DB}" in
hsqldb)
DB_IMAGE_NAME=postgresql # we don't have a container image for hsqldb, and can use any image
PROFILE_NAME="$DB"
;;
percona)
DB_IMAGE_NAME="$DB"
PROFILE_NAME=mysql
;;
postgresql)
DB_IMAGE_NAME="$DB"
PROFILE_NAME="$DB"
;;
mysql|mysql-8)
DB_IMAGE_NAME=mysql-8
PROFILE_NAME=mysql
;;
mysql-5)
DB_IMAGE_NAME=mysql
PROFILE_NAME=mysql
;;
*)
echo "ERROR: '$DB' is not a known database type. Supported types are: hsqldb, percona, postgresql, mysql"
exit 1
esac
if [[ -z "${DOCKER_IMAGE+x}" ]]; then
DOCKER_IMAGE="cfidentity/uaa-${DB_IMAGE_NAME}"
fi
echo "Using docker image: ${DOCKER_IMAGE}"
docker pull ${DOCKER_IMAGE}
docker run --privileged -t -i --shm-size=1G \
-v "${SCRIPT_DIR}":"${CONTAINER_SCRIPT_DIR}" \
-v "${GRADLE_LOCK_DIR}" \
--env DB="${DB}" \
--env RUN_TESTS="${RUN_TESTS:-true}" \
--publish 8081:8080 \
"${DOCKER_IMAGE}" \
/root/uaa/scripts/integration-tests.sh "${PROFILE_NAME}",default "${CONTAINER_SCRIPT_DIR}"