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 52
52
- run : .kokoro/build.sh
53
53
env :
54
54
JOB_TYPE : test
55
- GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS : true
56
55
GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS : true
57
56
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
58
74
units-java8 :
59
75
# Building using Java 17 and run the tests with Java 8 runtime
60
76
name : " units (8)"
@@ -96,6 +112,26 @@ jobs:
96
112
GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS : true
97
113
GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS : true
98
114
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
99
135
windows :
100
136
runs-on : windows-latest
101
137
steps :
Original file line number Diff line number Diff line change 39
39
env :
40
40
JOB_TYPE : test
41
41
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 {
613
613
614
614
// This field controls the default behavior of session management in Java client.
615
615
// Set useMultiplexedSession to true to make multiplexed session the default.
616
- private boolean useMultiplexedSession = false ;
616
+ private boolean useMultiplexedSession = true ;
617
617
618
618
// This field controls the default behavior of session management for RW operations in Java
619
619
// client.
Original file line number Diff line number Diff line change 27
27
import static org .junit .Assert .assertNotNull ;
28
28
import static org .junit .Assert .assertThrows ;
29
29
import static org .junit .Assert .assertTrue ;
30
+ import static org .junit .Assume .assumeFalse ;
30
31
31
32
import com .google .api .core .ApiFuture ;
32
33
import com .google .api .core .ApiFutures ;
@@ -69,6 +70,7 @@ public class MultiplexedSessionDatabaseClientMockServerTest extends AbstractMock
69
70
70
71
@ BeforeClass
71
72
public static void setupResults () {
73
+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
72
74
mockSpanner .putStatementResults (
73
75
StatementResult .query (STATEMENT , new RandomResultSetGenerator (1 ).generate ()));
74
76
mockSpanner .putStatementResult (StatementResult .update (UPDATE_STATEMENT , UPDATE_COUNT ));
Original file line number Diff line number Diff line change 24
24
import static org .junit .Assert .assertThrows ;
25
25
import static org .junit .Assert .assertTrue ;
26
26
import static org .junit .Assert .fail ;
27
+ import static org .junit .Assume .assumeFalse ;
27
28
28
29
import com .google .api .gax .longrunning .OperationTimedPollAlgorithm ;
29
30
import com .google .api .gax .retrying .RetrySettings ;
@@ -255,6 +256,7 @@ public void testMetricsWithGaxRetryUnaryRpc() {
255
256
256
257
@ Test
257
258
public void testNoNetworkConnection () {
259
+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
258
260
// Create a Spanner instance that tries to connect to a server that does not exist.
259
261
// This simulates a bad network connection.
260
262
SpannerOptions .Builder builder = SpannerOptions .newBuilder ();
Original file line number Diff line number Diff line change @@ -284,6 +284,7 @@ public void testDenyListedChannelIsCleared() {
284
284
285
285
@ Test
286
286
public void testSingleUseQuery_retriesOnNewChannel () {
287
+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
287
288
SpannerOptions .Builder builder = createSpannerOptionsBuilder ();
288
289
builder .setSessionPoolOption (
289
290
SessionPoolOptions .newBuilder ().setUseMultiplexedSession (true ).build ());
@@ -312,6 +313,7 @@ public void testSingleUseQuery_retriesOnNewChannel() {
312
313
313
314
@ Test
314
315
public void testSingleUseQuery_stopsRetrying () {
316
+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
315
317
SpannerOptions .Builder builder = createSpannerOptionsBuilder ();
316
318
builder .setSessionPoolOption (
317
319
SessionPoolOptions .newBuilder ().setUseMultiplexedSession (true ).build ());
Original file line number Diff line number Diff line change @@ -283,6 +283,7 @@ public void testRandomizePositionQPSThreshold() {
283
283
284
284
@ Test
285
285
public void testUseMultiplexedSession () {
286
+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
286
287
// skip these tests since this configuration can have dual behaviour in different test-runners
287
288
assumeFalse (SessionPoolOptions .newBuilder ().build ().getUseMultiplexedSession ());
288
289
assertEquals (false , SessionPoolOptions .newBuilder ().build ().getUseMultiplexedSession ());
@@ -304,6 +305,7 @@ public void testUseMultiplexedSession() {
304
305
@ Test
305
306
public void testUseMultiplexedSessionForRW () {
306
307
// skip these tests since this configuration can have dual behaviour in different test-runners
308
+ assumeFalse (TestHelper .isMultiplexSessionDisabled ());
307
309
assumeFalse (
308
310
Boolean .parseBoolean (System .getenv ("GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW" )));
309
311
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