Skip to content

Commit

Permalink
xds: remove GRPC_XDS_EXPERIMENTAL_ROUTING flag
Browse files Browse the repository at this point in the history
  • Loading branch information
dapengzhang0 authored and dfawley committed Jan 15, 2021
1 parent d1f8f6b commit 68d8b16
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 58 deletions.
15 changes: 0 additions & 15 deletions xds/src/main/java/io/grpc/xds/XdsClientImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import com.google.common.base.Stopwatch;
import com.google.common.base.Supplier;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.protobuf.Any;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.MessageOrBuilder;
Expand Down Expand Up @@ -111,10 +110,6 @@ final class XdsClientImpl extends XdsClient {
private static final String ADS_TYPE_URL_EDS =
"type.googleapis.com/envoy.config.endpoint.v3.ClusterLoadAssignment";

// Mutable for testing.
static boolean enableExperimentalRouting = Boolean.parseBoolean(
System.getenv("GRPC_XDS_EXPERIMENTAL_ROUTING"));

private final MessagePrinter respPrinter = new MessagePrinter();

private final InternalLogId logId;
Expand Down Expand Up @@ -889,16 +884,6 @@ static List<EnvoyProtoData.Route> populateRoutesInVirtualHost(VirtualHost virtua
throw new InvalidProtoDataException(
"Virtual host [" + virtualHost.getName() + "] contains no usable route");
}

if (!enableExperimentalRouting) {
EnvoyProtoData.Route defaultRoute = Iterables.getLast(routes);
if (!defaultRoute.isDefaultRoute()) {
throw new InvalidProtoDataException(
"Virtual host [" + virtualHost.getName()
+ "] contains non-default route as the last route");
}
return Collections.singletonList(defaultRoute);
}
return Collections.unmodifiableList(routes);
}

Expand Down
35 changes: 0 additions & 35 deletions xds/src/test/java/io/grpc/xds/XdsClientImplTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ ManagedChannel createChannel(List<ServerInfo> servers) {

@After
public void tearDown() {
XdsClientImpl.enableExperimentalRouting = false;
xdsClient.shutdown();
assertThat(adsEnded.get()).isTrue();
assertThat(lrsEnded.get()).isTrue();
Expand Down Expand Up @@ -647,7 +646,6 @@ public void resolveVirtualHostInRdsResponse() {
*/
@Test
public void resolveVirtualHostWithPathMatchingInRdsResponse() {
XdsClientImpl.enableExperimentalRouting = true;
xdsClient.watchConfigData(TARGET_AUTHORITY, configWatcher);
StreamObserver<DiscoveryResponse> responseObserver = responseObservers.poll();
StreamObserver<DiscoveryRequest> requestObserver = requestObservers.poll();
Expand Down Expand Up @@ -3430,25 +3428,6 @@ public void populateRoutesInVirtualHost_routeWithCaseInsensitiveMatch() {
XdsClientImpl.populateRoutesInVirtualHost(virtualHost);
}

@Test
public void populateRoutesInVirtualHost_lastRouteIsNotDefaultRoute() {
VirtualHost virtualHost =
VirtualHost.newBuilder()
.setName("virtualhost00.googleapis.com") // don't care
.addDomains(TARGET_AUTHORITY)
.addRoutes(
Route.newBuilder()
.setRoute(RouteAction.newBuilder().setCluster("cluster.googleapis.com"))
.setMatch(
RouteMatch.newBuilder()
.setPrefix("/service/method")
.setCaseSensitive(BoolValue.newBuilder().setValue(true))))
.build();

thrown.expect(XdsClientImpl.InvalidProtoDataException.class);
XdsClientImpl.populateRoutesInVirtualHost(virtualHost);
}

@Test
public void populateRoutesInVirtualHost_NoUsableRoute() {
VirtualHost virtualHost =
Expand Down Expand Up @@ -3514,13 +3493,6 @@ public void messagePrinter_printLdsResponse() {
+ " \"prefix\": \"\"\n"
+ " },\n"
+ " \"route\": {\n"
+ " \"cluster\": \"whatever cluster\"\n"
+ " }\n"
+ " }, {\n"
+ " \"match\": {\n"
+ " \"prefix\": \"\"\n"
+ " },\n"
+ " \"route\": {\n"
+ " \"cluster\": \"cluster.googleapis.com\"\n"
+ " }\n"
+ " }]\n"
Expand Down Expand Up @@ -3564,13 +3536,6 @@ public void messagePrinter_printRdsResponse() {
+ " \"prefix\": \"\"\n"
+ " },\n"
+ " \"route\": {\n"
+ " \"cluster\": \"whatever cluster\"\n"
+ " }\n"
+ " }, {\n"
+ " \"match\": {\n"
+ " \"prefix\": \"\"\n"
+ " },\n"
+ " \"route\": {\n"
+ " \"cluster\": \"cluster.googleapis.com\"\n"
+ " }\n"
+ " }]\n"
Expand Down
5 changes: 0 additions & 5 deletions xds/src/test/java/io/grpc/xds/XdsClientTestHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,6 @@ static VirtualHost buildVirtualHost(List<String> domains, String clusterName) {
.setName("virtualhost00.googleapis.com") // don't care
.addAllDomains(domains)
.addRoutes(
Route.newBuilder()
.setRoute(RouteAction.newBuilder().setCluster("whatever cluster"))
.setMatch(RouteMatch.newBuilder().setPrefix("")))
.addRoutes(
// Only the last (default) route matters.
Route.newBuilder()
.setRoute(RouteAction.newBuilder().setCluster(clusterName))
.setMatch(RouteMatch.newBuilder().setPrefix("")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ public BootstrapInfo readBootstrap() {
@After
public void tearDown() {
xdsNameResolver.shutdown();
XdsClientImpl.enableExperimentalRouting = false;
}

@Test
Expand Down Expand Up @@ -352,7 +351,6 @@ public void resolve_cdsLoadBalancing() {
@Test
@SuppressWarnings("unchecked")
public void resolve_xdsRoutingLoadBalancing() {
XdsClientImpl.enableExperimentalRouting = true;
xdsNameResolver.start(mockListener);
assertThat(responseObservers).hasSize(1);
StreamObserver<DiscoveryResponse> responseObserver = responseObservers.poll();
Expand Down Expand Up @@ -453,7 +451,6 @@ public void resolve_xdsRoutingLoadBalancing() {
@SuppressWarnings("unchecked")
@Test
public void resolve_weightedTargetLoadBalancing() {
XdsClientImpl.enableExperimentalRouting = true;
xdsNameResolver.start(mockListener);
assertThat(responseObservers).hasSize(1);
StreamObserver<DiscoveryResponse> responseObserver = responseObservers.poll();
Expand Down

0 comments on commit 68d8b16

Please sign in to comment.