-
Notifications
You must be signed in to change notification settings - Fork 39
/
docker-run-tests.sh
executable file
·40 lines (34 loc) · 1.16 KB
/
docker-run-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
#! /bin/bash
schemas="${schemas:-public}"
while [ $# -gt 0 ]; do
case "$1" in
--install-fhirbase)
install_fhirbase=1
;;
--schemas=*)
export schemas="${1#*=}"
;;
*)
printf "***************************\n"
printf "* Error: Invalid argument.*\n"
printf "***************************\n"
exit 1
esac
shift
done
export PATH="$HOME"/fhirbase/node_modules/coffee-script/bin:"$PATH" || exit 1
export DATABASE_URL=postgres://fhirbase:fhirbase@localhost:5432/fhirbase || exit 1
sudo service postgresql start || exit 1
while ! echo exit | nc localhost 5432; do sleep 10; done
cd ~/fhirbase || exit 1
source ~/.nvm/nvm.sh && nvm use 6.2.0 || exit 1
for schema in $schemas; do
if [ "$install_fhirbase" = 1 ] ; then
FB_SCHEMA=$schema ./build-commit.sh --rebuild || exit 1
{ echo "CREATE SCHEMA IF NOT EXISTS $schema; SET search_path TO $schema;" \
&& cat build/latest/build.sql ; } \
| psql fhirbase
[[ ${PIPESTATUS[0]} -ne 0 || ${PIPESTATUS[1]} -ne 0 ]] && exit 1
fi
FB_SCHEMA=$schema npm run test || exit 1
done