-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun-tests.sh
executable file
·67 lines (48 loc) · 1.11 KB
/
run-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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/bash
FORCE=0
KUBECTL=${KUBECTL:-kubectl}
usage() {
echo "${0##*/}: usage: ${0##*/} [--force] [...bats options...]"
}
while :; do
case "$1" in
--force|-f)
FORCE=1
shift
;;
--help|-h)
usage
exit 0
;;
--) shift
break
;;
-*) echo "ERROR: invalid option: $1" >&2
usage >&2
exit 2
;;
*) break
;;
esac
done
if ! [ -x test/lib/bats/bin/bats ]; then
cat <<-EOF >&2
It looks like 'bats' is missing! You may need to initialize
submodules in this repository. Try running:
git submodule update --init
EOF
exit 1
fi
if ! (( FORCE )) && ! ${KUBECTL} get nodes > /dev/null 2>&1; then
cat <<-EOF >&2
${KUBECTL} was unable to successfully run the "get nodes" command.
This suggests that either you are not authenticated to a Kubernetes
cluster or that you do not have appropriate privileges.
You must be authenticated to an OpenShift or Kubernetes cluster with
cluster-admin privileges in order for these tests to run.
If you would like to run the tests anyway, re-run this script with the
"--force" option.
EOF
exit 1
fi
./test/lib/bats/bin/bats "${@:-test}"