From d0208eff29f13553d5ed767e58865b6db8005d33 Mon Sep 17 00:00:00 2001 From: Franziska Hinkelmann Date: Thu, 7 Jun 2018 04:25:13 -0400 Subject: [PATCH] Fix error message, explicitly delete legacy formatted functions Drive-by fix: delete semistandard from global depenencies Use correct bucket and region variable. --- .kokoro/functions-helloworld.sh | 5 ++++- circle.yml | 2 +- functions/helloworld/package.json | 2 +- functions/helloworld/test/sample.system.storage.test.js | 2 +- functions/helloworld/test/updateFunctions.sh | 4 ++++ 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/.kokoro/functions-helloworld.sh b/.kokoro/functions-helloworld.sh index a711e41e49..71d7df5735 100755 --- a/.kokoro/functions-helloworld.sh +++ b/.kokoro/functions-helloworld.sh @@ -16,7 +16,7 @@ export GCLOUD_PROJECT=nodejs-docs-samples-tests STAGE_BUCKET=$GCLOUD_PROJECT -GCP_REGION=us-central1 +export GCP_REGION=us-central1 export FUNCTIONS_TOPIC=integration-test-functions export FUNCTIONS_BUCKET=$FUNCTIONS_TOPIC export BASE_URL=https://${GCP_REGION}-${GCLOUD_PROJECT}.cloudfunctions.net @@ -26,6 +26,9 @@ cd github/nodejs-docs-samples/functions/helloworld # Install dependencies npm install +# Install global dependencies used in some integration tests. +npm install -g @google-cloud/functions-emulator@1.0.0-beta.4 + # Configure gcloud export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secrets-key.json gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS" diff --git a/circle.yml b/circle.yml index 61df83066f..711e876a32 100644 --- a/circle.yml +++ b/circle.yml @@ -31,7 +31,7 @@ dependencies: override: - echo $KEYFILE > /home/ubuntu/nodejs-docs-samples/key.json - gcloud auth activate-service-account --key-file /home/ubuntu/nodejs-docs-samples/key.json || true - - yarn global add ava nyc codecov semistandard @google-cloud/nodejs-repo-tools@1.4.17 @google-cloud/functions-emulator@1.0.0-beta.4 + - yarn global add ava nyc codecov @google-cloud/nodejs-repo-tools@1.4.17 @google-cloud/functions-emulator@1.0.0-beta.4 - yarn install - yarn run lint - samples test install -l=functions/background diff --git a/functions/helloworld/package.json b/functions/helloworld/package.json index f63bb9ebc1..0f6a6f6b44 100644 --- a/functions/helloworld/package.json +++ b/functions/helloworld/package.json @@ -14,7 +14,7 @@ "scripts": { "lint": "repo-tools lint", "pretest": "npm run lint", - "e2e-test": "export FUNCTIONS_CMD='gcloud functions' && sh test/updateFunctions.sh && BASE_URL=\"https://$GCF_REGION-$GCLOUD_PROJECT.cloudfunctions.net/\" ava -T 20s --verbose test/*.test.js", + "e2e-test": "export FUNCTIONS_CMD='gcloud functions' && sh test/updateFunctions.sh && BASE_URL=\"https://$GCP_REGION-$GCLOUD_PROJECT.cloudfunctions.net/\" ava -T 20s --verbose test/*.test.js", "test": "export FUNCTIONS_CMD='functions-emulator' && sh test/updateFunctions.sh && export BASE_URL=\"http://localhost:8010/$GCLOUD_PROJECT/$GCF_REGION\" && ava -T 20s --verbose -c 1 test/index.test.js test/*unit*test.js test/*integration*test.js", "system-test": "export FUNCTIONS_CMD='functions-emulator' && sh test/updateFunctions.sh && export BASE_URL=\"http://localhost:8010/$GCLOUD_PROJECT/$GCF_REGION\" && ava -T 20s --verbose test/*.test.js" }, diff --git a/functions/helloworld/test/sample.system.storage.test.js b/functions/helloworld/test/sample.system.storage.test.js index 7e6518bf9b..8b8d986774 100644 --- a/functions/helloworld/test/sample.system.storage.test.js +++ b/functions/helloworld/test/sample.system.storage.test.js @@ -25,7 +25,7 @@ const localFileName = `test.txt`; // Use unique GCS filename to avoid conflicts between concurrent test runs const gcsFileName = `test-${uuid.v4()}.txt`; -const bucketName = process.env.BUCKET_NAME; +const bucketName = process.env.FUNCTIONS_BUCKET; const bucket = storage.bucket(bucketName); const baseCmd = `gcloud functions`; diff --git a/functions/helloworld/test/updateFunctions.sh b/functions/helloworld/test/updateFunctions.sh index 594005811a..d96c4cfcc6 100644 --- a/functions/helloworld/test/updateFunctions.sh +++ b/functions/helloworld/test/updateFunctions.sh @@ -7,8 +7,12 @@ ${FUNCTIONS_CMD} deploy helloHttp --trigger-http echo '-----------------------------' ${FUNCTIONS_CMD} deploy helloBackground --trigger-topic $FUNCTIONS_TOPIC echo '-----------------------------' +${FUNCTIONS_CMD} delete helloPubSub -q +echo 'Deleted helloPubSub -----------------------------' ${FUNCTIONS_CMD} deploy helloPubSub --trigger-topic $FUNCTIONS_TOPIC echo '-----------------------------' +${FUNCTIONS_CMD} delete helloGCS -q +echo 'Deleted helloGCS -----------------------------' ${FUNCTIONS_CMD} deploy helloGCS --trigger-bucket $FUNCTIONS_BUCKET echo '-----------------------------' ${FUNCTIONS_CMD} deploy helloGCSGeneric --trigger-bucket $FUNCTIONS_BUCKET