Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: re-adds method used in internal testing #438

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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