From 9f9e9fc9d3e8dabafceb401a12bf796df505cd71 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 19 Oct 2026 12:05:07 +0200 Subject: [PATCH] Shorten the router's start grace in the test bundle so the bus tests stay in seconds (issue 1218, review round 1 finding 2) --- modules/messenger/cmd/messenger/bus_test.go | 1 + modules/messenger/cmd/messenger/condition_bus_test.go | 6 +++--- modules/messenger/cmd/messenger/holder.go | 6 ++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/messenger/cmd/messenger/bus_test.go b/modules/messenger/cmd/messenger/bus_test.go index 28c8135e..dc6ada66 100644 --- a/modules/messenger/cmd/messenger/bus_test.go +++ b/modules/messenger/cmd/messenger/bus_test.go @@ -34,6 +34,7 @@ const bundleVar = "MESH_MESSENGER_TEST_BUNDLE" func TestMain(m *testing.M) { if os.Getenv(bundleVar) == "1" { kindsEvery = 200 * time.Millisecond + StartGrace = 500 * time.Millisecond main() os.Exit(0) } diff --git a/modules/messenger/cmd/messenger/condition_bus_test.go b/modules/messenger/cmd/messenger/condition_bus_test.go index 95c7bb48..69dd1739 100644 --- a/modules/messenger/cmd/messenger/condition_bus_test.go +++ b/modules/messenger/cmd/messenger/condition_bus_test.go @@ -150,7 +150,7 @@ func busCondition(key, id, headline, needs string) asks.Condition { } // 1218/AC1 and 1218/AC2: a raised condition said on the one subject reaches the desk, is recorded and its work item -// is acknowledged; its cleared form ends it. The router holds a warning for its start grace and burst window. +// is acknowledged; its cleared form ends it. The bundle starts with a short grace (bus_test.go). func TestAConditionSaidOnTheOneSubjectReachesTheDeskAndIsClearedOverTheBus(t *testing.T) { b := newConditionBed(t) b.say(t, "mesh-delivery-teller", busCondition("merge.d-7.stalled", "d-7", "A merge waits on a check", "release it, or stop it.")) @@ -160,7 +160,7 @@ func TestAConditionSaidOnTheOneSubjectReachesTheDeskAndIsClearedOverTheBus(t *te return rec != nil && rec.Origin == "condition" && rec.Cleared.IsZero() }) b.r.until("the work item is acknowledged", 30*time.Second, func() bool { return b.acknowledged(1) }) - b.r.until("the desk is sent the condition", 3*time.Minute, func() bool { + b.r.until("the desk is sent the condition", 15*time.Second, func() bool { for _, m := range b.told() { if strings.Contains(m.Title+m.Body, "A merge waits on a check") { return true @@ -193,7 +193,7 @@ func TestAWarningThatNeedsNothingReachesNoChannelOverTheBus(t *testing.T) { b.say(t, "mesh-delivery-teller", busCondition("merge.d-8.quiet", "d-8", "A quiet merge note", "")) b.r.until("the quiet warning is recorded", 30*time.Second, func() bool { return b.record("merge.d-8.quiet") != nil }) b.say(t, "mesh-delivery-teller", busCondition("merge.d-9.loud", "d-9", "A loud merge note", "release it, or stop it.")) - b.r.until("the warning that needs the operator is sent to the desk", 3*time.Minute, func() bool { + b.r.until("the warning that needs the operator is sent to the desk", 15*time.Second, func() bool { for _, m := range b.told() { if strings.Contains(m.Title+m.Body, "A loud merge note") { return true diff --git a/modules/messenger/cmd/messenger/holder.go b/modules/messenger/cmd/messenger/holder.go index 8fe66c20..9afc0e30 100644 --- a/modules/messenger/cmd/messenger/holder.go +++ b/modules/messenger/cmd/messenger/holder.go @@ -55,6 +55,10 @@ import ( "time" ) +// StartGrace: after start, nothing but the urgent conditions open in the controller's state. A variable, as +// kindsEvery is, so the test bundle shortens it. +var StartGrace = time.Minute + const ( RemindUrgent = time.Hour RemindWarning = 12 * time.Hour @@ -75,8 +79,6 @@ const ( BurstWindow = 30 * time.Second // DesktopWarningEvery: warnings reach the desktop at most this often. DesktopWarningEvery = 15 * time.Minute - // StartGrace: after start, nothing but the urgent conditions open in the controller's state. - StartGrace = time.Minute // ResyncEvery: how often the open set is read from the controller again. ResyncEvery = 10 * time.Minute // RetryEvery: a channel that failed is tried again after this.