From efa9f276534c84b4861ff0f40a68fd61015a91b8 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Wed, 28 Mar 2018 16:00:20 -0700 Subject: [PATCH 1/3] Attempt to fix CircleCI timeout issue (take 1) --- circle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index b4341ee6bd..e98ee2eea5 100644 --- a/circle.yml +++ b/circle.yml @@ -67,8 +67,8 @@ dependencies: # Run your tests test: override: - - functions start && cd functions/datastore && npm run system-test && functions stop - - functions start && cd functions/helloworld && npm run test && functions stop + - 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 - 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/gcs/test/**/*.test.js' - samples test run --cmd nyc -- --cache ava --verbose -T 30s 'functions/http/test/**/*.test.js' From 7fde2da3496387c1c08a904a68f813e5bed845da Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Thu, 29 Mar 2018 12:39:20 -0700 Subject: [PATCH 2/3] Fix circle failures + remove extra TODO comment --- .../test/sample.integration.storage.test.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/functions/helloworld/test/sample.integration.storage.test.js b/functions/helloworld/test/sample.integration.storage.test.js index c2f7080b01..1f51679a67 100644 --- a/functions/helloworld/test/sample.integration.storage.test.js +++ b/functions/helloworld/test/sample.integration.storage.test.js @@ -18,7 +18,7 @@ const childProcess = require(`child_process`); const test = require(`ava`); const uuid = require(`uuid`); -test(`helloGCS: should print uploaded message`, async (t) => { +test.serial(`helloGCS: should print uploaded message`, async (t) => { t.plan(1); const startTime = new Date(Date.now()).toISOString(); const filename = uuid.v4(); // Use a unique filename to avoid conflicts @@ -30,15 +30,14 @@ test(`helloGCS: should print uploaded message`, async (t) => { metageneration: '1' }); - childProcess.execSync(`functions call helloGCS --data '${data}'`); + childProcess.execSync(`functions-emulator call helloGCS --data '${data}'`); // Check the emulator's logs - const logs = childProcess.execSync(`functions logs read helloGCS --start-time ${startTime}`).toString(); + const logs = childProcess.execSync(`functions-emulator logs read helloGCS --start-time ${startTime}`).toString(); t.true(logs.includes(`File ${filename} uploaded.`)); }); -// TODO: ace-n figure out why these tests started failing -test.skip(`helloGCS: should print metadata updated message`, async (t) => { +test.serial(`helloGCS: should print metadata updated message`, async (t) => { t.plan(1); const startTime = new Date(Date.now()).toISOString(); const filename = uuid.v4(); // Use a unique filename to avoid conflicts @@ -50,14 +49,14 @@ test.skip(`helloGCS: should print metadata updated message`, async (t) => { metageneration: '2' }); - childProcess.execSync(`functions call helloGCS --data '${data}'`); + childProcess.execSync(`functions-emulator call helloGCS --data '${data}'`); // Check the emulator's logs - const logs = childProcess.execSync(`functions logs read helloGCS --start-time ${startTime}`).toString(); + const logs = childProcess.execSync(`functions-emulator logs read helloGCS --start-time ${startTime}`).toString(); t.true(logs.includes(`File ${filename} metadata updated.`)); }); -test(`helloGCS: should print deleted message`, async (t) => { +test.serial(`helloGCS: should print deleted message`, async (t) => { t.plan(1); const startTime = new Date(Date.now()).toISOString(); const filename = uuid.v4(); // Use a unique filename to avoid conflicts @@ -69,10 +68,10 @@ test(`helloGCS: should print deleted message`, async (t) => { metageneration: '3' }); - childProcess.execSync(`functions call helloGCS --data '${data}'`); + childProcess.execSync(`functions-emulator call helloGCS --data '${data}'`); // Check the emulator's logs - const logs = childProcess.execSync(`functions logs read helloGCS --start-time ${startTime}`).toString(); + const logs = childProcess.execSync(`functions-emulator logs read helloGCS --start-time ${startTime}`).toString(); t.true(logs.includes(`File ${filename} deleted.`)); }); // [END functions_storage_integration_test] From 6c2ce90a04889ad2bd8a56bd4ff0c4f97d010e88 Mon Sep 17 00:00:00 2001 From: Ace Nassri Date: Fri, 30 Mar 2018 10:51:08 -0700 Subject: [PATCH 3/3] Attempt to fix circle failures (take 3) --- functions/helloworld/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions/helloworld/package.json b/functions/helloworld/package.json index 7c513fa09f..c89645c69c 100644 --- a/functions/helloworld/package.json +++ b/functions/helloworld/package.json @@ -15,7 +15,7 @@ "lint": "repo-tools lint", "pretest": "npm run lint", "e2e-test": "export FUNCTIONS_CMD='gcloud beta functions' && sh test/updateFunctions.sh && BASE_URL=\"https://$GCF_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 test/index.test.js test/*unit*test.js test/*integration*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" }, "dependencies": {