From f9bc297a5e1884d6ce601c47de41bb2cfe1de3c9 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 13 Nov 2026 04:23:10 +0800 Subject: [PATCH] gui tests: TestPluginPageReadsWhatItDeclared's limiter check passes on every -count round The check called pageSetAllowed with the fixed key "x", and its last call stored "now + 2s" in the package's limiter. The next -count round's first call, under a second later than that, was refused, so the test was red on every round after the first ("pageSetAllowed"). The check now uses a key of its own run. Run on the Linux box (wsl-run, magpie-desktop; mote and mica were at load 58 and 72), at origin/main dbaf9d68c + this change: - go test -tags nogui -count=30 -run 'PluginPage|PageService' ./internal/gui/: ok Broken by hand: with the old key, the same run had 27 of 30 rounds red on this test. Not touched: TestPluginPageServiceProxied's ubuntu CI red at 9c33839de (the stream ended after its first event). It passed 300 rounds alone and 30 together with the plugin page tests here; filed separately. --- internal/gui/pluginpage_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/gui/pluginpage_test.go b/internal/gui/pluginpage_test.go index 95e305fe9..33c10b530 100644 --- a/internal/gui/pluginpage_test.go +++ b/internal/gui/pluginpage_test.go @@ -190,7 +190,10 @@ func TestPluginPageReadsWhatItDeclared(t *testing.T) { if w := post("/api/plugin-pages/options", `{"spec":`+string(offSpec)+`,"options":{"x":1}}`); w.Code == 200 { t.Errorf("another plugin's options set: %d", w.Code) } - if !pageSetAllowed("x", time.Now()) || pageSetAllowed("x", time.Now()) || !pageSetAllowed("x", time.Now().Add(2*time.Second)) { + // a key of this run's own: the limiter is package state, and the + // last call leaves "now + 2s" in it for the next -count round + key := "x" + time.Now().String() + if !pageSetAllowed(key, time.Now()) || pageSetAllowed(key, time.Now()) || !pageSetAllowed(key, time.Now().Add(2*time.Second)) { t.Error("pageSetAllowed") } }