From cd69bb27071048e180d162466cb7eb124b42af0a Mon Sep 17 00:00:00 2001 From: lyuxuan Date: Thu, 21 Jun 2018 13:09:46 -0700 Subject: [PATCH] testing: run test in simulated appengine environment (#2145) --- .travis.yml | 5 +++++ Makefile | 7 +++++++ install_gae.sh | 6 ++++++ 3 files changed, 18 insertions(+) create mode 100755 install_gae.sh diff --git a/.travis.yml b/.travis.yml index 3c2621ab..d5fc4760 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,14 +11,19 @@ matrix: include: - go: 1.10.x env: RUN386=1 + - go: 1.9.x + env: GAE=1 + go_import_path: google.golang.org/grpc before_install: - if [[ -n "$RUN386" ]]; then export GOARCH=386; fi - if [[ "$TRAVIS_GO_VERSION" = 1.10* && "$GOARCH" != "386" ]]; then ./vet.sh -install || exit 1; fi + - if [[ "$GAE" = 1 ]]; then source ./install_gae.sh || exit 1; fi script: - if [[ "$TRAVIS_GO_VERSION" = 1.10* && "$GOARCH" != "386" ]]; then ./vet.sh || exit 1; fi + - if [[ "$GAE" = 1 ]]; then make testappengine || exit 1; exit 0; fi - make test || exit 1 - if [[ "$GOARCH" != "386" ]]; then make testrace; fi diff --git a/Makefile b/Makefile index 6f393a80..50454530 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,9 @@ updatedeps: testdeps: go get -d -v -t google.golang.org/grpc/... +testgaedeps: + goapp get -d -v -t -tags 'appengine appenginevm' google.golang.org/grpc/... + updatetestdeps: go get -d -v -t -u -f google.golang.org/grpc/... @@ -31,6 +34,9 @@ test: testdeps testrace: testdeps go test -race -cpu 1,4 -timeout 7m google.golang.org/grpc/... +testappengine: testgaedeps + goapp test -cpu 1,4 -timeout 5m google.golang.org/grpc/... + clean: go clean -i google.golang.org/grpc/... @@ -39,6 +45,7 @@ clean: deps \ updatedeps \ testdeps \ + testgaedeps \ updatetestdeps \ build \ proto \ diff --git a/install_gae.sh b/install_gae.sh new file mode 100755 index 00000000..d4236f3b --- /dev/null +++ b/install_gae.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +TMP=$(mktemp -d /tmp/sdk.XXX) \ +&& curl -o $TMP.zip "https://storage.googleapis.com/appengine-sdks/featured/go_appengine_sdk_linux_amd64-1.9.64.zip" \ +&& unzip -q $TMP.zip -d $TMP \ +&& export PATH="$PATH:$TMP/go_appengine"