From 82f6a8b32f46ac9c3d505032f71fa53335455c16 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Tue, 4 Sep 2018 11:32:09 -0700 Subject: [PATCH 1/8] Add missing dependencies --- functions/helloworld/package.json | 1 + functions/ocr/app/package.json | 1 + functions/slack/package.json | 1 + 3 files changed, 3 insertions(+) diff --git a/functions/helloworld/package.json b/functions/helloworld/package.json index cd4a3463ea..3f654f20f6 100644 --- a/functions/helloworld/package.json +++ b/functions/helloworld/package.json @@ -24,6 +24,7 @@ "safe-buffer": "5.1.1" }, "devDependencies": { + "@google-cloud/functions-emulator": "^1.0.0-beta.5", "@google-cloud/nodejs-repo-tools": "^2.2.5", "@google-cloud/pubsub": "^0.17.0", "@google-cloud/storage": "^1.5.0", diff --git a/functions/ocr/app/package.json b/functions/ocr/app/package.json index e6bcaf24d6..e3e430eb78 100644 --- a/functions/ocr/app/package.json +++ b/functions/ocr/app/package.json @@ -27,6 +27,7 @@ "@google-cloud/nodejs-repo-tools": "1.4.17", "ava": "0.22.0", "proxyquire": "1.8.0", + "semistandard": "^12.0.1", "sinon": "3.2.1" }, "cloud-repo-tools": { diff --git a/functions/slack/package.json b/functions/slack/package.json index ba2cd6f43c..315d7ba04f 100644 --- a/functions/slack/package.json +++ b/functions/slack/package.json @@ -23,6 +23,7 @@ "@google-cloud/nodejs-repo-tools": "2.1.0", "ava": "0.23.0", "proxyquire": "1.8.0", + "semistandard": "^12.0.1", "sinon": "4.0.2" }, "cloud-repo-tools": { From a27e20cc7d2f6ed2d0eb6206391ccb35a9c72a11 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Tue, 4 Sep 2018 12:19:31 -0700 Subject: [PATCH 2/8] Take 2 --- .kokoro/build.sh | 1 + .kokoro/lint.sh | 0 2 files changed, 1 insertion(+) mode change 100644 => 100755 .kokoro/lint.sh diff --git a/.kokoro/build.sh b/.kokoro/build.sh index 726a3497b3..bdd405b0e9 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -16,6 +16,7 @@ export GCLOUD_PROJECT=nodejs-docs-samples-tests export NODE_ENV=development +export FUNCTIONS_TOPIC=my-topic cd github/nodejs-docs-samples/${PROJECT} diff --git a/.kokoro/lint.sh b/.kokoro/lint.sh old mode 100644 new mode 100755 From abba4a56077646ca71e8a900e9df846c841faeb1 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Fri, 7 Sep 2018 10:29:32 -0700 Subject: [PATCH 3/8] Fix functions test --- .kokoro/build.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index bdd405b0e9..af395bff0b 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -16,7 +16,9 @@ export GCLOUD_PROJECT=nodejs-docs-samples-tests export NODE_ENV=development + export FUNCTIONS_TOPIC=my-topic +export FUNCTIONS_BUCKET=my-bucket cd github/nodejs-docs-samples/${PROJECT} @@ -30,4 +32,4 @@ gcloud config set project $GCLOUD_PROJECT npm test -exit $? \ No newline at end of file +exit $? From 92968924bc2ba183d534e8fa71fc1a72410b677e Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Fri, 7 Sep 2018 10:38:47 -0700 Subject: [PATCH 4/8] Fix KMS test failing due to pagination --- kms/system-test/keys.test.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kms/system-test/keys.test.js b/kms/system-test/keys.test.js index b7b1aa63cd..e8b14ec576 100644 --- a/kms/system-test/keys.test.js +++ b/kms/system-test/keys.test.js @@ -33,6 +33,7 @@ const plaintext = path.join(__dirname, `../resources/plaintext.txt`); const ciphertext = path.join(__dirname, `../resources/plaintext.txt.encrypted`); const decrypted = path.join(__dirname, `../resources/plaintext.txt.decrypted`); +const unspecifiedKeyRingName = `projects/${projectId}/locations/global/keyRings/`; const formattedKeyRingName = `projects/${projectId}/locations/global/keyRings/${keyRingName}`; const formattedKeyName = `${formattedKeyRingName}/cryptoKeys/${keyNameOne}`; @@ -70,7 +71,7 @@ test.serial(`should create a key ring`, async (t) => { test.serial(`should list key rings`, async (t) => { await tools.tryTest(async () => { const output = await tools.runAsync(`${cmd} keyrings list`, cwd); - t.regex(output, new RegExp(formattedKeyRingName)); + t.regex(output, new RegExp(unspecifiedKeyRingName)); }).start(); }); @@ -105,6 +106,8 @@ test.serial(`should revoke access to a key ring`, async (t) => { t.regex(output, new RegExp(`${member}/${role} combo removed from policy for key ring ${keyRingName}.`)); }); + + // Crypto key tests test.serial(`should create a key`, async (t) => { const output = await tools.runAsync(`${cmd} create "${keyRingName}" "${keyNameOne}"`, cwd); From 4d571333aa6fd2751f5f0a0aec1528ef82cf2f1c Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Fri, 7 Sep 2018 11:00:53 -0700 Subject: [PATCH 5/8] Fix lint --- kms/system-test/keys.test.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/kms/system-test/keys.test.js b/kms/system-test/keys.test.js index e8b14ec576..116406916e 100644 --- a/kms/system-test/keys.test.js +++ b/kms/system-test/keys.test.js @@ -106,8 +106,6 @@ test.serial(`should revoke access to a key ring`, async (t) => { t.regex(output, new RegExp(`${member}/${role} combo removed from policy for key ring ${keyRingName}.`)); }); - - // Crypto key tests test.serial(`should create a key`, async (t) => { const output = await tools.runAsync(`${cmd} create "${keyRingName}" "${keyNameOne}"`, cwd); From ebb42e716363dc5fac2183c2a187522c0f9b6e56 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Fri, 7 Sep 2018 11:05:45 -0700 Subject: [PATCH 6/8] Add code to start GCF emulator --- .kokoro/build.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index af395bff0b..dc1d19f3b3 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -30,6 +30,11 @@ export GOOGLE_APPLICATION_CREDENTIALS=${KOKORO_GFILE_DIR}/secrets-key.json gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS" gcloud config set project $GCLOUD_PROJECT +# Start functions emulator, if appropriate +if [[ $PROJECT == "functions/*" ]]; then + functions-emulator start +fi + npm test exit $? From 88f003a432c969d4b2a4ffd87e786e0af34afa86 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Fri, 7 Sep 2018 11:14:21 -0700 Subject: [PATCH 7/8] Add missing semistandard dependency --- appengine/cloudsql_postgresql/package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appengine/cloudsql_postgresql/package.json b/appengine/cloudsql_postgresql/package.json index 6b147350e2..6949ad3841 100644 --- a/appengine/cloudsql_postgresql/package.json +++ b/appengine/cloudsql_postgresql/package.json @@ -31,7 +31,8 @@ }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "2.2.1", - "ava": "0.25.0" + "ava": "0.25.0", + "semistandard": "^12.0.1" }, "cloud-repo-tools": { "requiresKeyFile": true, From 07cd02ebfed9027e3a0ac099bfe8493b4276f4aa Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Fri, 7 Sep 2018 12:13:43 -0700 Subject: [PATCH 8/8] Fix functions/helloworld build script --- .kokoro/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.kokoro/build.sh b/.kokoro/build.sh index dc1d19f3b3..43e740b0bc 100755 --- a/.kokoro/build.sh +++ b/.kokoro/build.sh @@ -31,7 +31,7 @@ gcloud auth activate-service-account --key-file "$GOOGLE_APPLICATION_CREDENTIALS gcloud config set project $GCLOUD_PROJECT # Start functions emulator, if appropriate -if [[ $PROJECT == "functions/*" ]]; then +if [[ $PROJECT == functions/* ]]; then functions-emulator start fi