File tree Expand file tree Collapse file tree 9 files changed +110
-3
lines changed
main/java/com/google/cloud/spanner
test/java/com/google/cloud/spanner Expand file tree Collapse file tree 9 files changed +110
-3
lines changed Original file line number Diff line number Diff line change 5252 - run : .kokoro/build.sh
5353 env :
5454 JOB_TYPE : test
55- GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS : true
5655 GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS : true
5756 GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW : true
57+ units-with-regular-session :
58+ runs-on : ubuntu-latest
59+ strategy :
60+ fail-fast : false
61+ matrix :
62+ java : [ 11, 17, 21 ]
63+ steps :
64+ - uses : actions/checkout@v4
65+ - uses : actions/setup-java@v3
66+ with :
67+ distribution : temurin
68+ java-version : ${{matrix.java}}
69+ - run : java -version
70+ - run : .kokoro/build.sh
71+ env :
72+ JOB_TYPE : test
73+ GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS : false
5874 units-java8 :
5975 # Building using Java 17 and run the tests with Java 8 runtime
6076 name : " units (8)"
@@ -96,6 +112,26 @@ jobs:
96112 GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS : true
97113 GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS : true
98114 GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW : true
115+ units-with-regular-session8 :
116+ # Building using Java 17 and run the tests with Java 8 runtime
117+ name : " units-with-regular-session (8)"
118+ runs-on : ubuntu-latest
119+ steps :
120+ - uses : actions/checkout@v4
121+ - uses : actions/setup-java@v3
122+ with :
123+ java-version : 8
124+ distribution : temurin
125+ - run : echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV
126+ shell : bash
127+ - uses : actions/setup-java@v3
128+ with :
129+ java-version : 17
130+ distribution : temurin
131+ - run : .kokoro/build.sh
132+ env :
133+ JOB_TYPE : test
134+ GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS : false
99135 windows :
100136 runs-on : windows-latest
101137 steps :
Original file line number Diff line number Diff line change 3939 env :
4040 JOB_TYPE : test
4141 SPANNER_EMULATOR_HOST : localhost:9010
42- GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS : true
42+ GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS : false
Original file line number Diff line number Diff line change 1+ # Format: //devtools/kokoro/config/proto/build.proto
2+
3+ # Configure the docker image for kokoro-trampoline.
4+ env_vars: {
5+ key: " TRAMPOLINE_IMAGE"
6+ value: " gcr.io/cloud-devrel-kokoro-resources/java8"
7+ }
8+
9+ env_vars: {
10+ key: " JOB_TYPE"
11+ value: " integration"
12+ }
13+
14+ # TODO: remove this after we've migrated all tests and scripts
15+ env_vars: {
16+ key: " GCLOUD_PROJECT"
17+ value: " gcloud-devel"
18+ }
19+
20+ env_vars: {
21+ key: " GOOGLE_CLOUD_PROJECT"
22+ value: " gcloud-devel"
23+ }
24+
25+ env_vars: {
26+ key: " GOOGLE_APPLICATION_CREDENTIALS"
27+ value: " secret_manager/java-it-service-account"
28+ }
29+
30+ env_vars: {
31+ key: " SECRET_MANAGER_KEYS"
32+ value: " java-it-service-account"
33+ }
34+
35+ env_vars: {
36+ key: " GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS"
37+ value: " false"
38+ }
Original file line number Diff line number Diff line change @@ -613,7 +613,7 @@ public static class Builder {
613613
614614 // This field controls the default behavior of session management in Java client.
615615 // Set useMultiplexedSession to true to make multiplexed session the default.
616- private boolean useMultiplexedSession = false ;
616+ private boolean useMultiplexedSession = true ;
617617
618618 // This field controls the default behavior of session management for RW operations in Java
619619 // client.
Original file line number Diff line number Diff line change 2727import static org .junit .Assert .assertNotNull ;
2828import static org .junit .Assert .assertThrows ;
2929import static org .junit .Assert .assertTrue ;
30+ import static org .junit .Assume .assumeFalse ;
3031
3132import com .google .api .core .ApiFuture ;
3233import com .google .api .core .ApiFutures ;
@@ -69,6 +70,7 @@ public class MultiplexedSessionDatabaseClientMockServerTest extends AbstractMock
6970
7071 @ BeforeClass
7172 public static void setupResults () {
73+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
7274 mockSpanner .putStatementResults (
7375 StatementResult .query (STATEMENT , new RandomResultSetGenerator (1 ).generate ()));
7476 mockSpanner .putStatementResult (StatementResult .update (UPDATE_STATEMENT , UPDATE_COUNT ));
Original file line number Diff line number Diff line change 2424import static org .junit .Assert .assertThrows ;
2525import static org .junit .Assert .assertTrue ;
2626import static org .junit .Assert .fail ;
27+ import static org .junit .Assume .assumeFalse ;
2728
2829import com .google .api .gax .longrunning .OperationTimedPollAlgorithm ;
2930import com .google .api .gax .retrying .RetrySettings ;
@@ -255,6 +256,7 @@ public void testMetricsWithGaxRetryUnaryRpc() {
255256
256257 @ Test
257258 public void testNoNetworkConnection () {
259+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
258260 // Create a Spanner instance that tries to connect to a server that does not exist.
259261 // This simulates a bad network connection.
260262 SpannerOptions .Builder builder = SpannerOptions .newBuilder ();
Original file line number Diff line number Diff line change @@ -284,6 +284,7 @@ public void testDenyListedChannelIsCleared() {
284284
285285 @ Test
286286 public void testSingleUseQuery_retriesOnNewChannel () {
287+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
287288 SpannerOptions .Builder builder = createSpannerOptionsBuilder ();
288289 builder .setSessionPoolOption (
289290 SessionPoolOptions .newBuilder ().setUseMultiplexedSession (true ).build ());
@@ -312,6 +313,7 @@ public void testSingleUseQuery_retriesOnNewChannel() {
312313
313314 @ Test
314315 public void testSingleUseQuery_stopsRetrying () {
316+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
315317 SpannerOptions .Builder builder = createSpannerOptionsBuilder ();
316318 builder .setSessionPoolOption (
317319 SessionPoolOptions .newBuilder ().setUseMultiplexedSession (true ).build ());
Original file line number Diff line number Diff line change @@ -283,6 +283,7 @@ public void testRandomizePositionQPSThreshold() {
283283
284284 @ Test
285285 public void testUseMultiplexedSession () {
286+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
286287 // skip these tests since this configuration can have dual behaviour in different test-runners
287288 assumeFalse (SessionPoolOptions .newBuilder ().build ().getUseMultiplexedSession ());
288289 assertEquals (false , SessionPoolOptions .newBuilder ().build ().getUseMultiplexedSession ());
@@ -304,6 +305,7 @@ public void testUseMultiplexedSession() {
304305 @ Test
305306 public void testUseMultiplexedSessionForRW () {
306307 // skip these tests since this configuration can have dual behaviour in different test-runners
308+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
307309 assumeFalse (
308310 Boolean .parseBoolean (System .getenv ("GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW" )));
309311 assumeFalse (SessionPoolOptions .newBuilder ().build ().getUseMultiplexedSession ());
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2025 Google LLC
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * https://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ package com .google .cloud .spanner ;
17+
18+ class TestHelper {
19+
20+ static boolean isMultiplexSessionDisabled () {
21+ return System .getenv ()
22+ .getOrDefault ("GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS" , "" )
23+ .equalsIgnoreCase ("false" );
24+ }
25+ }
You can’t perform that action at this time.
0 commit comments