Skip to content

Commit 2f021fe

Browse files
build(deps): bump com.google.cloud:libraries-bom from 26.74.0 to 26.75.0 (GoogleCloudPlatform#4121)
* build(deps): bump com.google.cloud:libraries-bom from 26.74.0 to 26.75.0 Bumps [com.google.cloud:libraries-bom](https://github.com/googleapis/java-cloud-bom) from 26.74.0 to 26.75.0. - [Release notes](https://github.com/googleapis/java-cloud-bom/releases) - [Changelog](https://github.com/googleapis/java-cloud-bom/blob/main/release-please-config.json) - [Commits](googleapis/java-cloud-bom@v26.74.0...v26.75.0) --- updated-dependencies: - dependency-name: com.google.cloud:libraries-bom dependency-version: 26.75.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * test: modify tests now that the session pool is gone --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Knut Olav Løite <koloite@gmail.com>
1 parent 5678c54 commit 2f021fe

3 files changed

Lines changed: 23 additions & 13 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<dependency>
8686
<groupId>com.google.cloud</groupId>
8787
<artifactId>libraries-bom</artifactId>
88-
<version>26.74.0</version>
88+
<version>26.75.0</version>
8989
<type>pom</type>
9090
<scope>import</scope>
9191
</dependency>

src/test/java/com/google/cloud/spanner/pgadapter/JdbcSimpleModeMockServerTest.java

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333
import com.google.protobuf.ListValue;
3434
import com.google.protobuf.Value;
3535
import com.google.spanner.admin.database.v1.UpdateDatabaseDdlRequest;
36-
import com.google.spanner.v1.BatchCreateSessionsRequest;
3736
import com.google.spanner.v1.CommitRequest;
3837
import com.google.spanner.v1.ExecuteSqlRequest;
3938
import com.google.spanner.v1.ExecuteSqlRequest.QueryMode;
4039
import com.google.spanner.v1.ResultSetStats;
4140
import com.google.spanner.v1.RollbackRequest;
41+
import com.google.spanner.v1.TransactionOptions.IsolationLevel;
4242
import com.google.spanner.v1.TypeCode;
4343
import io.grpc.Status;
4444
import java.math.BigDecimal;
@@ -940,12 +940,23 @@ public void testPrepareInDmlBatch() throws SQLException {
940940

941941
@Test
942942
public void testStartupConnectionPropertiesInUrl() throws SQLException {
943+
int numTransactions = 10;
943944
try (Connection connection =
944945
DriverManager.getConnection(
945-
createUrl() + "&options=-c%20minSessions=10-c%20numChannels=1")) {}
946-
assertEquals(1, mockSpanner.countRequestsOfType(BatchCreateSessionsRequest.class));
947-
assertEquals(
948-
10,
949-
mockSpanner.getRequestsOfType(BatchCreateSessionsRequest.class).get(0).getSessionCount());
946+
createUrl()
947+
+ "&options=-c%20default_isolation_level=REPEATABLE_READ-c%20numChannels=1")) {
948+
connection.setAutoCommit(false);
949+
for (int i = 0; i < numTransactions; i++) {
950+
assertEquals(1, connection.createStatement().executeUpdate(INSERT_STATEMENT.getSql()));
951+
connection.commit();
952+
}
953+
}
954+
assertEquals(numTransactions, mockSpanner.countRequestsOfType(ExecuteSqlRequest.class));
955+
for (ExecuteSqlRequest request : mockSpanner.getRequestsOfType(ExecuteSqlRequest.class)) {
956+
assertTrue(request.hasTransaction());
957+
assertTrue(request.getTransaction().hasBegin());
958+
assertEquals(
959+
IsolationLevel.REPEATABLE_READ, request.getTransaction().getBegin().getIsolationLevel());
960+
}
950961
}
951962
}

src/test/java/com/google/cloud/spanner/pgadapter/SessionPoolSettingsTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.google.cloud.spanner.SessionPoolOptions;
2222
import com.google.spanner.v1.BatchCreateSessionsRequest;
23+
import com.google.spanner.v1.CreateSessionRequest;
2324
import java.sql.Connection;
2425
import java.sql.DriverManager;
2526
import java.sql.ResultSet;
@@ -44,6 +45,7 @@ public static void startMockSpannerAndPgAdapterServers() throws Exception {
4445
null,
4546
builder ->
4647
builder
48+
// The session pool has been removed and these settings are all deprecated.
4749
.setSessionPoolOptions(
4850
SessionPoolOptions.newBuilder()
4951
.setMinSessions(20)
@@ -68,11 +70,8 @@ public void testSessionPoolInitialization() throws SQLException {
6870
assertFalse(resultSet.next());
6971
}
7072
}
71-
// Check that the session pool options are honored.
72-
assertEquals(5, mockSpanner.countRequestsOfType(BatchCreateSessionsRequest.class));
73-
for (BatchCreateSessionsRequest createSessionsRequest :
74-
mockSpanner.getRequestsOfType(BatchCreateSessionsRequest.class)) {
75-
assertEquals(4, createSessionsRequest.getSessionCount());
76-
}
73+
// The Java client now always uses multiplexed sessions.
74+
assertEquals(1, mockSpanner.countRequestsOfType(CreateSessionRequest.class));
75+
assertEquals(0, mockSpanner.countRequestsOfType(BatchCreateSessionsRequest.class));
7776
}
7877
}

0 commit comments

Comments
 (0)