Skip to content

Commit

Permalink
deps: bump Spanner to 6.72.0 (#1698)
Browse files Browse the repository at this point in the history
  • Loading branch information
olavloite authored Aug 7, 2024
1 parent 828aff6 commit ce00b17
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-spanner-bom</artifactId>
<version>6.71.0</version>
<version>6.72.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.google.cloud.spanner.jdbc;

import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import com.google.cloud.spanner.connection.AbstractMockServerTest;
Expand Down Expand Up @@ -103,7 +103,10 @@ public void testMaxSessions()
executor1.shutdown();
executor2.shutdown();
}
assertThat(mockSpanner.numSessionsCreated()).isEqualTo(1);
assertEquals(1, mockSpanner.countRequestsOfType(BatchCreateSessionsRequest.class));
BatchCreateSessionsRequest request =
mockSpanner.getRequestsOfType(BatchCreateSessionsRequest.class).get(0);
assertEquals(1, request.getSessionCount());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.google.cloud.spanner.MockSpannerServiceImpl.StatementResult;
import com.google.cloud.spanner.connection.AbstractMockServerTest;
import com.google.cloud.spanner.connection.SpannerPool;
import com.google.spanner.v1.BatchCreateSessionsRequest;
import com.google.spanner.v1.CreateSessionRequest;
import com.google.spanner.v1.ExecuteSqlRequest;
import com.google.spanner.v1.Session;
Expand Down Expand Up @@ -188,8 +189,6 @@ public void testUsesRegularSessionForQueryInTransaction() throws SQLException {
public void testUsesMultiplexedSessionInCombinationWithSessionPoolOptions() throws SQLException {
// Create a connection that uses a session pool with MinSessions=0.
// This should stop any regular sessions from being created.
// TODO: Modify this test once https://github.com/googleapis/java-spanner/pull/3197 has been
// released.
try (Connection connection = DriverManager.getConnection(createUrl() + ";minSessions=0")) {
assertTrue(connection.getAutoCommit());
try (ResultSet resultSet = connection.createStatement().executeQuery(SELECT_RANDOM_SQL)) {
Expand All @@ -199,19 +198,14 @@ public void testUsesMultiplexedSessionInCombinationWithSessionPoolOptions() thro
}
}
}
// TODO: Remove this line once https://github.com/googleapis/java-spanner/pull/3197 has been
// released.
// Adding 'minSessions=X' or 'maxSessions=x' to the connection URL currently disables the use of
// multiplexed sessions due to a bug in the Spanner Java client.
assertEquals(0, mockSpanner.countRequestsOfType(CreateSessionRequest.class));

// Verify that one multiplexed session was created and used.
// TODO: Uncomment
// assertEquals(1, mockSpanner.countRequestsOfType(CreateSessionRequest.class));
// CreateSessionRequest request =
// mockSpanner.getRequestsOfType(CreateSessionRequest.class).get(0);
// assertTrue(request.getSession().getMultiplexed());
// // There should be no regular sessions in use.
// assertEquals(0, mockSpanner.countRequestsOfType(BatchCreateSessionsRequest.class));
assertEquals(1, mockSpanner.countRequestsOfType(CreateSessionRequest.class));
CreateSessionRequest request = mockSpanner.getRequestsOfType(CreateSessionRequest.class).get(0);
assertTrue(request.getSession().getMultiplexed());
// There should be no regular sessions in use.
// However, the query that detects the dialect that is used, uses a regular session.
// This should be fixed in the Java client.
assertEquals(1, mockSpanner.countRequestsOfType(BatchCreateSessionsRequest.class));
}
}

0 comments on commit ce00b17

Please sign in to comment.