-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathsetup-test-servers-env.sh
executable file
·74 lines (65 loc) · 1.58 KB
/
setup-test-servers-env.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
#
# This script starts all the test servers which are present as Docker images (see
# docker-tools/ directory for more details), sets up some environment variables, and
# starts a sub shell.
#
# When the sub shell exits, all the docker containers which have been started are stopped.
#
dir=`dirname $0`
envfile=test-servers-env
function control_servers {
op=$1
case $op in
start)
;;
stop)
;;
*)
echo "Unknown operation."
exit 1
;;
esac
for srv in Firebird Ldap MySQL Oracle PostgreSQL Web
do
echo -n "$srv..."
$dir/docker-tools/docker-tools.sh $op $srv > /dev/null 2>&1
if [ $? != 0 ]
then
echo "Failure!"
else
echo "Ok!"
uppername=${srv^^}
if [ $srv == "Oracle" ]
then
dbname="xe"
else
dbname="gda"
if [ $op == "start" ]
then
echo "export ${uppername}_DBCREATE_PARAMS=\"HOST=localhost;ADM_LOGIN=gdauser;ADM_PASSWORD=gdauser\"" >> $envfile
else
echo "export -n ${uppername}_DBCREATE_PARAMS=" >> $envfile
fi
fi
if [ $op == "start" ]
then
echo "export ${uppername}_CNC_PARAMS=\"HOST=localhost;USERNAME=gdauser;PASSWORD=gdauser;DB_NAME=$dbname\"" >> $envfile
else
echo "export -n ${uppername}_CNC_PARAMS=" >> $envfile
fi
fi
done
}
echo "Starting tests servers..."
rm -f $envfile
control_servers start
. $envfile
echo "Now entering sub shell. Closing this sub shell will stop all the test servers."
echo "Environment variables are in the '$envfile' file"
/bin/bash
echo "Stopping tests servers..."
rm -f $envfile
control_servers stop
. $envfile
rm -f $envfile