diff --git a/functions/helloworld/test/sample.system.http.test.js b/functions/helloworld/test/sample.system.http.test.js index 7926a6a66e..91362e9984 100644 --- a/functions/helloworld/test/sample.system.http.test.js +++ b/functions/helloworld/test/sample.system.http.test.js @@ -18,6 +18,10 @@ const Supertest = require('supertest'); const supertest = Supertest(process.env.BASE_URL); const childProcess = require('child_process'); +if (!process.env.GCF_REGION) { + throw new Error('"GCF_REGION" env var must be set.'); +} + describe('system tests', () => { // [END functions_http_system_test] before(() => { @@ -28,7 +32,7 @@ describe('system tests', () => { after(() => { childProcess.execSync( - `gcloud functions delete helloHttp --region=${process.env.GCF_REGION}` + `gcloud functions delete helloHttp --region=${process.env.GCF_REGION} --quiet` ); }); // [START functions_http_system_test] diff --git a/functions/helloworld/test/sample.system.pubsub.test.js b/functions/helloworld/test/sample.system.pubsub.test.js index d0b435c34a..6ebc327db5 100644 --- a/functions/helloworld/test/sample.system.pubsub.test.js +++ b/functions/helloworld/test/sample.system.pubsub.test.js @@ -22,6 +22,10 @@ const promiseRetry = require('promise-retry'); const pubsub = new PubSub(); const topicName = process.env.FUNCTIONS_TOPIC; +if (!topicName) throw new Error('"FUNCTION_TOPIC" env var must be set.'); +if (!process.env.GCF_REGION) { + throw new Error('"GCF_REGION" env var must be set.'); +} const baseCmd = 'gcloud functions'; describe('system tests', () => { @@ -34,7 +38,7 @@ describe('system tests', () => { after(() => { childProcess.execSync( - `gcloud functions delete helloPubSub --region=${process.env.GCF_REGION}` + `gcloud functions delete helloPubSub --region=${process.env.GCF_REGION} --quiet` ); }); // [START functions_pubsub_system_test] diff --git a/functions/helloworld/test/sample.system.storage.test.js b/functions/helloworld/test/sample.system.storage.test.js index e57729d1dc..49b1c82b3c 100644 --- a/functions/helloworld/test/sample.system.storage.test.js +++ b/functions/helloworld/test/sample.system.storage.test.js @@ -27,6 +27,12 @@ const gcsFileName = `test-${uuid.v4()}.txt`; const localFileName = 'test.txt'; const bucketName = process.env.FUNCTIONS_DELETABLE_BUCKET; +if (!bucketName) { + throw new Error('"FUNCTION_DELETABLE_BUCKET" env var must be set.'); +} +if (!process.env.GCF_REGION) { + throw new Error('"GCF_REGION" env var must be set.'); +} const bucket = storage.bucket(bucketName); const baseCmd = 'gcloud functions'; @@ -40,7 +46,7 @@ describe('system tests', () => { after(() => { childProcess.execSync( - `gcloud functions delete helloGCS --region=${process.env.GCF_REGION}` + `gcloud functions delete helloGCS --region=${process.env.GCF_REGION} --quiet` ); }); // [START functions_storage_system_test]