From e8354e08461c301973d1d3f0900a53b4ff7a459c Mon Sep 17 00:00:00 2001 From: Alka Trivedi Date: Tue, 21 Jan 2025 14:46:35 +0530 Subject: [PATCH] tests: changes for kokoro pipeline --- .../node14/system-test-multiplexed-session.cfg | 17 +++++++++++++++++ .kokoro/system-test.sh | 6 ++++++ test/database.ts | 16 ++++++++-------- 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 .kokoro/presubmit/node14/system-test-multiplexed-session.cfg diff --git a/.kokoro/presubmit/node14/system-test-multiplexed-session.cfg b/.kokoro/presubmit/node14/system-test-multiplexed-session.cfg new file mode 100644 index 000000000..8bf1160cd --- /dev/null +++ b/.kokoro/presubmit/node14/system-test-multiplexed-session.cfg @@ -0,0 +1,17 @@ +# Download resources(service account key, etc.) for system tests when multiplexed session is enabled +gfile_resources: "/bigstore/cloud-devrel-kokoro-resources/google-cloud-nodejs" + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/nodejs-spanner/.kokoro/system-test.sh" +} + +env_vars: { + key: "SECRET_MANAGER_KEYS" + value: "long-door-651-kokoro-system-test-service-account" +} + +env_vars: { + key: "GOOGLE_CLOUD_SPANNER_ENABLE_MULTIPLEXED_SESSIONS" + value: "true" +} \ No newline at end of file diff --git a/.kokoro/system-test.sh b/.kokoro/system-test.sh index a90d5cfec..bb20a4220 100755 --- a/.kokoro/system-test.sh +++ b/.kokoro/system-test.sh @@ -45,6 +45,12 @@ if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]] || [[ $KOKORO_BUILD_ART trap cleanup EXIT HUP fi +# If tests are running with enabled multiplexed session, configure env +# GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS +if [[ $GOOGLE_CLOUD_SPANNER_ENABLE_MULTIPLEXED_SESSIONS = *"true"* ]]; then + export GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS=true +fi + npm run system-test # codecov combines coverage across integration and unit tests. Include diff --git a/test/database.ts b/test/database.ts index 3dc1959ce..fd31ba023 100644 --- a/test/database.ts +++ b/test/database.ts @@ -830,13 +830,13 @@ describe('Database', () => { muxEnabled.forEach(isMuxEnabled => { describe( - 'when GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSION is ' + + 'when GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS is ' + `${isMuxEnabled ? 'enabled' : 'disable'}`, () => { before(() => { isMuxEnabled - ? (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSION = 'true') - : (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSION = + ? (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS = 'true') + : (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS = 'false'); }); @@ -1930,8 +1930,8 @@ describe('Database', () => { () => { before(() => { isMuxEnabled - ? (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSION = 'true') - : (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSION = + ? (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS = 'true') + : (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS = 'false'); }); beforeEach(() => { @@ -2365,13 +2365,13 @@ describe('Database', () => { muxEnabled.forEach(isMuxEnabled => { describe( - 'when GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSION is ' + + 'when GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS is ' + `${isMuxEnabled ? 'enabled' : 'disable'}`, () => { before(() => { isMuxEnabled - ? (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSION = 'true') - : (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSION = + ? (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS = 'true') + : (process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS = 'false'); });