Skip to content

Commit 4663320

Browse files
build: use a separate instance for regular sessions (googleapis#4157)
* build: use a separate instance for regular sessions Also stop log spamming from Spanner options and reduce the time that a test database may stay around on a test instance. * chore: generate libraries at Thu Oct 9 10:12:40 UTC 2025 --------- Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
1 parent b967aae commit 4663320

File tree

10 files changed

+33
-67
lines changed

10 files changed

+33
-67
lines changed

.github/workflows/update_generation_config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
# the branch into which the pull request is merged
2727
base_branch: main
2828
steps:
29-
- uses: actions/checkout@v5
29+
- uses: actions/checkout@v4
3030
with:
3131
fetch-depth: 0
3232
token: ${{ secrets.CLOUD_JAVA_BOT_TOKEN }}

.kokoro/build.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ integration)
104104
verify
105105
RETURN_CODE=$?
106106
;;
107-
integration-directpath-enabled)
107+
integration-regular-sessions)
108108
mvn -B ${INTEGRATION_TEST_ARGS} \
109109
-ntp \
110110
-Penable-integration-tests \
@@ -113,13 +113,13 @@ integration-directpath-enabled)
113113
-Dclirr.skip=true \
114114
-Denforcer.skip=true \
115115
-Dmaven.main.skip=true \
116-
-Dspanner.testenv.instance=projects/span-cloud-testing/instances/spanner-java-client-directpath \
117-
-Dspanner.gce.config.project_id=span-cloud-testing \
116+
-Dspanner.gce.config.project_id=gcloud-devel \
117+
-Dspanner.testenv.instance=projects/gcloud-devel/instances/java-client-integration-tests-regular-sessions \
118118
-fae \
119119
verify
120120
RETURN_CODE=$?
121121
;;
122-
integration-multiplexed-sessions-enabled)
122+
integration-directpath-enabled)
123123
mvn -B ${INTEGRATION_TEST_ARGS} \
124124
-ntp \
125125
-Penable-integration-tests \
@@ -129,7 +129,7 @@ integration-multiplexed-sessions-enabled)
129129
-Denforcer.skip=true \
130130
-Dmaven.main.skip=true \
131131
-Dspanner.gce.config.project_id=gcloud-devel \
132-
-Dspanner.testenv.instance=projects/gcloud-devel/instances/java-client-integration-tests-multiplexed-sessions \
132+
-Dspanner.testenv.instance=projects/gcloud-devel/instances/java-client-integration-tests-directpath \
133133
-fae \
134134
verify
135135
RETURN_CODE=$?
@@ -184,12 +184,14 @@ integration-cloud-staging|integration-cloud-staging-directpath-enabled)
184184
;;
185185
graalvm)
186186
# Run Unit and Integration Tests with Native Image
187-
mvn test -Pnative -Penable-integration-tests -Dspanner.gce.config.project_id=gcloud-devel -Dspanner.testenv.instance=projects/gcloud-devel/instances/java-client-integration-tests
187+
# NOTE: These integration tests run on the Emulator.
188+
mvn test -Pnative -Penable-integration-tests -Dspanner.gce.config.project_id=gcloud-devel -Dspanner.testenv.instance=projects/gcloud-devel/instances/java-client-integration-tests-graalvm
188189
RETURN_CODE=$?
189190
;;
190191
graalvm17)
191192
# Run Unit and Integration Tests with Native Image
192-
mvn test -Pnative -Penable-integration-tests -Dspanner.gce.config.project_id=gcloud-devel -Dspanner.testenv.instance=projects/gcloud-devel/instances/java-client-integration-tests
193+
# NOTE: These integration tests run on the Emulator.
194+
mvn test -Pnative -Penable-integration-tests -Dspanner.gce.config.project_id=gcloud-devel -Dspanner.testenv.instance=projects/gcloud-devel/instances/java-client-integration-tests-graalvm
193195
RETURN_CODE=$?
194196
;;
195197
slowtests)

.kokoro/presubmit/integration-directpath-enabled.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ env_vars: {
2424

2525
env_vars: {
2626
key: "GOOGLE_APPLICATION_CREDENTIALS"
27-
value: "secret_manager/java-client-testing"
27+
value: "secret_manager/java-it-service-account"
2828
}
2929

3030
env_vars: {
3131
key: "SECRET_MANAGER_KEYS"
32-
value: "java-client-testing"
32+
value: "java-it-service-account"
3333
}
3434

3535
env_vars: {

.kokoro/presubmit/integration-multiplexed-sessions-enabled.cfg

Lines changed: 0 additions & 48 deletions
This file was deleted.

.kokoro/presubmit/integration-regular-sessions-enabled.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ env_vars: {
88

99
env_vars: {
1010
key: "JOB_TYPE"
11-
value: "integration"
11+
value: "integration-regular-sessions"
1212
}
1313

1414
# TODO: remove this after we've migrated all tests and scripts

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
1919
<dependency>
2020
<groupId>com.google.cloud</groupId>
2121
<artifactId>libraries-bom</artifactId>
22-
<version>26.68.0</version>
22+
<version>26.69.0</version>
2323
<type>pom</type>
2424
<scope>import</scope>
2525
</dependency>
@@ -56,13 +56,13 @@ implementation 'com.google.cloud:google-cloud-spanner'
5656
If you are using Gradle without BOM, add this to your dependencies:
5757

5858
```Groovy
59-
implementation 'com.google.cloud:google-cloud-spanner:6.101.1'
59+
implementation 'com.google.cloud:google-cloud-spanner:6.102.0'
6060
```
6161

6262
If you are using SBT, add this to your dependencies:
6363

6464
```Scala
65-
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.101.1"
65+
libraryDependencies += "com.google.cloud" % "google-cloud-spanner" % "6.102.0"
6666
```
6767

6868
## Authentication
@@ -731,7 +731,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
731731
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/java-spanner/java11.html
732732
[stability-image]: https://img.shields.io/badge/stability-stable-green
733733
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-spanner.svg
734-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.101.1
734+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-spanner/6.102.0
735735
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
736736
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
737737
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

google-cloud-spanner/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
<spanner.testenv.instance>${spanner.testenv.instance}</spanner.testenv.instance>
6565
<spanner.gce.config.project_id>${spanner.gce.config.project_id}</spanner.gce.config.project_id>
6666
<spanner.testenv.kms_key.name>${spanner.testenv.kms_key.name}</spanner.testenv.kms_key.name>
67+
<java.util.logging.config.file>logging.properties</java.util.logging.config.file>
6768
</systemPropertyVariables>
6869

6970
</configuration>
@@ -88,6 +89,7 @@
8889
<spanner.testenv.instance>${spanner.testenv.instance}</spanner.testenv.instance>
8990
<spanner.gce.config.project_id>${spanner.gce.config.project_id}</spanner.gce.config.project_id>
9091
<spanner.testenv.kms_key.name>${spanner.testenv.kms_key.name}</spanner.testenv.kms_key.name>
92+
<java.util.logging.config.file>logging.properties</java.util.logging.config.file>
9193
</systemPropertyVariables>
9294
<forkedProcessTimeoutInSeconds>3000</forkedProcessTimeoutInSeconds>
9395
</configuration>
@@ -124,6 +126,7 @@
124126
<buildArg>-Dspanner.testenv.instance=${spanner.testenv.instance}</buildArg>
125127
<buildArg>-Dspanner.gce.config.project_id=${spanner.gce.config.project_id}</buildArg>
126128
<buildArg>-Dspanner.testenv.kms_key.name=${spanner.testenv.kms_key.name}</buildArg>
129+
<buildArg>-Djava.util.logging.config.file=logging.properties</buildArg>
127130
</buildArgs>
128131
</configuration>
129132
</plugin>

google-cloud-spanner/src/test/java/com/google/cloud/spanner/IntegrationTestEnv.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ protected void before() throws Throwable {
141141
.anyMatch(testEnvOption -> TestEnvOptions.USE_END_TO_END_TRACING.equals(testEnvOption))) {
142142
// OpenTelemetry set up for enabling End to End tracing for all integration test env.
143143
// The gRPC stub and connections are created during test env set up using SpannerOptions and
144-
// are
145-
// reused for executing statements.
144+
// are reused for executing statements.
146145
options = spannerOptionsWithEndToEndTracing(options);
147146
}
148147
String instanceProperty = System.getProperty(TEST_INSTANCE_PROPERTY, "");
@@ -293,7 +292,7 @@ static boolean isRetryableResourceExhaustedException(SpannerException exception)
293292
}
294293

295294
private void cleanUpOldDatabases(InstanceId instanceId) {
296-
long OLD_DB_THRESHOLD_SECS = TimeUnit.SECONDS.convert(6L, TimeUnit.HOURS);
295+
long OLD_DB_THRESHOLD_SECS = TimeUnit.SECONDS.convert(2L, TimeUnit.HOURS);
297296
Timestamp currentTimestamp = Timestamp.now();
298297
int numDropped = 0;
299298
String TEST_DB_REGEX = "(testdb_(.*)_(.*))|(mysample-(.*))";

google-cloud-spanner/src/test/java/com/google/cloud/spanner/connection/SpannerPoolTest.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import java.io.ByteArrayOutputStream;
4545
import java.io.OutputStream;
4646
import java.util.concurrent.TimeUnit;
47+
import java.util.logging.ConsoleHandler;
4748
import java.util.logging.Handler;
4849
import java.util.logging.Logger;
4950
import java.util.logging.StreamHandler;
@@ -211,7 +212,8 @@ private void attachLogCapturer() {
211212
currentLogger = currentLogger.getParent();
212213
}
213214
if (handlers.length == 0) {
214-
throw new IllegalStateException("no handlers found for logger");
215+
handlers = new Handler[1];
216+
handlers[0] = new ConsoleHandler();
215217
}
216218
customLogHandler = new StreamHandler(logCapturingStream, handlers[0].getFormatter());
217219
useParentHandlers = log.getUseParentHandlers();
@@ -267,6 +269,7 @@ public void testRemoveConnectionConnectionAlreadyRemoved() {
267269

268270
@Test
269271
public void testCloseSpanner() {
272+
attachLogCapturer();
270273
SpannerPool pool = createSubjectAndMocks();
271274
Spanner spanner = pool.getSpanner(options1, connection1);
272275
// verify that closing is not possible until all connections have been removed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.level=INFO
2+
.handlers=java.util.logging.ConsoleHandler
3+
java.util.logging.ConsoleHandler.level=INFO
4+
java.util.logging.Logger.useParentHandlers=true
5+
6+
# Set log level to WARN for SpannerImpl to prevent log spamming of the Spanner configuration.
7+
com.google.cloud.spanner.SpannerImpl.LEVEL=WARN

0 commit comments

Comments
 (0)