File tree Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Expand file tree Collapse file tree 1 file changed +47
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ set -euxo pipefail
4+
5+ build () {
6+ pushd ../
7+ GOOS=linux CGO_ENABLED=0 go build -o tests/ ./cmd/icingadb
8+ popd
9+ go test -o icingadb-test -c .
10+ }
11+
12+ cleanup () {
13+ docker rm -f $( docker ps -q --filter=" name=icinga-testing-*" ) > /dev/null 2>&1 || true
14+ docker network prune -f --filter=" label=icinga=testing"
15+ }
16+
17+ raiseLimits () {
18+ if [ " $( ulimit -n) " -lt " 1024" ]; then
19+ ulimit -n 1024
20+ fi
21+ }
22+
23+ run () {
24+ export ICINGA_TESTING_ICINGADB_BINARY=icingadb
25+ export ICINGA_TESTING_ICINGADB_SCHEMA=../schema/mysql/schema.sql
26+ if [ " $( uname -s) " = " Darwin" ]; then
27+ export TMPDIR=" /private${TMPDIR} "
28+ fi
29+
30+ ./icingadb-test -icingatesting.debuglog debug.log -test.v
31+ }
32+
33+ # Note that we do not trap ERR as it can be useful to check running containers.
34+ trap ' cleanup' INT TERM
35+ trap ' catch $? $LINENO' EXIT
36+ catch () {
37+ if [ " $1 " -eq " 0" ]; then
38+ cleanup
39+ fi
40+ }
41+
42+ cd " ${BASH_SOURCE%/* } "
43+
44+ cleanup
45+ raiseLimits
46+ build
47+ run
You can’t perform that action at this time.
0 commit comments