Skip to content

Commit b738469

Browse files
committed
Add retry policy using xds
1 parent 503a123 commit b738469

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

xds/internal/balancer/clusterimpl/tests/balancer_test.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import (
4949
v3lrspb "github.com/envoyproxy/go-control-plane/envoy/service/load_stats/v3"
5050
testgrpc "google.golang.org/grpc/interop/grpc_testing"
5151
testpb "google.golang.org/grpc/interop/grpc_testing"
52+
"google.golang.org/protobuf/types/known/wrapperspb"
5253

5354
_ "google.golang.org/grpc/xds"
5455
)
@@ -214,10 +215,15 @@ func (s) TestLoadReportingPickFirstMultiLocality(t *testing.T) {
214215
routeConfigName := "route-" + serviceName
215216
clusterName := "cluster-" + serviceName
216217
endpointsName := "endpoints-" + serviceName
218+
routePolicy := e2e.DefaultRouteConfig(routeConfigName, serviceName, clusterName)
219+
routePolicy.VirtualHosts[0].RetryPolicy = &v3routepb.RetryPolicy{
220+
RetryOn: "unavailable",
221+
NumRetries: &wrapperspb.UInt32Value{Value: 1},
222+
}
217223
resources := e2e.UpdateOptions{
218224
NodeID: nodeID,
219225
Listeners: []*v3listenerpb.Listener{e2e.DefaultClientListener(serviceName, routeConfigName)},
220-
Routes: []*v3routepb.RouteConfiguration{e2e.DefaultRouteConfig(routeConfigName, serviceName, clusterName)},
226+
Routes: []*v3routepb.RouteConfiguration{routePolicy},
221227
Clusters: []*v3clusterpb.Cluster{
222228
{
223229
Name: clusterName,
@@ -319,12 +325,8 @@ func (s) TestLoadReportingPickFirstMultiLocality(t *testing.T) {
319325
}
320326

321327
// Stop server 1 and send one more rpc. Now the request should go to server 2.
322-
server1.Stop()
323-
// The first call may go to server 1 and fail, so we send two requests.
324-
if _, err := client.EmptyCall(ctx, &testpb.Empty{}, grpc.Peer(&peer)); err != nil {
325-
t.Logf("First rpc EmptyCall() failed: %v", err)
326-
}
327328

329+
server1.Stop()
328330
if _, err := client.EmptyCall(ctx, &testpb.Empty{}, grpc.Peer(&peer)); err != nil {
329331
t.Fatalf("rpc EmptyCall() failed: %v", err)
330332
}

0 commit comments

Comments
 (0)