-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathintegration-test
executable file
·42 lines (33 loc) · 1.2 KB
/
integration-test
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
BASEDIR=$(dirname "$0")
VERINICEDBSERVER=${VERINICEDBSERVER:-127.0.0.1:5432}
VERINICEDB=${VERINICEDB:-verinicedb_test}
VERINICEUSER=${VERINICEUSER:-verinice}
VERINICEPASSWORD=${VERINICEPASSWORD:-verinice}
VERINICEDUMP=${VERINICEDUMP:-$BASEDIR/verinice-rest/src/test/resources/test-dump.sql}
SPRINGDELAY=${SPRINGDELAY:-15}
SKIPINIT=${SKIPINIT:-0}
if [ "$SKIPINIT" != "1" ]; then
# refresh the verinice database
if ! (psql -qd postgres -c "DROP DATABASE IF EXISTS $VERINICEDB" \
&& createdb -O $VERINICEUSER $VERINICEDB \
&& psql -q -U $VERINICEUSER -d $VERINICEDB -f $VERINICEDUMP > /dev/null)
then
echo "Unable to clean up database $VERINICEDB."
exit 1
fi
fi
export spring_datasource_url="jdbc:postgresql://$VERINICEDBSERVER/$VERINICEDB"
export spring_datasource_username="$VERINICEUSER"
export spring_datasource_password="$VERINICEPASSWORD"
export veriniceserver_url_hitroconfig="file://$PWD/verinice-service/src/test/resources/SNCA.xml"
./mvnw -B -pl verinice-rest spring-boot:run &
spring_pid=$!
sleep $SPRINGDELAY
CURDIR=$PWD
cd $BASEDIR/verinice-rest/src/test/python
py.test-3 --junitxml results.xml api_test.py
cd $CURDIR
## clean up
kill $spring_pid
echo "tested with opts $OPTS"