diff --git a/xds/src/main/java/io/grpc/xds/BootstrapperImpl.java b/xds/src/main/java/io/grpc/xds/BootstrapperImpl.java index c83eb7b617..5b5710e1c3 100644 --- a/xds/src/main/java/io/grpc/xds/BootstrapperImpl.java +++ b/xds/src/main/java/io/grpc/xds/BootstrapperImpl.java @@ -59,9 +59,6 @@ public class BootstrapperImpl implements Bootstrapper { static String bootstrapConfigFromSysProp = System.getProperty(BOOTSTRAP_CONFIG_SYS_PROPERTY_VAR); private static final String XDS_V3_SERVER_FEATURE = "xds_v3"; @VisibleForTesting - static boolean enableV3Protocol = Boolean.parseBoolean( - System.getenv("GRPC_XDS_EXPERIMENTAL_V3_SUPPORT")); - @VisibleForTesting static final String CLIENT_FEATURE_DISABLE_OVERPROVISIONING = "envoy.lb.does_not_support_overprovisioning"; @@ -176,8 +173,7 @@ public class BootstrapperImpl implements Bootstrapper { List serverFeatures = JsonUtil.getListOfStrings(serverConfig, "server_features"); if (serverFeatures != null) { logger.log(XdsLogLevel.INFO, "Server features: {0}", serverFeatures); - useProtocolV3 = enableV3Protocol - && serverFeatures.contains(XDS_V3_SERVER_FEATURE); + useProtocolV3 = serverFeatures.contains(XDS_V3_SERVER_FEATURE); } servers.add(new ServerInfo(serverUri, channelCredentials, useProtocolV3)); } diff --git a/xds/src/test/java/io/grpc/xds/BootstrapperImplTest.java b/xds/src/test/java/io/grpc/xds/BootstrapperImplTest.java index a208faf98a..5744931ee3 100644 --- a/xds/src/test/java/io/grpc/xds/BootstrapperImplTest.java +++ b/xds/src/test/java/io/grpc/xds/BootstrapperImplTest.java @@ -56,7 +56,6 @@ public class BootstrapperImplTest { private String originalBootstrapPathFromSysProp; private String originalBootstrapConfigFromEnvVar; private String originalBootstrapConfigFromSysProp; - private boolean originalEnableV3Protocol; @Before public void setUp() { @@ -69,7 +68,6 @@ public class BootstrapperImplTest { originalBootstrapPathFromSysProp = BootstrapperImpl.bootstrapPathFromSysProp; originalBootstrapConfigFromEnvVar = BootstrapperImpl.bootstrapConfigFromEnvVar; originalBootstrapConfigFromSysProp = BootstrapperImpl.bootstrapConfigFromSysProp; - originalEnableV3Protocol = BootstrapperImpl.enableV3Protocol; } @After @@ -78,7 +76,6 @@ public class BootstrapperImplTest { BootstrapperImpl.bootstrapPathFromSysProp = originalBootstrapPathFromSysProp; BootstrapperImpl.bootstrapConfigFromEnvVar = originalBootstrapConfigFromEnvVar; BootstrapperImpl.bootstrapConfigFromSysProp = originalBootstrapConfigFromSysProp; - BootstrapperImpl.enableV3Protocol = originalEnableV3Protocol; } @Test @@ -567,7 +564,7 @@ public class BootstrapperImplTest { + " \"channel_creds\": [\n" + " {\"type\": \"insecure\"}\n" + " ],\n" - + " \"server_features\": [\"xds_v3\"]\n" + + " \"server_features\": []\n" + " }\n" + " ]\n" + "}"; @@ -581,17 +578,7 @@ public class BootstrapperImplTest { } @Test - public void supportV3Protocol_disabledByDefault() throws XdsInitializationException { - subtestSupportV3Protocol(false); - } - - @Test - public void supportV3Protocol_enabled() throws XdsInitializationException { - BootstrapperImpl.enableV3Protocol = true; - subtestSupportV3Protocol(true); - } - - private void subtestSupportV3Protocol(boolean enabled) throws XdsInitializationException { + public void useV3ProtocolIfV3FeaturePresent() throws XdsInitializationException { String rawData = "{\n" + " \"xds_servers\": [\n" + " {\n" @@ -609,11 +596,7 @@ public class BootstrapperImplTest { ServerInfo serverInfo = Iterables.getOnlyElement(info.getServers()); assertThat(serverInfo.getTarget()).isEqualTo(SERVER_URI); assertThat(serverInfo.getChannelCredentials()).isInstanceOf(InsecureChannelCredentials.class); - if (enabled) { - assertThat(serverInfo.isUseProtocolV3()).isTrue(); - } else { - assertThat(serverInfo.isUseProtocolV3()).isFalse(); - } + assertThat(serverInfo.isUseProtocolV3()).isTrue(); } @Test