http3: fix another flaky Extended CONNECT test (#4539)

This commit is contained in:
Marten Seemann
2024-05-29 13:57:43 +08:00
committed by GitHub
parent 8a3d90fc22
commit 82a3847439

View File

@@ -384,9 +384,12 @@ var _ = Describe("Client", func() {
It("checks the server's SETTINGS before sending an Extended CONNECT request", 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)
@@ -397,6 +400,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)
@@ -414,6 +418,7 @@ var _ = Describe("Client", func() {
// test shutdown
conn.EXPECT().CloseWithError(gomock.Any(), gomock.Any()).MaxTimes(1)
close(done)
wg.Wait()
})
It("rejects Extended CONNECT requests if the server doesn't enable it", func() {