Shorten the router's start grace in the test bundle so the bus tests stay in seconds (issue 1218, review round 1 finding 2)

This commit is contained in:
2026-10-19 12:05:07 +02:00
parent f737418bb3
commit 9f9e9fc9d3
3 changed files with 8 additions and 5 deletions
@@ -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)
}
@@ -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
+4 -2
View File
@@ -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.