Skip to content

Commit

Permalink
Replace C2P resolver env var with experimental scheme suffix (#8744) (#…
Browse files Browse the repository at this point in the history
…8747)

Java analogue of grpc/grpc#28294
  • Loading branch information
apolcyn committed Dec 7, 2021
1 parent 2330922 commit 766ed87
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Expand Up @@ -29,9 +29,7 @@
@Internal
public final class GoogleCloudToProdNameResolverProvider extends NameResolverProvider {

private static final boolean enableC2PResolver =
Boolean.parseBoolean(System.getenv("GRPC_EXPERIMENTAL_GOOGLE_C2P_RESOLVER"));
private static final String SCHEME = "google-c2p";
private static final String SCHEME = "google-c2p-experimental";

@Override
public NameResolver newNameResolver(URI targetUri, Args args) {
Expand All @@ -50,10 +48,7 @@ public String getDefaultScheme() {

@Override
protected boolean isAvailable() {
if (enableC2PResolver) {
return true;
}
return false;
return true;
}

@Override
Expand Down
Expand Up @@ -73,7 +73,8 @@ NameResolverProvider.class, getClass().getClassLoader())) {

@Test
public void newNameResolver() {
assertThat(provider.newNameResolver(URI.create("google-c2p:///foo.googleapis.com"), args))
assertThat(provider
.newNameResolver(URI.create("google-c2p-experimental:///foo.googleapis.com"), args))
.isInstanceOf(GoogleCloudToProdNameResolver.class);
}
}
Expand Up @@ -69,7 +69,7 @@ public class GoogleCloudToProdNameResolverTest {
@Rule
public final MockitoRule mocks = MockitoJUnit.rule();

private static final URI TARGET_URI = URI.create("google-c2p:///googleapis.com");
private static final URI TARGET_URI = URI.create("google-c2p-experimental:///googleapis.com");
private static final String ZONE = "us-central1-a";
private static final int DEFAULT_PORT = 887;

Expand Down

0 comments on commit 766ed87

Please sign in to comment.