Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .kokoro/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
# limitations under the License.

export GCLOUD_PROJECT=nodejs-docs-samples-tests
export GCF_REGION=us-central1
export NODE_ENV=development

export FUNCTIONS_TOPIC=my-topic
export FUNCTIONS_BUCKET=my-bucket
export FUNCTIONS_TOPIC=integration-tests-instance
export FUNCTIONS_BUCKET=$GCLOUD_PROJECT
export BASE_URL="http://localhost:8010/${GCLOUD_PROJECT}/${GCF_REGION}"

cd github/nodejs-docs-samples/${PROJECT}

Expand All @@ -32,6 +34,10 @@ gcloud config set project $GCLOUD_PROJECT

# Start functions emulator, if appropriate
if [[ $PROJECT == functions/* ]]; then
export FUNCTIONS_LOG_PATH=$(pwd)/logs/cloud-functions-emulator.log
npm install -g @google-cloud/functions-emulator
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way we could avoid global installs? Would npx solve that for us?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps - however, these containers are (AFAIK) ephemeral. Is making (and potentially debugging) this change a good use of time?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anybody wants to reproduce this locally, they might end up with global installs which is not nice. Also, problem caused by globally installed dependencies are hard to debug.

It should be enough to delete the npm i -g line and further down call:
npx functions-emulator start (instead of functions-emulator start).

Let's land it as is to figure out if it works. And then do another revision to get rid of the global installs.

touch "$FUNCTIONS_LOG_PATH"
functions config set logFile "$FUNCTIONS_LOG_PATH"
functions-emulator start
fi

Expand Down
3 changes: 3 additions & 0 deletions .kokoro/functions/common.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
# Download trampoline resources. These will be in ${KOKORO_GFILE_DIR}
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/trampoline"

# Download secrets from Cloud Storage.
gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/nodejs-docs-samples"

# All builds use the trampoline script to run in docker.
build_file: "nodejs-docs-samples/.kokoro/trampoline.sh"

Expand Down
4 changes: 2 additions & 2 deletions functions/helloworld/test/sample.integration.pubsub.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const childProcess = require(`child_process`);
const test = require(`ava`);
const uuid = require(`uuid`);

test(`helloPubSub: should print a name`, async (t) => {
test.serial(`helloPubSub: should print a name`, async (t) => {
t.plan(1);
const startTime = new Date(Date.now()).toISOString();
const name = uuid.v4();
Expand All @@ -33,7 +33,7 @@ test(`helloPubSub: should print a name`, async (t) => {
t.true(logs.includes(`Hello, ${name}!`));
});

test(`helloPubSub: should print hello world`, async (t) => {
test.serial(`helloPubSub: should print hello world`, async (t) => {
t.plan(1);
const startTime = new Date(Date.now()).toISOString();

Expand Down