From 424a0340ffbc53accf418ead08ee6ac128afb470 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 3 Nov 2026 21:28:46 +0000 Subject: [PATCH] test(studio): count polls from the quiet after the add-on stops A poll that began before the add-on stopped could still be counted, so the spec for a binding without its add-on failed at times. Take the count after a short quiet and require that it does not grow. Assisted-by: Claude:claude-sonnet-5-5 go ginkgo --- core/services/studio/connectors_inbound_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/services/studio/connectors_inbound_test.go b/core/services/studio/connectors_inbound_test.go index 1a518ad42f..953189f0d4 100644 --- a/core/services/studio/connectors_inbound_test.go +++ b/core/services/studio/connectors_inbound_test.go @@ -7,6 +7,7 @@ import ( "net/http" "net/http/httptest" "testing" + "time" "github.com/mudler/LocalAI/core/services/addons/hostops" "github.com/mudler/LocalAI/core/services/studio" @@ -203,7 +204,11 @@ var _ = Describe("a binding whose add-on is missing", func() { Expect(list[0].AddonID).To(Equal("telegram")) Expect(list[0].Active).To(BeFalse()) Expect(list[0].Reason).To(Equal("install the telegram add-on")) - Consistently(func() int { return bot.pollCount() }, "300ms").Should(BeZero(), "no add-on, no poll") + // The loop may have started a poll before the add-on stopped, and that + // request can still end after it. Count from the quiet that follows. + time.Sleep(100 * time.Millisecond) + quiet := bot.pollCount() + Consistently(func() int { return bot.pollCount() }, "300ms").Should(Equal(quiet), "no add-on, no poll") r.tr.SetRunning(true) r.conns.Notify()