forked from RedHatInsights/insights-operator-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·56 lines (45 loc) · 1.05 KB
/
test.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
if [ -z "$CONTROLLER_ENV" ]; then
export CONTROLLER_ENV=test
fi
go build -race
if [ $? -eq 0 ]
then
echo "Service build ok"
else
echo "Build failed"
exit 1
fi
go build -o rest-api-tests tests/rest_api_tests.go
if [ $? -eq 0 ]
then
echo "REST API tests build ok"
else
echo "Build failed"
exit 1
fi
echo "Creating test database"
rm -f test.db
./local_storage/create_test_database_sqlite.sh
echo "Done"
echo "Starting service"
./insights-operator-controller --storage test.db &
PID=$(echo $!)
if [ $? -eq 0 ]
then
echo "Service started, PID=$PID"
sleep 2
echo -e "------------------------------------------------------------------------------------------------"
./rest-api-tests
EXIT_VALUE=$?
echo -e "------------------------------------------------------------------------------------------------"
kill $PID
if [ $? -eq 0 ]
then
echo "Service killed, PID=$PID"
else
echo "Fatal, can not kill a service process"
fi
else
echo "Fatal, can not start service"
fi
exit $EXIT_VALUE