forked from quic-go/quic-go
fix flaky server unit test
This commit is contained in:
@@ -806,19 +806,14 @@ var _ = Describe("Server", func() {
|
|||||||
return sess
|
return sess
|
||||||
}
|
}
|
||||||
|
|
||||||
var wg sync.WaitGroup
|
phm.EXPECT().GetStatelessResetToken(gomock.Any()).Times(protocol.MaxAcceptQueueSize)
|
||||||
wg.Add(protocol.MaxAcceptQueueSize)
|
phm.EXPECT().Add(gomock.Any(), gomock.Any()).Return(true).Times(2 * protocol.MaxAcceptQueueSize)
|
||||||
for i := 0; i < protocol.MaxAcceptQueueSize; i++ {
|
for i := 0; i < protocol.MaxAcceptQueueSize; i++ {
|
||||||
go func() {
|
|
||||||
defer GinkgoRecover()
|
|
||||||
defer wg.Done()
|
|
||||||
phm.EXPECT().GetStatelessResetToken(gomock.Any())
|
|
||||||
phm.EXPECT().Add(gomock.Any(), gomock.Any()).Return(true).Times(2)
|
|
||||||
serv.handlePacket(getInitialWithRandomDestConnID())
|
serv.handlePacket(getInitialWithRandomDestConnID())
|
||||||
Consistently(conn.dataWritten).ShouldNot(Receive())
|
|
||||||
}()
|
|
||||||
}
|
}
|
||||||
wg.Wait()
|
|
||||||
|
Eventually(func() int32 { return atomic.LoadInt32(&serv.sessionQueueLen) }).Should(BeEquivalentTo(protocol.MaxAcceptQueueSize))
|
||||||
|
Consistently(conn.dataWritten).ShouldNot(Receive())
|
||||||
|
|
||||||
p := getInitialWithRandomDestConnID()
|
p := getInitialWithRandomDestConnID()
|
||||||
hdr := parseHeader(p.data)
|
hdr := parseHeader(p.data)
|
||||||
|
|||||||
Reference in New Issue
Block a user