-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.sh
executable file
·80 lines (65 loc) · 2.18 KB
/
test.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
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
TEST_ROOT="$(dirname "${BASH_SOURCE[0]}")"
source "$(dirname "${BASH_SOURCE[0]}")/helper.sh"
single_versions=(
v1.30.0
v1.23.17
# Since ubuntu in github action uses cgroup v2 by default
# and can't install clusters below 1.19, skip them for now!
# v1.18.20
# v1.14.10
)
multiple_versions=(
v1.30.0
# Since ubuntu in github action uses cgroup v2 by default
# and can't install clusters below 1.19, skip them for now!
# v1.14.10
)
function main() {
local name
local env_name
local failed=()
echo "::group::check dependencies"
check_dependencies docker kind kubectl
echo "::endgroup::"
echo "::group::Build image"
build_image
echo "::endgroup::"
for version in "${single_versions[@]}"; do
for file in "${TEST_ROOT}"/cases/*.test.sh; do
[[ -e "${file}" ]] || continue
name="${file##*/}"
name="${name%.test.sh}"
echo "::group::Running [single cluster] test ${name} on ${version}"
if ! "${TEST_ROOT}/environments/single.env.sh" "${file}" "${version}"; then
failed+=("'${name} on ${version}'")
mv "${TEST_ROOT}/logs" "${TEST_ROOT}/logs-${name}-single-cluster-${version}"
else
# Clean up logs
rm -rf "${TEST_ROOT}/logs"
fi
echo "::endgroup::"
done
done
for version in "${multi_versions[@]}"; do
for file in "${TEST_ROOT}"/cases/*.test.sh; do
[[ -e "${file}" ]] || continue
name="${file##*/}"
name="${name%.test.sh}"
echo "::group::Running [multiple clusters] test ${name} on ${version}"
if ! "${TEST_ROOT}/environments/multiple.env.sh" "${file}" "${version}"; then
failed+=("'${name} on ${version}'")
mv "${TEST_ROOT}/logs" "${TEST_ROOT}/logs-${name}-multiple-clusters-${version}"
else
# Clean up logs
rm -rf "${TEST_ROOT}/logs"
fi
echo "::endgroup::"
done
done
if [[ "${#failed[@]}" -gt 0 ]]; then
echo "Failed tests: ${failed[*]}"
exit 1
fi
}
main