Skip to content

Commit

Permalink
Update GCF tests (#2399)
Browse files Browse the repository at this point in the history
* Update GCF tests

* lint

Co-authored-by: sofisl <55454395+sofisl@users.noreply.github.com>
  • Loading branch information
averikitsch and sofisl authored Oct 29, 2021
1 parent e6754f3 commit c17391c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 5 additions & 1 deletion functions/helloworld/test/sample.system.http.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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]
Expand Down
6 changes: 5 additions & 1 deletion functions/helloworld/test/sample.system.pubsub.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand All @@ -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]
Expand Down
8 changes: 7 additions & 1 deletion functions/helloworld/test/sample.system.storage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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]
Expand Down

0 comments on commit c17391c

Please sign in to comment.