mirror of https://github.com/grpc/grpc-go.git
xds/xdsclient: Fix flaky test TestLRSClient (#7559)
This commit is contained in:
parent
cfd14baa82
commit
6d976887d4
|
|
@ -132,8 +132,20 @@ func (s) TestLRSClient(t *testing.T) {
|
||||||
// Cancel this load reporting stream, server should see error canceled.
|
// Cancel this load reporting stream, server should see error canceled.
|
||||||
lrsCancel2()
|
lrsCancel2()
|
||||||
|
|
||||||
// Server should receive a stream canceled error.
|
// Server should receive a stream canceled error. There may be additional
|
||||||
if u, err := fs2.LRSRequestChan.Receive(ctx); err != nil || status.Code(u.(*fakeserver.Request).Err) != codes.Canceled {
|
// load reports from the client in the channel.
|
||||||
t.Errorf("unexpected LRS request: %v, %v, want error canceled", u, err)
|
for {
|
||||||
|
u, err := fs2.LRSRequestChan.Receive(ctx)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("unexpected error while reading LRS request: %v", err)
|
||||||
|
}
|
||||||
|
// Ignore load reports sent before the stream was cancelled.
|
||||||
|
if u.(*fakeserver.Request).Err == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if status.Code(u.(*fakeserver.Request).Err) != codes.Canceled {
|
||||||
|
t.Errorf("unexpected LRS request: %v, want error canceled", u)
|
||||||
|
}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue