diff --git a/xds/internal/balancer/edsbalancer/eds_impl_test.go b/xds/internal/balancer/edsbalancer/eds_impl_test.go index 9db07cf1fa72..056494475a5e 100644 --- a/xds/internal/balancer/edsbalancer/eds_impl_test.go +++ b/xds/internal/balancer/edsbalancer/eds_impl_test.go @@ -808,27 +808,13 @@ func (s) TestEDS_LoadReport(t *testing.T) { // In the remaining RPCs, only cbMaxRequests are allowed by circuit // breaking. Others will be dropped by CB. dropWithCB = rpcCount - dropWithCategory - cbMaxRequests - - rpcInProgress = cbMaxRequests / 2 // 50% of RPCs will be never done. - rpcSucceeded = cbMaxRequests / 2 // 50% of RPCs will succeed. ) - wantStoreData := []*load.Data{{ - Cluster: testClusterNames[0], - Service: "", - LocalityStats: map[string]load.LocalityData{ - locality1JSON: {RequestStats: load.RequestData{InProgress: rpcInProgress}}, - locality2JSON: {RequestStats: load.RequestData{Succeeded: rpcSucceeded}}, - }, - TotalDrops: dropWithCategory + dropWithCB, - Drops: map[string]uint64{ - testDropCategory: dropWithCategory, - }, - }} var rpcsToBeDone []balancer.PickResult // Run the picks, but only pick with sc1 will be done later. for i := 0; i < rpcCount; i++ { - scst, _ := p1.Pick(balancer.PickInfo{}) + scst, err := p1.Pick(balancer.PickInfo{}) + fmt.Println(i, scst, err) if scst.Done != nil && scst.SubConn != sc1 { rpcsToBeDone = append(rpcsToBeDone, scst) } @@ -837,6 +823,23 @@ func (s) TestEDS_LoadReport(t *testing.T) { for _, scst := range rpcsToBeDone { scst.Done(balancer.DoneInfo{}) } + var ( + rpcSucceeded = len(rpcsToBeDone) + rpcInProgress = rpcCount - dropWithCategory - dropWithCB - rpcSucceeded + ) + + wantStoreData := []*load.Data{{ + Cluster: testClusterNames[0], + Service: "", + LocalityStats: map[string]load.LocalityData{ + locality1JSON: {RequestStats: load.RequestData{InProgress: uint64(rpcInProgress)}}, + locality2JSON: {RequestStats: load.RequestData{Succeeded: uint64(rpcSucceeded)}}, + }, + TotalDrops: dropWithCategory + dropWithCB, + Drops: map[string]uint64{ + testDropCategory: dropWithCategory, + }, + }} gotStoreData := loadStore.Stats(testClusterNames[0:1]) if diff := cmp.Diff(wantStoreData, gotStoreData, cmpopts.EquateEmpty(), cmpopts.IgnoreFields(load.Data{}, "ReportInterval")); diff != "" {