-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestall
executable file
·53 lines (36 loc) · 1.35 KB
/
testall
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
#!/usr/bin/env bash
# Exit on failures and undeclared variables
set -o errexit
set -o pipefail
set -o nounset
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
__root="$(cd "$(dirname "${__dir}")" && pwd)" # <-- change this
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
__base="$(basename ${__file} .sh)"
arg1="${1:-}"
# Number or parallel tests depends now on amount of cores
NUM_CPUS=$(nproc)
# Read config
mysqluser=`grep -A 100 "\[test\]" tests/conf/app.conf | grep mysqluser | sed -e "s/ //g" | cut -c 11-`
mysqlpass=`grep -A 100 "\[test\]" tests/conf/app.conf | grep mysqlpass | sed -e "s/ //g" | cut -c 11-`
mysqlhost=`grep -A 100 "\[test\]" tests/conf/app.conf | grep mysqlhost | sed -e "s/ //g" | cut -c 11-`
mysqldb=`grep -A 100 "\[test\]" tests/conf/app.conf | grep mysqldb | sed -e "s/ //g" | cut -c 9-`
# Perform migrations
rm -f database/migrations/m.go
bee migrate -conn="$mysqluser:$mysqlpass@tcp($mysqlhost:3306)/$mysqldb"
# Backend tests
cd $__dir/tests
go test -parallel $NUM_CPUS
cd $__dir/tests/controllers
go test -parallel $NUM_CPUS
for testDir in `find $__dir/tests/gateway $__dir/tests/lib $__dir/tests/models -type d | grep -v mocks`
do
echo Testing $testDir...
cd $testDir
go test -v -parallel $NUM_CPUS
done
# Frontend tests
cd $__dir/clients/machines
npm test
# Go vet
go tool vet $__dir/controllers/ $__dir/mfi/ $__dir/models/