-
Notifications
You must be signed in to change notification settings - Fork 28
/
test-runner.sh
executable file
·59 lines (48 loc) · 1.65 KB
/
test-runner.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
#!/usr/bin/env bash
GOPATH="${GOPATH:-~/go}"
PATH=$PATH:$GOPATH/bin
TEST_DIR="./tests"
# Check that ECO_TEST_FEATURES environment variable has been set
if [[ -z "${ECO_TEST_FEATURES}" ]]; then
echo "ECO_TEST_FEATURES environment variable is undefined"
exit 1
fi
# Set feature_dirs to top-level test directory when "all" feature provided
if [[ "${ECO_TEST_FEATURES}" == "all" ]]; then
feature_dirs=${TEST_DIR}
else
# Find all test directories matching provided features
for feature in ${ECO_TEST_FEATURES}; do
discovered_features=$(find $TEST_DIR -depth -name "${feature}" -not -path '*/internal/*' 2> /dev/null)
if [[ ! -z $discovered_features ]]; then
feature_dirs+=" "$discovered_features
else
if [[ "${ECO_VERBOSE_SCRIPT}" == "true" ]]; then
echo "Could not find any feature directories matching ${feature}"
fi
fi
done
if [[ -z "${feature_dirs}" ]]; then
echo "Could not find any feature directories for provided features: ${ECO_TEST_FEATURES}"
exit 1
fi
if [[ "${ECO_VERBOSE_SCRIPT}" == "true" ]]; then
echo "Found feature directories:"
for directory in $feature_dirs; do printf "$directory\n"; done
fi
fi
# Build ginkgo command
cmd="ginkgo -timeout=24h --keep-going --require-suite -r"
if [[ "${ECO_TEST_VERBOSE}" == "true" ]]; then
cmd+=" -vv"
fi
if [[ "${ECO_TEST_TRACE}" == "true" ]]; then
cmd+=" --trace"
fi
if [[ ! -z "${ECO_TEST_LABELS}" ]]; then
cmd+=" --label-filter=\"${ECO_TEST_LABELS}\""
fi
cmd+=" "$feature_dirs" $@" # + user args --xxx=yyy...
# Execute ginkgo command
echo $cmd
eval $cmd