From 0880cc672f0afe5faca44e58ddab4d7aa9f82c0c Mon Sep 17 00:00:00 2001 From: Romain Date: Thu, 23 Oct 2025 11:28:04 +0200 Subject: [PATCH] Mitigate TestShutdownUDPConn flakyness --- pkg/server/server_entrypoint_udp_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/server/server_entrypoint_udp_test.go b/pkg/server/server_entrypoint_udp_test.go index 6deed527e..c66a7d9dc 100644 --- a/pkg/server/server_entrypoint_udp_test.go +++ b/pkg/server/server_entrypoint_udp_test.go @@ -53,12 +53,18 @@ func TestShutdownUDPConn(t *testing.T) { // Start sending packets, to create a "session" with the server. requireEcho(t, "TEST", conn, time.Second) + shutdownStartedChan := make(chan struct{}) doneChan := make(chan struct{}) go func() { + close(shutdownStartedChan) entryPoint.Shutdown(t.Context()) close(doneChan) }() + // Wait until shutdown has started, and hopefully after 100 ms the listener has stopped accepting new sessions. + <-shutdownStartedChan + time.Sleep(100 * time.Millisecond) + // Make sure that our session is still live even after the shutdown. requireEcho(t, "TEST2", conn, time.Second)