mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-06 05:37:36 +03:00
fix flaky server unit test
This commit is contained in:
parent
907071221c
commit
7b569ba071
1 changed files with 6 additions and 5 deletions
|
@ -507,7 +507,8 @@ var _ = Describe("Server", func() {
|
||||||
It("never blocks when calling the onHandshakeComplete callback", func() {
|
It("never blocks when calling the onHandshakeComplete callback", func() {
|
||||||
const num = 50
|
const num = 50
|
||||||
|
|
||||||
done := make(chan struct{}, num)
|
runs := make(chan struct{}, num)
|
||||||
|
contexts := make(chan struct{}, num)
|
||||||
serv.newSession = func(
|
serv.newSession = func(
|
||||||
_ connection,
|
_ connection,
|
||||||
runner sessionRunner,
|
runner sessionRunner,
|
||||||
|
@ -521,10 +522,9 @@ var _ = Describe("Server", func() {
|
||||||
_ protocol.VersionNumber,
|
_ protocol.VersionNumber,
|
||||||
) (quicSession, error) {
|
) (quicSession, error) {
|
||||||
sess := NewMockQuicSession(mockCtrl)
|
sess := NewMockQuicSession(mockCtrl)
|
||||||
sess.EXPECT().run().Do(func() {})
|
sess.EXPECT().run().Do(func() { runs <- struct{}{} })
|
||||||
sess.EXPECT().Context().Return(context.Background())
|
sess.EXPECT().Context().Do(func() { contexts <- struct{}{} }).Return(context.Background())
|
||||||
runner.OnHandshakeComplete(sess)
|
runner.OnHandshakeComplete(sess)
|
||||||
done <- struct{}{}
|
|
||||||
return sess, nil
|
return sess, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -534,7 +534,8 @@ var _ = Describe("Server", func() {
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
Eventually(done).Should(HaveLen(num))
|
Eventually(runs).Should(HaveLen(num))
|
||||||
|
Eventually(contexts).Should(HaveLen(num))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue