Skip to content

Commit 967681c

Browse files
committed
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.
1 parent b967aae commit 967681c

File tree

6 files changed

+30
-5
lines changed

6 files changed

+30
-5
lines changed

.kokoro/build.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,21 @@ integration)
104104
verify
105105
RETURN_CODE=$?
106106
;;
107+
integration-regular-sessions)
108+
mvn -B ${INTEGRATION_TEST_ARGS} \
109+
-ntp \
110+
-Penable-integration-tests \
111+
-Djava.net.preferIPv4Stack=true \
112+
-DtrimStackTrace=false \
113+
-Dclirr.skip=true \
114+
-Denforcer.skip=true \
115+
-Dmaven.main.skip=true \
116+
-Dspanner.gce.config.project_id=gcloud-devel \
117+
-Dspanner.testenv.instance=projects/gcloud-devel/instances/java-client-integration-tests-regular-sessions \
118+
-fae \
119+
verify
120+
RETURN_CODE=$?
121+
;;
107122
integration-directpath-enabled)
108123
mvn -B ${INTEGRATION_TEST_ARGS} \
109124
-ntp \

.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

google-cloud-spanner/pom.xml

Lines changed: 1 addition & 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>

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)