From e11ac70665c9fd5e7f7d3008f3f214792f737077 Mon Sep 17 00:00:00 2001 From: Mathias Fredriksson Date: Wed, 9 Apr 2025 16:38:20 +0000 Subject: [PATCH] test(agent/agentssh): fix macos signal flake during close I haven't been able to verify this fix, but I'm hoping this'll do it. Fixes coder/internal#558 --- agent/agentssh/agentssh_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/agent/agentssh/agentssh_test.go b/agent/agentssh/agentssh_test.go index 69f92e0fd31a0..ae1aaa92f2ffd 100644 --- a/agent/agentssh/agentssh_test.go +++ b/agent/agentssh/agentssh_test.go @@ -13,6 +13,7 @@ import ( "strings" "sync" "testing" + "time" "github.com/prometheus/client_golang/prometheus" "github.com/spf13/afero" @@ -200,7 +201,11 @@ func TestNewServer_CloseActiveConnections(t *testing.T) { } assert.NoError(t, err) + // Allow the session to settle (i.e. reach echo). pty.ExpectMatchContext(ctx, "started") + // Sleep a bit to ensure the sleep has started. + time.Sleep(testutil.IntervalMedium) + close(ch) err = sess.Wait()