console: the fixture test's over-budget check reads the frame cold, so it no longer depends on cache speed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+12
−3
internal/console/perflatency_test.go+12 −3
diff --git a/internal/console/perflatency_test.go b/internal/console/perflatency_test.go| index 877b6e886..f71939914 100644 |
| --- a/internal/console/perflatency_test.go |
| +++ b/internal/console/perflatency_test.go |
| @@ -159,8 +159,14 @@ func TestLatencyAppClientAnswersTheContract(t *testing.T) { |
| // The fixture over the S3 fake serves a real screen, and the perf sample |
| // for each view counts exactly the S3 requests the fake answered for it: |
| -// the cold view's edge-fold refresh included, the warm one's with the |
| +// the cold view's edge-fold refresh included, the delayed one's with the |
| // delays on. |
| +// |
| +// The delayed views start from an empty app-frame cache. Warm, the frame |
| +// cache answers an app page from memory in far less than the budget, so |
| +// whether the over-budget warning fired would depend on how fast the |
| +// page is; reading the frame afresh through the delayed fake makes the |
| +// view's S3 round trips the cost, whatever the cache saves. |
| func TestFixtureOverTheS3FakeServesAppPage(t *testing.T) { |
| lat := &perfLatency{S3Delay: 25 * time.Millisecond, HostDelay: 40 * time.Millisecond} |
| fx := newConsoleFixtureWith(t, consoleFixtureOptions{WithKey: true, S3: lat, AppClient: lat.AppClient()}) |
| @@ -172,6 +178,7 @@ func TestFixtureOverTheS3FakeServesAppPage(t *testing.T) { |
| } |
| return 0 |
| } |
| + coldFrames := func() { fx.srv.frames.clearWhere(func(frameKey) bool { return true }) } |
| view := func() (fake, sample, background, host int64) { |
| t.Helper() |
| s0, h0 := lat.Calls() |
| @@ -209,19 +216,21 @@ func TestFixtureOverTheS3FakeServesAppPage(t *testing.T) { |
| } |
| lat.Enable(true) |
| + coldFrames() |
| start := time.Now() |
| fake, sample, background, _ = view() |
| if fake <= 0 || sample != fake || background != 0 { |
| - t.Errorf("warm view: sample Calls[s3] = %d (background %d), the fake answered %d; want them equal", sample, background, fake) |
| + t.Errorf("delayed view: sample Calls[s3] = %d (background %d), the fake answered %d; want them equal", sample, background, fake) |
| } |
| if took, floor := time.Since(start), time.Duration(fake)*lat.S3Delay; took < floor { |
| - t.Errorf("warm view with S3 delays on took %v, under %d requests at %v", took, fake, lat.S3Delay) |
| + t.Errorf("delayed view with S3 delays on took %v, under %d requests at %v", took, fake, lat.S3Delay) |
| } |
| if g := findGroup(fx.srv.PerfGroups(), screen); g == nil || g.Requests != 2 { |
| t.Errorf("app page group = %+v, want two requests", g) |
| } |
| // The Running tab's instance report goes through Config.AppClient. |
| + coldFrames() |
| _, h0 := lat.Calls() |
| if resp, body := perfGet(t, c, fx.u("/apps/kass/instances")); resp.StatusCode != http.StatusOK { |
| t.Fatalf("GET instances tab over the S3 fake = %d:\n%s", resp.StatusCode, body) |