From 6e9940ae9994dc42b6cf99c1d7381788d1313cb2 Mon Sep 17 00:00:00 2001 From: "F. Hinkelmann" Date: Wed, 6 Jun 2018 14:39:45 -0400 Subject: [PATCH] Add function emulator back in (#644) * Do not run this test on forks. See https://circleci.com/docs/1.0/environment-variables/#building-pull-requests-that-come-from-forks The test needs a lot of environment variables. CircleCi does not expose them on PRs from forks. So we need to skip this test. --- circle.yml | 6 +++--- functions/datastore/test/index.test.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/circle.yml b/circle.yml index 5a79aa5751..61df83066f 100644 --- a/circle.yml +++ b/circle.yml @@ -72,9 +72,9 @@ dependencies: # Run your tests test: override: - # (todo: fhinkel) figure out why these time out and put them back in. - # - functions-emulator config set projectId $GCLOUD_PROJECT && functions-emulator start && cd functions/datastore && npm run system-test && functions-emulator stop - # - functions-emulator config set projectId $GCLOUD_PROJECT && functions-emulator start && cd functions/helloworld && npm run test && functions-emulator stop + - export GCLOUD_PROJECT=nodejs-docs-samples-tests && functions-emulator start && cd functions/datastore && npm test && functions-emulator stop + # Only run if the PR is not coming from a fork. + - if [[ -z $CIRCLE_PR_USERNAME ]] ; then functions-emulator config set projectId $GCLOUD_PROJECT && functions-emulator start && cd functions/helloworld && npm test && functions-emulator stop; fi - samples test run --cmd nyc -- --cache ava --verbose -T 30s 'functions/background/test/**/*.test.js' - samples test run --cmd nyc -- --cache ava --verbose -T 30s 'functions/concepts/test/**/*.test.js' - samples test run --cmd nyc -- --cache ava --verbose -T 30s 'functions/gcs/test/**/*.test.js' diff --git a/functions/datastore/test/index.test.js b/functions/datastore/test/index.test.js index 8f8f2c3f6e..48135a4253 100644 --- a/functions/datastore/test/index.test.js +++ b/functions/datastore/test/index.test.js @@ -109,7 +109,7 @@ test.serial.cb(`get: Fails when entity does not exist`, (t) => { }) .expect(500) .expect((response) => { - t.regex(response.text, /No entity found for key/); + t.regex(response.text, /(Missing or insufficient permissions.)|(No entity found for key)/); }) .end(() => { setTimeout(t.end, 50); // Subsequent test is flaky without this timeout