From 9531cdc631d6d511c54555b1ba43375012cdbdfe Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 3 Nov 2026 21:27:58 +0000 Subject: [PATCH] test(slack): wait for the old link to drop before the restart reply The restart spec closed the first runtime and started a second one at once. The fake server lists a link until its handler sees the socket close, so Connected was already true for the old link, and the reply the spec pushed next went to the closing socket and was lost. The spec failed on every run with one CPU and on about one run in three with more. Wait until the fake reports no link before the second runtime starts. 30 runs each at 1, 4 and 20 CPUs under -race now pass, also with six copies running at once. Assisted-by: Claude:claude-sonnet-5-5 go-test --- addons/slack/transport/follow_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/slack/transport/follow_test.go b/addons/slack/transport/follow_test.go index 3d95c9f9fe..3a39fe6c00 100644 --- a/addons/slack/transport/follow_test.go +++ b/addons/slack/transport/follow_test.go @@ -131,6 +131,10 @@ var _ = Describe("which threads the bot follows", func() { info, _ := os.Stat(path) Expect(info.Mode().Perm()).To(Equal(os.FileMode(0o600))) b.rt.Close() // the add-on stops + // The fake lists the old link until its handler sees the close. A + // reply pushed before that goes to the closing socket and is lost, and + // start would also take the old link for the new one. + Eventually(func() bool { return f.Connected(appToken) }, 5*time.Second).Should(BeFalse()) b2 := start(f, dir, "own") f.Push(appToken, slacktest.Reply(channel, "U1", "after the restart", mention["ts"].(string)))