-
Notifications
You must be signed in to change notification settings - Fork 171
/
gcpproxy-e2e.sh
executable file
·120 lines (105 loc) · 4.11 KB
/
gcpproxy-e2e.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
# Copyright 2019 Google LLC
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Fail on any error.
set -eo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
PROJECT_ID="api_proxy_e2e_test"
gcloud config set core/project cloudesf-testing
cd "${ROOT}"
. ${ROOT}/tests/e2e/scripts/prow-utilities.sh || { echo 'Cannot load Bash utilities';
exit 1; }
function runE2E() {
local OPTIND OPTARG arg
while getopts :f:p:c:g:m:R:St: arg; do
case ${arg} in
f) local backend_platform="${OPTARG}" ;;
p) local platform="${OPTARG}" ;;
c) local coupling_option="$(echo ${OPTARG} | tr '[A-Z]' '[a-z]')" ;;
g) local backend="${OPTARG}" ;;
m) local apiproxy_image="${OPTARG}" ;;
R) local rollout_strategy="${OPTARG}" ;;
S) local using_sa_cred='true' ;;
t) local test_type="$(echo ${OPTARG} | tr '[A-Z]' '[a-z]')" ;;
esac
done
local apiproxy_service=$(get_apiproxy_service "${backend}" "${using_sa_cred}")
local unique_id=$(get_unique_id "gke-${test_type}-${backend}")
if [ "${platform}" == "anthos-cloud-run" ]
then
local platform_deploy_script="${ROOT}/tests/e2e/scripts/cloud-run/deploy.sh"
else
local platform_deploy_script="${ROOT}/tests/e2e/scripts/${platform}/deploy.sh"
fi
echo "Deploying on platform ${platform}"
${platform_deploy_script} \
-a "${apiproxy_service}" \
-t "${test_type}" \
-p "${platform}" \
-g "${backend}" \
-m "${apiproxy_image}" \
-R "${rollout_strategy}" \
-i "${unique_id}" \
-B "${BUCKET}" \
-l "${DURATION_IN_HOUR}" \
-f "${backend_platform}" \
-S "${using_sa_cred}"
}
if [ ! -d "$GOPATH/bin" ]; then
mkdir $GOPATH/bin
fi
if [ ! -d "bin" ]; then
mkdir bin
fi
export GO111MODULE=on
# Wait for image build and push.
wait_apiproxy_image || { echo "Failed in waiting images;";
exit 1; }
download_client_binaries || { echo "Failed in downloading client binaries;";
exit 1; }
echo '======================================================='
echo '===================== e2e test ====================='
echo '======================================================='
case ${TEST_CASE} in
"tight-http-bookstore-managed")
runE2E -p "gke" -c "tight" -t "http" -g "bookstore" -R "managed" -m "$(get_proxy_image_name_with_sha)"
;;
"tight-http-bookstore-managed-using-sa-cred")
runE2E -p "gke" -c "tight" -t "http" -g "bookstore" -R "managed" -S -m "$(get_proxy_image_name_with_sha)"
;;
"tight-grpc-echo-managed")
runE2E -p "gke" -c "tight" -t "grpc" -g "echo" -R "managed" -m "$(get_proxy_image_name_with_sha)"
;;
"tight-grpc-interop-managed")
runE2E -p "gke" -c "tight" -t "grpc" -g "interop" -R "managed" -m "$(get_proxy_image_name_with_sha)"
;;
"cloud-run-cloud-run-http-bookstore")
runE2E -p "cloud-run" -f "cloud-run" -t "http" -g "bookstore" -R "managed" -m "$(get_serverless_image_name_with_sha)"
;;
"cloud-run-cloud-run-grpc-echo")
runE2E -p "cloud-run" -f "cloud-run" -t "grpc" -g "echo" -R "managed" -m "$(get_serverless_image_name_with_sha)"
;;
"cloud-run-cloud-function-http-bookstore")
runE2E -p "cloud-run" -f "cloud-function" -t "http" -g "bookstore" -R "managed" -m "$(get_serverless_image_name_with_sha)"
;;
"cloud-run-app-engine-http-bookstore")
runE2E -p "cloud-run" -f "app-engine" -t "http" -g "bookstore" -R "managed" -m "$(get_serverless_image_name_with_sha)"
;;
"anthos-cloud-run-anthos-cloud-run-http-bookstore")
runE2E -p "anthos-cloud-run" -f "anthos-cloud-run" -t "http" -g "bookstore" -R "managed" -m "$(get_serverless_image_name_with_sha)"
;;
*)
echo "No such test case ${TEST_CASE}"
exit 1
;;
esac