From 860819183b10572bf0961f800f89fb1ac39dc770 Mon Sep 17 00:00:00 2001 From: Sri Harsha CH Date: Fri, 10 Jan 2025 10:25:14 +0000 Subject: [PATCH] chore(spanner): add env to verify tests --- .github/workflows/ci.yaml | 2 ++ ...tion-tests-against-emulator-with-multiplexed-session.yaml | 1 + .../presubmit/integration-multiplexed-sessions-enabled.cfg | 5 +++++ .../java/com/google/cloud/spanner/SessionPoolOptions.java | 2 +- .../cloud/spanner/connection/ITAbstractSpannerTest.java | 1 - .../cloud/spanner/connection/OpenTelemetryTracingTest.java | 1 - 6 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ee28d7f8a66..365149605e4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -54,6 +54,7 @@ jobs: JOB_TYPE: test GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS: true GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS: true + GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW: true units-java8: # Building using Java 17 and run the tests with Java 8 runtime name: "units (8)" @@ -94,6 +95,7 @@ jobs: JOB_TYPE: test GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS: true GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS: true + GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW: true windows: runs-on: windows-latest steps: diff --git a/.github/workflows/integration-tests-against-emulator-with-multiplexed-session.yaml b/.github/workflows/integration-tests-against-emulator-with-multiplexed-session.yaml index bd7dfef3972..b6f2290db54 100644 --- a/.github/workflows/integration-tests-against-emulator-with-multiplexed-session.yaml +++ b/.github/workflows/integration-tests-against-emulator-with-multiplexed-session.yaml @@ -40,3 +40,4 @@ jobs: JOB_TYPE: test SPANNER_EMULATOR_HOST: localhost:9010 GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS: true + GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW: true diff --git a/.kokoro/presubmit/integration-multiplexed-sessions-enabled.cfg b/.kokoro/presubmit/integration-multiplexed-sessions-enabled.cfg index 49edd2e8df6..800e2a21558 100644 --- a/.kokoro/presubmit/integration-multiplexed-sessions-enabled.cfg +++ b/.kokoro/presubmit/integration-multiplexed-sessions-enabled.cfg @@ -41,3 +41,8 @@ env_vars: { key: "GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS" value: "true" } + +env_vars: { + key: "GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW" + value: "true" +} diff --git a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java index 03551640b43..7ce6b7bc61a 100644 --- a/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java +++ b/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SessionPoolOptions.java @@ -390,7 +390,7 @@ private static Boolean parseBooleanEnvVariable(String variableName) { private static Boolean getUseMultiplexedSessionForRWFromEnvVariable() { // Checks the value of env, GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW // This returns null until RW is supported. - return null; + return parseBooleanEnvVariable("GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW"); } Duration getMultiplexedSessionMaintenanceDuration() { diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ITAbstractSpannerTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ITAbstractSpannerTest.java index 5c0987f1d9d..7bf6a670d9c 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ITAbstractSpannerTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/ITAbstractSpannerTest.java @@ -22,7 +22,6 @@ import com.google.cloud.spanner.GceTestEnvConfig; import com.google.cloud.spanner.IntegrationTestEnv; import com.google.cloud.spanner.ResultSet; -import com.google.cloud.spanner.Spanner; import com.google.cloud.spanner.SpannerExceptionFactory; import com.google.cloud.spanner.SpannerOptions; import com.google.cloud.spanner.Statement; diff --git a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/OpenTelemetryTracingTest.java b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/OpenTelemetryTracingTest.java index be335dcb381..a8e579feb1a 100644 --- a/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/OpenTelemetryTracingTest.java +++ b/google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/OpenTelemetryTracingTest.java @@ -20,7 +20,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import static org.junit.Assume.assumeFalse; import com.google.cloud.spanner.MockSpannerServiceImpl; import com.google.cloud.spanner.ResultSet;