reenable previously disabled server unit test (#4328)

This commit is contained in:
Marten Seemann 2024-02-11 09:44:43 +07:00 committed by GitHub
parent 07a17ffffb
commit 69fe37885f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -601,8 +601,8 @@ var _ = Describe("Server", func() {
Consistently(func() uint32 { return counter.Load() }).Should(BeEquivalentTo(protocol.MaxServerUnprocessedPackets + 1)) Consistently(func() uint32 { return counter.Load() }).Should(BeEquivalentTo(protocol.MaxServerUnprocessedPackets + 1))
}) })
PIt("only creates a single connection for a duplicate Initial", func() { It("only creates a single connection for a duplicate Initial", func() {
var createdConn bool done := make(chan struct{})
serv.newConn = func( serv.newConn = func(
_ sendConn, _ sendConn,
runner connRunner, runner connRunner,
@ -622,19 +622,20 @@ var _ = Describe("Server", func() {
_ utils.Logger, _ utils.Logger,
_ protocol.Version, _ protocol.Version,
) quicConn { ) quicConn {
createdConn = true conn := NewMockQUICConn(mockCtrl)
return NewMockQUICConn(mockCtrl) conn.EXPECT().handlePacket(gomock.Any())
conn.EXPECT().closeWithTransportError(qerr.ConnectionRefused).Do(func(qerr.TransportErrorCode) {
close(done)
})
return conn
} }
connID := protocol.ParseConnectionID([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9}) connID := protocol.ParseConnectionID([]byte{1, 2, 3, 4, 5, 6, 7, 8, 9})
p := getInitial(connID) p := getInitial(connID)
phm.EXPECT().Get(connID) phm.EXPECT().Get(connID)
phm.EXPECT().GetStatelessResetToken(gomock.Any())
phm.EXPECT().AddWithConnID(connID, gomock.Any(), gomock.Any()).Return(false) // connection ID collision phm.EXPECT().AddWithConnID(connID, gomock.Any(), gomock.Any()).Return(false) // connection ID collision
tracer.EXPECT().SentPacket(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any())
done := make(chan struct{})
conn.EXPECT().WriteTo(gomock.Any(), gomock.Any()).Do(func([]byte, net.Addr) (int, error) { close(done); return 0, nil })
Expect(serv.handlePacketImpl(p)).To(BeTrue()) Expect(serv.handlePacketImpl(p)).To(BeTrue())
Expect(createdConn).To(BeFalse())
Eventually(done).Should(BeClosed()) Eventually(done).Should(BeClosed())
}) })