Skip to content

Commit

Permalink
Fix Jenkins performance tests. (#189)
Browse files Browse the repository at this point in the history
* Fix Jenkins performance tests.

* Address Wayne's comment.

* Minor fix.

* Fix a couple of errors.

1. Fix permission error while executing "gcloud service-management
configs describe" in linux-start-local-test.
2. Fix "audience not allowed" error in linux-test-vm-echo.

* Use json format for service configuration.
  • Loading branch information
liminw authored May 26, 2017
1 parent 6b0bd13 commit 726b66b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
14 changes: 6 additions & 8 deletions script/linux-start-local-test
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,12 @@ cp -f "${NGINX_BAZEL_BIN}" "${NGINX}" \
|| error_exit 'Error copying nginx-esp, aborting.'

echo 'Creating service.json'
sed "s|\${MY_PROJECT_ID}|esp-load-test|g" "${ROOT}/test/echo/swagger.json" \
> "${ROOT}/test/echo/gce-vm/swagger.json"
${GCLOUD} beta service-management convert-config \
${ROOT}/test/echo/gce-vm/swagger.json > "${ROOT}/test/echo/gce-vm/service.json"
# Hack to point to the right service control as convert-config is not consistent
sed_i "s|endpoints-servicecontrol.sandbox|servicecontrol|g" \
"${ROOT}/test/echo/gce-vm/service.json"
# Hard code Config_ID.
SERVICE_NAME='echo-dot-esp-load-test.appspot.com'
CONFIG_ID='2017-05-26r0'
activate_service_account "esp-load-test"
${GCLOUD} service-management configs describe --service ${SERVICE_NAME} ${CONFIG_ID} \
--project=esp-load-test --format=json > "${ROOT}/test/echo/gce-vm/service.json"

cat ${ROOT}/test/echo/gce-vm/service.json
echo 'Starting Endpoints Runtime.'
Expand All @@ -120,7 +119,6 @@ NGINX_ARGS=(-p "${PREFIX}" -c "${NGINX_CONFIG}" -g "pid ${PREFIX}/.nginx.pid;")
"${NGINX}" "${NGINX_ARGS[@]}"

echo 'Constructing test data.'
SERVICE_NAME='echo-esp-load-test.appspot.com'
JWT_TOKEN="$("${ROOT}/client/custom/gen-auth-token.sh" \
-s "${ROOT}/test/echo/esp-echo-client-secret-jwk.json" \
-a "${SERVICE_NAME}")"
Expand Down
8 changes: 4 additions & 4 deletions script/linux-test-vm-echo
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ echo "GAE_VERSION: ${GAE_VERSION}"
APP_DIR="${ROOT}/test/echo"

echo 'Replaces environment.'
sed -i "s|\${MY_PROJECT_ID}|${PROJECT_ID}|g" "${APP_DIR}/swagger.json"
sed -i "s|\${VERSION}|${APP_VERSION}|g" "${APP_DIR}/echo.js"
sed -i "s|\${MY_PROJECT_ID}|${PROJECT_ID}|g" "${APP_DIR}/app_esp.yaml"
sed -i "s|\${IMAGE_NAME}|${IMAGE_NAME}|g" "${APP_DIR}/app_esp.yaml"

trap cleanup EXIT
Expand Down Expand Up @@ -115,7 +115,7 @@ EXPECTED_RESPONSE=".*Method doesn't allow unregistered callers.*STATUS_CODE:401"
[[ "$(curl -w "STATUS_CODE:%{http_code}" "${HOST}/echo")" =~ ${EXPECTED_RESPONSE} ]] \
|| error_exit "ERROR: Endpoints is disabled on ${HOST}"

SERVICE_NAME="echo-${PROJECT_ID}.appspot.com"
SERVICE_NAME="echo-dot-${PROJECT_ID}.appspot.com"
JWT_TOKEN="$("${ROOT}/client/custom/gen-auth-token.sh" \
-s "${ROOT}/test/echo/esp-echo-client-secret-jwk.json" \
-a "${SERVICE_NAME}")"
Expand Down Expand Up @@ -146,8 +146,8 @@ if [[ -n "${BUCKET}" ]] ; then
echo "Uploading NGINX server logs."
"${ROOT}/script/linux-gae-instance" \
-v "${GAE_VERSION}" -p "${PROJECT_ID}" -d "${LOG_DIRECTORY}" nginx-logs \
&& gsutil -h 'Content-Type:text/plain' -m cp -r "${LOG_DIRECTORY}" "${BUCKET}/${GAE_VERSION}" \
|| error_exit 'Cannot upload NGINX logs.'
&& gsutil -h 'Content-Type:text/plain' -m cp -r "${LOG_DIRECTORY}" "${BUCKET}/${GAE_VERSION}"

fi

exit ${RESULT}
12 changes: 7 additions & 5 deletions test/echo/app_esp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,26 @@
# SUCH DAMAGE.

runtime: nodejs
vm: true
env: flex
api_version: 1
service: default

resources:
cpu: 4
memory_gb: 1.3
memory_gb: 5.2
disk_size_gb: 10

manual_scaling:
instances: 1

# Hard code the service name and config_id
endpoints_api_service:
name: "echo-dot-${MY_PROJECT_ID}.appspot.com"
config_id: "2017-05-26r0"

beta_settings:
allow_ssh: true
gae_nginx_proxy_image_name: ${IMAGE_NAME}
service_account_scopes: compute,devstorage.full_control,appengine.apis,servicecontrol
use_endpoints_api_management: true
endpoints_swagger_spec_file: swagger.json

skip_files:
- ^(.*/)?#.*#$
Expand Down

0 comments on commit 726b66b

Please sign in to comment.