-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.sh
executable file
·70 lines (57 loc) · 1.08 KB
/
run.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
#!/bin/bash
function run_test() {
local code=0
pushd $1
TEST_NAME=`basename \`pwd\``
COMPOSE_COMMAND="docker compose -p $TEST_NAME -f ../../node_config/docker-compose.config.yml -f docker-compose.yml"
go build ./...
if [ $? -ne 0 ];
then
echo "Failed to build integration test: $TEST_NAME"
code=1
popd
return $code
fi
$COMPOSE_COMMAND up -d
if [ $? -ne 0 ];
then
echo "Failed to start cluster: $TEST_NAME"
code=1
$COMPOSE_COMMAND logs
$COMPOSE_COMMAND down
popd
return $code
fi
go clean -testcache
go test -timeout 30m -v ./...
if [ $? -ne 0 ];
then
echo "Failed during integration test: $TEST_NAME"
$COMPOSE_COMMAND logs
code=1
fi
$COMPOSE_COMMAND down -v
popd
return $code
}
function run_tests() {
local code=0
for dir in tests/*/ ; do
run_test $dir
if [ $? -ne 0 ];
then
code=1
fi
done
return $code
}
if [ $# -eq 0 ];
then
run_tests
else
for test in "$@"
do
run_test tests/$test
done
fi
exit $?