Skip to content

Commit

Permalink
Add retry policy using xds
Browse files Browse the repository at this point in the history
  • Loading branch information
arjan-bal committed Jun 27, 2024
1 parent 503a123 commit 471c9e3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions xds/internal/balancer/clusterimpl/tests/balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import (
v3lrspb "github.com/envoyproxy/go-control-plane/envoy/service/load_stats/v3"
testgrpc "google.golang.org/grpc/interop/grpc_testing"
testpb "google.golang.org/grpc/interop/grpc_testing"
"google.golang.org/protobuf/types/known/wrapperspb"

_ "google.golang.org/grpc/xds"
)
Expand Down Expand Up @@ -214,10 +215,15 @@ func (s) TestLoadReportingPickFirstMultiLocality(t *testing.T) {
routeConfigName := "route-" + serviceName
clusterName := "cluster-" + serviceName
endpointsName := "endpoints-" + serviceName
routePolicy := e2e.DefaultRouteConfig(routeConfigName, serviceName, clusterName)
routePolicy.VirtualHosts[0].RetryPolicy = &v3routepb.RetryPolicy{
RetryOn: "unavailable",
NumRetries: &wrapperspb.UInt32Value{Value: 1},
}
resources := e2e.UpdateOptions{
NodeID: nodeID,
Listeners: []*v3listenerpb.Listener{e2e.DefaultClientListener(serviceName, routeConfigName)},
Routes: []*v3routepb.RouteConfiguration{e2e.DefaultRouteConfig(routeConfigName, serviceName, clusterName)},
Routes: []*v3routepb.RouteConfiguration{routePolicy},
Clusters: []*v3clusterpb.Cluster{
{
Name: clusterName,
Expand Down Expand Up @@ -321,9 +327,9 @@ func (s) TestLoadReportingPickFirstMultiLocality(t *testing.T) {
// Stop server 1 and send one more rpc. Now the request should go to server 2.
server1.Stop()
// The first call may go to server 1 and fail, so we send two requests.
if _, err := client.EmptyCall(ctx, &testpb.Empty{}, grpc.Peer(&peer)); err != nil {
t.Logf("First rpc EmptyCall() failed: %v", err)
}
// if _, err := client.EmptyCall(ctx, &testpb.Empty{}, grpc.Peer(&peer)); err != nil {
// t.Logf("First rpc EmptyCall() failed: %v", err)
// }

if _, err := client.EmptyCall(ctx, &testpb.Empty{}, grpc.Peer(&peer)); err != nil {
t.Fatalf("rpc EmptyCall() failed: %v", err)
Expand Down

0 comments on commit 471c9e3

Please sign in to comment.