From adcb1ea5defed8cb15acb3099395963445af31e6 Mon Sep 17 00:00:00 2001 From: Marten Seemann Date: Tue, 6 Jul 2021 10:31:46 -0700 Subject: [PATCH] fix flaky INVALID_TOKEN server test --- server_test.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server_test.go b/server_test.go index 80f199c1..57a4dfbe 100644 --- a/server_test.go +++ b/server_test.go @@ -568,10 +568,12 @@ var _ = Describe("Server", func() { packet := getPacket(hdr, make([]byte, protocol.MinInitialPacketSize)) packet.data[len(packet.data)-10] ^= 0xff // corrupt the packet packet.remoteAddr = &net.UDPAddr{IP: net.IPv4(127, 0, 0, 1), Port: 1337} - tracer.EXPECT().DroppedPacket(packet.remoteAddr, logging.PacketTypeInitial, packet.Size(), logging.PacketDropPayloadDecryptError) + done := make(chan struct{}) + tracer.EXPECT().DroppedPacket(packet.remoteAddr, logging.PacketTypeInitial, packet.Size(), logging.PacketDropPayloadDecryptError).Do(func(net.Addr, logging.PacketType, protocol.ByteCount, logging.PacketDropReason) { close(done) }) serv.handlePacket(packet) // make sure there are no Write calls on the packet conn time.Sleep(50 * time.Millisecond) + Eventually(done).Should(BeClosed()) }) It("creates a session, if no Token is required", func() {