Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xdsclient: Populate total_issued_requests count in LRS load report #7544

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions xds/internal/balancer/clusterimpl/balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,14 @@ func (s) TestDropByCategory(t *testing.T) {
if err != nil || gotSCSt.SubConn != sc1 {
return fmt.Errorf("picker.Pick, got %v, %v, want SubConn=%v", gotSCSt, err, sc1)
}
if gotSCSt.Done != nil {
if gotSCSt.Done == nil {
continue
}
// Fail half of the requests that are not dropped.
if i%4 == 1 {
gotSCSt.Done(balancer.DoneInfo{})
} else {
gotSCSt.Done(balancer.DoneInfo{Err: fmt.Errorf("test error")})
}
}
return nil
Expand All @@ -178,7 +184,8 @@ func (s) TestDropByCategory(t *testing.T) {
Drops: map[string]uint64{dropReason: dropCount},
LocalityStats: map[string]load.LocalityData{
assertString(xdsinternal.LocalityID{}.ToString): {RequestStats: load.RequestData{
Succeeded: rpcCount - dropCount,
Succeeded: (rpcCount - dropCount) / 2,
Errored: (rpcCount - dropCount) / 2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make it so these aren't the same? I.e. if we reversed the two in code then the test would still pass. E.g. make it fail 1/4th and succeed in 3/4ths.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Issued: rpcCount - dropCount,
}},
},
Expand Down Expand Up @@ -338,7 +345,9 @@ func (s) TestDropCircuitBreaking(t *testing.T) {
}
dones = append(dones, func() {
if gotSCSt.Done != nil {
gotSCSt.Done(balancer.DoneInfo{})
// Fail these requests to test error counts in the load
// report.
gotSCSt.Done(balancer.DoneInfo{Err: fmt.Errorf("test error")})
}
})
}
Expand All @@ -363,7 +372,8 @@ func (s) TestDropCircuitBreaking(t *testing.T) {
TotalDrops: uint64(maxRequest),
LocalityStats: map[string]load.LocalityData{
assertString(xdsinternal.LocalityID{}.ToString): {RequestStats: load.RequestData{
Succeeded: uint64(rpcCount - maxRequest + 50),
Succeeded: uint64(rpcCount - maxRequest),
Errored: 50,
Issued: uint64(rpcCount - maxRequest + 50),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there no tests that include failed calls? It would be nice to have at least one test case where succeeded != issued.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed a couple of test cases to have both errors and successful RPCs.

}},
},
Expand Down
Loading