Skip to content

Commit

Permalink
fix: re-adds method used in internal testing
Browse files Browse the repository at this point in the history
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 ba5a961
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Expand Up @@ -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,
Expand Down
Expand Up @@ -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 =
Expand Down Expand Up @@ -380,6 +381,7 @@ public void testNoCallCredentials() {
}

private static final class TimeoutHolder {

private Duration timeout;
}

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit ba5a961

Please sign in to comment.