-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.sh
executable file
·91 lines (75 loc) · 2.03 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash
set -e
root_dir="$(git rev-parse --show-toplevel)"
source "${root_dir}/scripts/dev_db_creds.sh"
skipUI=false
skipIntegration=false
skipBackend=false
while test $# -gt 0; do
case "$1" in
--skip-ui)
skipUI=true
;;
--skip-backend)
skipBackend=true
;;
--skip-integration)
skipIntegration=true
;;
--*)
echo "bad option $1"
exit 0
;;
*)
echo "bad argument $1"
exit 0
;;
esac
shift
done
if [[ "${skipUI}" = "false" ]]; then
pushd "${root_dir}/ui"
echo "Running 'yarn test'"
yarn test --watchAll=false
echo "Compiling the UI"
yarn build
popd
fi
if [[ "${skipIntegration}" = "false" ]]; then
exit_code=1
set +e
echo "Checking to see if mysql is available"
mysqladmin -u "${DATABASE_USERNAME}" \
-p"${DATABASE_PASSWORD}" \
-h "${DATABASE_HOST}" \
-P "${DATABASE_PORT}" ping > /dev/null 2>&1
exit_code=$?
set -e
if [[ "${exit_code}" -eq 1 ]]; then
echo "mysql is not running, starting it for testing"
"${root_dir}/scripts/start_database.sh" > /dev/null 2>&1
function finish {
"${root_dir}/scripts/stop_database.sh" > /dev/null 2>&1
}
trap finish EXIT
else
"${root_dir}/scripts/clean_database.sh"
fi
"${root_dir}/scripts/migrate_database.sh"
fi
echo "Setting required env vars"
export REDIS_URL="redis://:@127.0.0.1:6379"
export ACCESS_SECRET="access_secret"
export REFRESH_SECRET="refresh_secret"
if [[ "${skipBackend}" = "false" ]]; then
echo "Running ginkgo for everything except integration"
pushd ${root_dir}
ginkgo -r -p -skip-package pkg/integration --output-interceptor-mode=none
popd
fi
if [[ "${skipIntegration}" = "false" ]]; then
echo "Running ginkgo for integration"
pushd ${root_dir}
ginkgo -r pkg/integration --output-interceptor-mode=none
popd
fi