Skip to content
Permalink
Browse files
fix: re-adds method used in internal testing (#438)
We had removed a method from GapicSpannerRpc that was used in the internal testing infrastructure. We are adding this back for the time being.
  • Loading branch information
thiagotnunes committed Sep 18, 2020
1 parent fa5d3a5 commit c36e41bfaaf8026d2f6601ed12bfaa0d7a4ea802
@@ -1408,6 +1408,14 @@ private static <T> T get(final Future<T> future) throws SpannerException {
}
}

// Before removing this method, please verify with a code owner that it is not used
// in any internal testing infrastructure.
@VisibleForTesting
@Deprecated
GrpcCallContext newCallContext(@Nullable Map<Option, ?> options, String resource) {
return newCallContext(options, resource, null, null);
}

@VisibleForTesting
<ReqT, RespT> GrpcCallContext newCallContext(
@Nullable Map<Option, ?> options,
@@ -93,6 +93,7 @@
/** Tests that opening and closing multiple Spanner instances does not leak any threads. */
@RunWith(JUnit4.class)
public class GapicSpannerRpcTest {

private static final Statement SELECT1AND2 =
Statement.of("SELECT 1 AS COL1 UNION ALL SELECT 2 AS COL1");
private static final ResultSetMetadata SELECT1AND2_METADATA =
@@ -380,6 +381,7 @@ public void testNoCallCredentials() {
}

private static final class TimeoutHolder {

private Duration timeout;
}

@@ -454,6 +456,14 @@ public Long run(TransactionContext transaction) throws Exception {
}
}

@Test
public void testNewCallContextWithNullRequestAndNullMethod() {
SpannerOptions options = SpannerOptions.newBuilder().setProjectId("some-project").build();
GapicSpannerRpc rpc = new GapicSpannerRpc(options);
assertThat(rpc.newCallContext(optionsMap, "/some/resource", null, null)).isNotNull();
rpc.shutdown();
}

@SuppressWarnings("rawtypes")
private SpannerOptions createSpannerOptions() {
String endpoint = address.getHostString() + ":" + server.getPort();

0 comments on commit c36e41b

Please sign in to comment.