From 99610e9569fe39aaeecbc32d55e7021b63180a92 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 21 Oct 2026 19:59:58 +0200 Subject: [PATCH] Cut the controller's slowest unit tests (a source scan that regexed every file, resolver stand-in timeouts, a wait bound) so mesh-controller's unit level fits its bound (issue 1763) --- cmd/mesh-controller/forge_wait_test.go | 2 +- cmd/mesh-controller/plan_moved_every_writer_test.go | 3 ++- cmd/mesh-controller/sayable_test.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cmd/mesh-controller/forge_wait_test.go b/cmd/mesh-controller/forge_wait_test.go index 8216e91c..8a580cf0 100644 --- a/cmd/mesh-controller/forge_wait_test.go +++ b/cmd/mesh-controller/forge_wait_test.go @@ -68,7 +68,7 @@ func TestTheForgeNotAnsweringInTimeIsNotAskedAgain(t *testing.T) { // An ask that hangs past the bound is cut off at the bound, not at its own wait, and the failure still says it // waited: the receive loop is held no longer than the bound (novox/hq issue 486). func TestAnAskHangingPastTheBoundIsCutOffAtIt(t *testing.T) { - w := waitOut{bound: 200 * time.Millisecond, first: 10 * time.Millisecond, most: 50 * time.Millisecond, + w := waitOut{bound: 100 * time.Millisecond, first: 10 * time.Millisecond, most: 50 * time.Millisecond, now: time.Now, sleep: sleepOrDone} asked := 0 began := time.Now() diff --git a/cmd/mesh-controller/plan_moved_every_writer_test.go b/cmd/mesh-controller/plan_moved_every_writer_test.go index be7f712b..1b68d3da 100644 --- a/cmd/mesh-controller/plan_moved_every_writer_test.go +++ b/cmd/mesh-controller/plan_moved_every_writer_test.go @@ -31,7 +31,8 @@ func TestNoPlanIsWrittenButThroughSavePlansMoving(t *testing.T) { return err } text := string(raw) - if write.MatchString(text) { + // The regular expression is the costly part of reading every source: only a file that names the table can match. + if strings.Contains(strings.ToLower(text), "release_plan") && write.MatchString(text) { found = append(found, path+" writes the plan table") } // A plan record is written by the bucket's raw create and update, which only the plans' own file calls. diff --git a/cmd/mesh-controller/sayable_test.go b/cmd/mesh-controller/sayable_test.go index 1d51afa6..60481280 100644 --- a/cmd/mesh-controller/sayable_test.go +++ b/cmd/mesh-controller/sayable_test.go @@ -152,7 +152,7 @@ func answersRightly(q dnsmessage.Question) *dnsmessage.Message { func quickResolvers(t *testing.T, port string) { t.Helper() before, within, pause := resolverPort, resolverWithin, resolverPause - resolverPort, resolverWithin, resolverPause = port, 150*time.Millisecond, 10*time.Millisecond + resolverPort, resolverWithin, resolverPause = port, 60*time.Millisecond, 5*time.Millisecond t.Cleanup(func() { resolverPort, resolverWithin, resolverPause = before, within, pause }) }