forked from TykTechnologies/tyk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathci-tests.sh
executable file
·47 lines (35 loc) · 1.13 KB
/
ci-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
#!/bin/bash
TEST_TIMEOUT=15m
# print a command and execute it
show() {
echo "$@" >&2
eval "$@"
}
fatal() {
echo "$@" >&2
exit 1
}
PKGS="$(go list ./...)"
export PKG_PATH=${GOPATH}/src/github.com/TykTechnologies/tyk
# build Go-plugin used in tests
go build -o ./test/goplugins/goplugins.so -buildmode=plugin ./test/goplugins || fatal "building Go-plugin failed"
for pkg in ${PKGS}; do
tags=""
# TODO: Remove skipRace variable after solving race conditions in tests.
skipRace=false
if [[ ${pkg} == *"grpc" ]]; then
skipRace=true
elif [[ ${pkg} == *"goplugin" ]]; then
skipRace=true
tags="-tags 'goplugin'"
fi
race="-race"
if [[ ${skipRace} = true ]]; then
race=""
fi
show go test ${race} -timeout ${TEST_TIMEOUT} -v -coverprofile=test.cov ${pkg} ${tags} || fatal "Test Failed"
show go vet ${tags} ${pkg} || fatal "go vet errored"
done
# run rpc tests separately
rpc_tests='SyncAPISpecsRPC|OrgSessionWithRPCDown'
show go test -timeout ${TEST_TIMEOUT} -v -coverprofile=test.cov github.com/TykTechnologies/tyk/gateway -p 1 -run '"'${rpc_tests}'"' || fatal "Test Failed"