Skip to content

Commit

Permalink
http3: fix flaky Extended CONNECT unit test (#4537)
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed May 28, 2024
1 parent 21b643e commit ae90c76
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions http3/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,12 @@ var _ = Describe("Client", func() {
It("rejects Extended CONNECT requests if the server doesn't enable it", func() {
sendSettings()
done := make(chan struct{})
var wg sync.WaitGroup
wg.Add(2)
conn := mockquic.NewMockEarlyConnection(mockCtrl)
conn.EXPECT().OpenUniStream().DoAndReturn(func() (quic.SendStream, error) {
<-done
wg.Done()
return nil, errors.New("test done")
}).MaxTimes(1)
b := quicvarint.Append(nil, streamTypeControlStream)
Expand All @@ -432,6 +435,7 @@ var _ = Describe("Client", func() {
conn.EXPECT().AcceptUniStream(gomock.Any()).Return(controlStr, nil)
conn.EXPECT().AcceptUniStream(gomock.Any()).DoAndReturn(func(context.Context) (quic.ReceiveStream, error) {
<-done
wg.Done()
return nil, errors.New("test done")
})
conn.EXPECT().HandshakeComplete().Return(handshakeChan)
Expand All @@ -448,6 +452,7 @@ var _ = Describe("Client", func() {
// test shutdown
conn.EXPECT().CloseWithError(gomock.Any(), gomock.Any()).MaxTimes(1)
close(done)
wg.Wait()
})
})

Expand Down

0 comments on commit ae90c76

Please sign in to comment.