forked from cloudfoundry/uaa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run-unit-tests.sh
executable file
·42 lines (34 loc) · 1022 Bytes
/
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
#!/bin/bash
set -xeu
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CONTAINER_SCRIPT_DIR='/root/uaa'
GRADLE_LOCK_DIR='/root/uaa/.gradle/'
case "$1" 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|mysql)
DB_IMAGE_NAME=$1
DB=$1
PROFILE_NAME=$1
;;
*)
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 -t -i --shm-size=1G \
-v "${SCRIPT_DIR}":"${CONTAINER_SCRIPT_DIR}" \
-v "${GRADLE_LOCK_DIR}" \
--env DB=${DB} \
"${DOCKER_IMAGE}" \
/root/uaa/scripts/unit-tests.sh "${PROFILE_NAME}",default "${CONTAINER_SCRIPT_DIR}"