-
Notifications
You must be signed in to change notification settings - Fork 827
/
run-unit-tests.sh
executable file
·60 lines (49 loc) · 1.3 KB
/
run-unit-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
55
56
57
58
59
60
#!/bin/bash
set -xeu
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CONTAINER_SCRIPT_DIR='/root/uaa'
GRADLE_LOCK_DIR='/root/uaa/.gradle/'
DB="${1:-hsqldb}"
case "${DB}" in
hsqldb)
DB_IMAGE_NAME=postgresql # we don't have a container image for hsqldb, and can use any image
DB=hsqldb
PROFILE_NAME=hsqldb
;;
percona)
DB_IMAGE_NAME=percona
DB=percona
PROFILE_NAME=mysql
;;
postgresql|postgresql-15|postgresql-11)
DB_IMAGE_NAME=$1
DB=postgresql
PROFILE_NAME=postgresql
;;
mysql|mysql-8)
DB_IMAGE_NAME=mysql-8
DB=mysql
PROFILE_NAME=mysql
;;
mysql-5)
DB_IMAGE_NAME=mysql
DB=mysql
PROFILE_NAME=mysql
;;
*)
echo $"ERROR: $1 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
docker run \
--privileged \
--tty \
--interactive \
--shm-size=1G \
--volume "${SCRIPT_DIR}":"${CONTAINER_SCRIPT_DIR}" \
--volume "${GRADLE_LOCK_DIR}" \
--env DB="${DB}" \
"${DOCKER_IMAGE}" \
/root/uaa/scripts/unit-tests.sh "${PROFILE_NAME},default" "${CONTAINER_SCRIPT_DIR}"