fix flaky HTTP/3 client unit test

This commit is contained in:
Marten Seemann 2019-10-01 10:13:46 +07:00
parent 3fff444db3
commit 393695d774

View file

@ -309,9 +309,9 @@ var _ = Describe("Client", func() {
canceled := make(chan struct{})
gomock.InOrder(
str.EXPECT().CancelWrite(quic.ErrorCode(errorRequestCanceled)).Do(func(quic.ErrorCode) { close(canceled) }),
str.EXPECT().CancelWrite(gomock.Any()).MaxTimes(1).Do(func(quic.ErrorCode) { close(done) }),
str.EXPECT().CancelRead(quic.ErrorCode(errorRequestCanceled)).Do(func(quic.ErrorCode) { close(done) }),
)
str.EXPECT().CancelRead(quic.ErrorCode(errorRequestCanceled))
str.EXPECT().CancelWrite(gomock.Any()).MaxTimes(1)
str.EXPECT().Read(gomock.Any()).DoAndReturn(func([]byte) (int, error) {
cancel()
<-canceled