forked from linkerd/linkerd2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-clouds
executable file
·73 lines (63 loc) · 1.99 KB
/
test-clouds
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
#!/usr/bin/env bash
#
# Run integration tests on 4 cloud providers:
# - Amazon (EKS)
# - DigitalOcean (DO)
# - Google (GKE)
# - Microsoft (AKS)
#
# This script assumes you have a working Kubernetes cluster set up on each Cloud
# provider, and that Kubernetes contexts are configured via the environment
# variables $AKS $DO $EKS $GKE.
#
# For example:
# export AKS=my-aks-cluster
# export DO=do-nyc1-my-cluster
# export EKS=arn:aws:eks:us-east-1:123456789012:cluster/my-cluster
# export GKE=gke_my-project_us-east1-b_my-cluster
#
# For more information on configuring access to multiple clusters, see:
# https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/#define-clusters-users-and-contexts
set -e
# TODO: share this with test-run
check_linkerd_binary() {
printf 'Checking the linkerd binary...'
case "$linkerd_path" in
/*)
;;
*)
printf '\n[%s] is not an absolute path\n' "$linkerd_path"
exit 1
;;
esac
if [ ! -x "$linkerd_path" ]; then
printf '\n[%s] does not exist or is not executable\n' "$linkerd_path"
exit 1
fi
exit_code=0
"$linkerd_path" version --client > /dev/null 2>&1 || exit_code=$?
if [ $exit_code -ne 0 ]; then
printf '\nFailed to run linkerd version command\n'
exit $exit_code
fi
printf '[ok]\n'
}
if [ "$#" -ne 1 ]; then
echo "usage: ${0##*/} /path/to/linkerd" >&2
exit 64
fi
for CLUSTER in 'AKS' 'DO' 'EKS' 'GKE'; do
if [ -z "${!CLUSTER}" ]; then
echo "\$$CLUSTER not set" >&2
exit 64
fi
done
linkerd_path=$1
check_linkerd_binary
printf '\nKicking off tests for:\n- %s\n- %s\n- %s\n- %s\n\n' "$AKS" "$DO" "$EKS" "$GKE"
trap 'trap - SIGTERM && kill -- -$$' SIGINT SIGTERM EXIT
for CLUSTER in $AKS $DO $EKS $GKE; do
bin/test-run "$linkerd_path" l5d-integration-cloud "$CLUSTER" | while IFS= read -r line; do printf '[%s] %s\n' "$CLUSTER" "$line"; done &
done
wait
# TODO propagate error code