forked from swirlai/swirl-search
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre-checkin-tests.sh
executable file
·53 lines (42 loc) · 1.14 KB
/
pre-checkin-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
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#
# Usage:
# pre-checkin-tests.sh [<options>]
#
# Run unit tests and smoke tests
# Options:
# -h, --help Display this help message
# Parse command-line options
while [[ "$#" -gt 0 ]]; do
case $1 in
-h|--help) print_help=true ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done
# Print help message if requested
if [ "$print_help" = true ]; then
sed -n '/^# Usage:/,/^$/p' "$0"
exit
fi
PROG=`basename $0`
set -e
# Unit tests
echo $PROG "running pytest unit tests"
pytest
echo $PROG "unit tests succeeded"
## Smoke tests
export ALLOWED_HOSTS=localhost,host.docker.internal
echo $PROG "running smoke tests"
if [ ! -e ".swirl" ]; then
echo $PROG "starting Swirl"
python swirl.py start
fi
# make sure we always have the latest
docker pull swirlai/swirl-search:latest-smoke-test
docker run -e SWIRL_TEST_HOST=host.docker.internal --net=host -t swirlai/swirl-search:latest-smoke-test sh -c "behave **/docker_container/*.feature --tags=docker_api_smoke"
echo $PROG "smoke tests succeeded"
if [ -e ".swirl" ]; then
echo $PROG "stopping Swirl"
python swirl.py stop
fi