From ebad5c3ed02a294bc9b0aa0a431a028dd04296f4 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Tue, 6 May 2025 14:20:28 +0300 Subject: [PATCH] test(agent): fix channel timeout in TestNewServer_CloseActiveConnections (#17690) This fixes a test issue where we were waiting on a channel indefinitely and the test timed out instead of failing due to earlier error. Updates coder/internal#558 --- agent/agentssh/agentssh_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/agent/agentssh/agentssh_test.go b/agent/agentssh/agentssh_test.go index ae1aaa92f2..23d9dcc7da 100644 --- a/agent/agentssh/agentssh_test.go +++ b/agent/agentssh/agentssh_test.go @@ -214,7 +214,11 @@ func TestNewServer_CloseActiveConnections(t *testing.T) { } for _, ch := range waitConns { - <-ch + select { + case <-ctx.Done(): + t.Fatal("timeout") + case <-ch: + } } return s, wg.Wait