Skip to content

Commit

Permalink
chore(spanner): skip tests and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
harshachinta committed Dec 23, 2024
1 parent 64a93e5 commit 2c51c00
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ public void createSpannerInstance() {
SessionPoolOptions.newBuilder()
.setWaitForMinSessionsDuration(Duration.ofSeconds(5L))
.setFailOnSessionLeak()
.setSkipVerifyingBeginTransactionForMuxRW(true)
.build())
.setEnableApiTracing(true)
.build()
Expand Down Expand Up @@ -428,6 +429,7 @@ public boolean isEnableApiTracing() {
SessionPoolOptions.newBuilder()
.setWaitForMinSessionsDuration(Duration.ofSeconds(5L))
.setFailOnSessionLeak()
.setSkipVerifyingBeginTransactionForMuxRW(true)
.build())
.build()
.getService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public void createSpannerInstance() {
SessionPoolOptions.newBuilder()
.setWaitForMinSessionsDuration(Duration.ofSeconds(5L))
.setFailOnSessionLeak()
.setSkipVerifyingBeginTransactionForMuxRW(true)
.build())
// Setting this to false so that Spanner Options does not register Metrics Tracer
// factory again.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeFalse;

import com.google.cloud.spanner.MockSpannerServiceImpl;
import com.google.cloud.spanner.ResultSet;
Expand Down Expand Up @@ -111,6 +112,9 @@ Connection createTestConnection(String url) {
public void testSingleUseQuery_withoutSqlStatement() {
try (Connection connection = createTestConnection(getBaseUrl())) {
connection.setAutocommit(true);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
try (ResultSet resultSet = connection.executeQuery(SELECT1_STATEMENT)) {
assertTrue(resultSet.next());
assertFalse(resultSet.next());
Expand Down Expand Up @@ -149,6 +153,9 @@ public boolean isEnableExtendedTracing() {

try (Connection connection = createTestConnection(getBaseUrl())) {
connection.setAutocommit(true);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
try (ResultSet resultSet = connection.executeQuery(SELECT1_STATEMENT)) {
assertTrue(resultSet.next());
assertFalse(resultSet.next());
Expand Down Expand Up @@ -185,6 +192,9 @@ public boolean isEnableExtendedTracing() {
public void testSingleUseQuery() {
try (Connection connection = createTestConnection()) {
connection.setAutocommit(true);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
try (ResultSet resultSet = connection.executeQuery(SELECT1_STATEMENT)) {
assertTrue(resultSet.next());
assertFalse(resultSet.next());
Expand Down Expand Up @@ -220,6 +230,9 @@ public void testSingleUseUpdate() {
try (Connection connection = createTestConnection()) {
connection.setAutocommit(true);
connection.executeUpdate(INSERT_STATEMENT);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
}
assertEquals(CompletableResultCode.ofSuccess(), spanExporter.flush());
List<SpanData> spans = spanExporter.getFinishedSpanItems();
Expand Down Expand Up @@ -256,6 +269,9 @@ public void testSingleUseBatchUpdate() {
connection.executeUpdate(INSERT_STATEMENT);
connection.executeUpdate(INSERT_STATEMENT);
connection.runBatch();
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
}
assertEquals(CompletableResultCode.ofSuccess(), spanExporter.flush());
List<SpanData> spans = spanExporter.getFinishedSpanItems();
Expand Down Expand Up @@ -297,6 +313,9 @@ public void testSingleUseDdl() {

try (Connection connection = createTestConnection()) {
connection.setAutocommit(true);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
connection.execute(Statement.of(ddl));
}
assertEquals(CompletableResultCode.ofSuccess(), spanExporter.flush());
Expand All @@ -315,6 +334,9 @@ public void testSingleUseDdlBatch() {

try (Connection connection = createTestConnection()) {
connection.setAutocommit(true);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
connection.startBatchDdl();
connection.execute(Statement.of(ddl1));
connection.execute(Statement.of(ddl2));
Expand All @@ -332,6 +354,9 @@ public void testSingleUseDdlBatch() {
public void testMultiUseReadOnlyQueries() {
try (Connection connection = createTestConnection()) {
connection.setAutocommit(false);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
connection.setReadOnly(true);
twice(
() -> {
Expand Down Expand Up @@ -363,6 +388,9 @@ public void testMultiUseReadOnlyQueries() {
public void testMultiUseReadWriteQueries() {
try (Connection connection = createTestConnection()) {
connection.setAutocommit(false);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
connection.setReadOnly(false);
twice(
() -> {
Expand Down Expand Up @@ -397,6 +425,9 @@ public void testMultiUseReadWriteQueries() {
public void testMultiUseReadWriteUpdates() {
try (Connection connection = createTestConnection()) {
connection.setAutocommit(false);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
connection.setReadOnly(false);
assertEquals(1L, connection.executeUpdate(INSERT_STATEMENT));
assertEquals(1L, connection.executeUpdate(INSERT_STATEMENT));
Expand Down Expand Up @@ -426,6 +457,9 @@ public void testMultiUseReadWriteUpdates() {
public void testMultiUseReadWriteBatchUpdates() {
try (Connection connection = createTestConnection()) {
connection.setAutocommit(false);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
connection.setReadOnly(false);

twice(
Expand Down Expand Up @@ -466,6 +500,9 @@ public void testMultiUseReadWriteBatchUpdates() {
public void testMultiUseReadWriteAborted() {
try (Connection connection = createTestConnection()) {
connection.setAutocommit(false);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
connection.setReadOnly(false);
assertEquals(1L, connection.executeUpdate(INSERT_STATEMENT));
mockSpanner.abortNextStatement();
Expand Down Expand Up @@ -514,6 +551,9 @@ public void testSavepoint() {

try (Connection connection = createTestConnection()) {
connection.setAutocommit(false);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
connection.setReadOnly(false);
connection.setSavepointSupport(SavepointSupport.ENABLED);
assertEquals(1L, connection.executeUpdate(statement1));
Expand Down Expand Up @@ -563,6 +603,9 @@ public void testTransactionTag() {
try (Connection connection = createTestConnection()) {
connection.setAutocommit(false);
connection.setReadOnly(false);
assumeFalse(
"OpenTelemetryTracingTest handler is not implemented for read-write with multiplexed sessions",
isMultiplexedSessionsEnabledForRW(connection.getSpanner()));
connection.setTransactionTag("my_tag");
assertEquals(1L, connection.executeUpdate(INSERT_STATEMENT));
connection.commit();
Expand Down

0 comments on commit 2c51c00

Please sign in to comment.