Skip to content

Commit

Permalink
Added gke e2e test for auto service config rollouts (#241)
Browse files Browse the repository at this point in the history
* Added gke e2e test for auto service config rollouts

* Increased the espcli version

* Fixed missing test configs

* Renamed test branch

* Fixed scipt error

* Fixed scipt error

* Fixed scipt error

* Fixed scipt error
  • Loading branch information
mangchiandjjoe authored Aug 17, 2017
1 parent 4dc2d48 commit eff61e1
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 17 deletions.
22 changes: 14 additions & 8 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -290,27 +290,32 @@ def e2eTest(nodeLabel) {
}],
['gke-tight-http', {
node(nodeLabel) {
e2eGKE('tight', 'http')
e2eGKE('tight', 'http', 'fixed')
}
}],
['gke-tight-http-managed', {
node(nodeLabel) {
e2eGKE('tight', 'http', 'managed')
}
}],
['gke-loose-http', {
node(nodeLabel) {
e2eGKE('loose', 'http')
e2eGKE('loose', 'http', 'fixed')
}
}],
['gke-custom-http', {
node(nodeLabel) {
e2eGKE('custom', 'http')
e2eGKE('custom', 'http', 'fixed')
}
}],
['gke-tight-https', {
node(nodeLabel) {
e2eGKE('tight', 'https')
e2eGKE('tight', 'https', 'fixed')
}
}],
['gke-loose-https', {
node(nodeLabel) {
e2eGKE('loose', 'https')
e2eGKE('loose', 'https', 'fixed')
}
}],
['flex', {
Expand All @@ -320,12 +325,12 @@ def e2eTest(nodeLabel) {
}],
['gke-tight-http2-echo', {
node(nodeLabel) {
e2eGKE('tight', 'http2', 'echo')
e2eGKE('tight', 'http2', 'fixed', 'echo')
}
}],
['gke-tight-http2-interop', {
node(nodeLabel) {
e2eGKE('tight', 'http2', 'interop')
e2eGKE('tight', 'http2', 'fixed', 'interop')
}
}],
]
Expand Down Expand Up @@ -561,7 +566,7 @@ def e2eCommonOptions(testId, prefix = '') {
// 'bookstore': HTTP bookstore
// 'echo': run grpc echo pass_through and transcoding tests
// 'interop': run grpc interop pass_through test.
def e2eGKE(coupling, proto, backend = 'bookstore') {
def e2eGKE(coupling, proto, rollout_strategy, backend = 'bookstore') {
setupNode()
fastUnstash('tools')
def uniqueID = getUniqueID("gke-${coupling}-${proto}-${backend}", true)
Expand All @@ -575,6 +580,7 @@ def e2eGKE(coupling, proto, backend = 'bookstore') {
" -a ${uniqueID}.${PROJECT_ID}.appspot.com" +
" -B ${BUCKET} " +
" -l " + getParam('DURATION_HOUR', 0) +
" -R ${rollout_strategy} " +
(getParam('SKIP_CLEANUP', false) ? " -s" : ""))
}

Expand Down
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#
# A Bazel (http://bazel.io) workspace for the Google Cloud Endpoints runtime.

ESP_TOOL = "4d1f6506021e241daac5c2bc28aca2f881aa445f"
ESP_TOOL = "5725cbed9076bda107c29f555dc0040cdad967be"

git_repository(
name = "nginx",
Expand Down
14 changes: 13 additions & 1 deletion script/e2e-kube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ ESP_APP="esp"
# Fetch CLI tool if it is not available
if [[ ! -f $CLI ]]; then
OSNAME=`uname | tr "[:upper:]" "[:lower:]"`
URL="https://storage.googleapis.com/endpoints-release/v1.0.3/bin/${OSNAME}/amd64/espcli"
URL="https://storage.googleapis.com/endpoints-release/v1.0.4/bin/${OSNAME}/amd64/espcli"
curl -o ${CLI} ${URL}
chmod +x ${CLI}
fi
Expand Down Expand Up @@ -99,6 +99,9 @@ case "${TEST_TYPE}" in
* ) e2e_usage "Invalid test type";;
esac

# set rollout strategy
ARGS="$ARGS --rollout_strategy ${ESP_ROLLOUT_STRATEGY}"

trap cleanup EXIT

# Testing protocol
Expand All @@ -120,6 +123,15 @@ run_nonfatal long_running_test \
"${TEST_ID}" \
"${UNIQUE_ID}"

# Deploy new config and check new rollout on /endpoints_status
if [[ ("${ESP_ROLLOUT_STRATEGY}" == "managed") && ("${BACKEND}" == "bookstore") ]] ; then
# Deploy new service config
create_service "${ESP_SERVICE}" "${SERVICE_IDL}"

run retry -n 10 wait_for_service_config_rollouts_update "gke" "${HOST}:8090/endpoints_status" "$ESP_SERVICE_VERSION 100" \
|| error_exit 'Rollouts update was failed'
fi

STATUS=${?}
run ${CLI} logs bookstore --namespace ${NAMESPACE} --project ${PROJECT_ID} --active=false \
| tee ${LOG_DIR}/error.log
Expand Down
22 changes: 17 additions & 5 deletions script/jenkins-utilities
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,18 @@ function create_service() {

# Set current rolloutId to ESP_CURRENT_ROLLOUTS variable
function set_esp_remote_rollout_info_env() {
ESP_CURRENT_ROLLOUTS=`gcloud compute ssh "${INSTANCE_NAME}" \
--command='curl http://localhost:8090/endpoints_status' | python -c '
local target_env=${1}
local endpoint_status_url=${2}
local endpoint_status=""

case "${target_env}" in
'gce' )
endpoint_status=`gcloud compute ssh "${INSTANCE_NAME}" --command="curl \"$endpoint_status_url\""`;;
'gke' )
endpoint_status=`curl "$endpoint_status_url"`;;
esac

ESP_CURRENT_ROLLOUTS=`echo ${endpoint_status} | python -c '
import json
import sys
try:
Expand Down Expand Up @@ -190,15 +200,17 @@ except:
}

function wait_for_service_config_rollouts_update() {
local target_version=${1}
local target_env=${1}
local endpoint_status_url=${2}
local target_rollouts=${3}

ESP_CURRENT_ROLLOUTS=""
# set_esp_remote_rollout_info_env will set ESP_CURRENT_ROLLOUTS
retry -n 10 -t 90 set_esp_remote_rollout_info_env \
retry -n 10 -t 90 set_esp_remote_rollout_info_env "$target_env" "$endpoint_status_url" \
|| error_exit 'Could not fetch the remote rollouts'
echo "Instance rollout information=$ESP_CURRENT_ROLLOUTS"

if [ "$target_version" == "$ESP_CURRENT_ROLLOUTS" ]; then
if [ "$target_rollouts" == "$ESP_CURRENT_ROLLOUTS" ]; then
return 0
else
return 1
Expand Down
4 changes: 2 additions & 2 deletions test/bookstore/gce/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ run retry -n 3 gcloud compute instances create "${INSTANCE_NAME}" \
run retry -n 3 get_host_ip "${INSTANCE_NAME}"
HOST="http://${HOST_INTERNAL_IP}:8080"

run retry -n 10 wait_for_service_config_rollouts_update "$ESP_SERVICE_VERSION 100" \
run retry -n 10 wait_for_service_config_rollouts_update "gce" "http://localhost:8090/endpoints_status" "$ESP_SERVICE_VERSION 100" \
|| error_exit 'Rollouts update was failed'

if [ "${ESP_ROLLOUT_STRATEGY}" == "managed" ]; then
# Deploy new service config
# create_service will set ESP_SERVICE_VERSION to the deployed new config id
create_service "${ESP_SERVICE}" swagger.json

run retry -n 10 wait_for_service_config_rollouts_update "$ESP_SERVICE_VERSION 100" \
run retry -n 10 wait_for_service_config_rollouts_update gce "http://localhost:8090/endpoints_status" "$ESP_SERVICE_VERSION 100" \
|| error_exit 'Rollouts update was failed'
fi

Expand Down

0 comments on commit eff61e1

Please sign in to comment.