carlos / platform Public

remote-instance-metrics: test another app's and pre-record samples (two surviving mutants)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev bc06bdc3797e74a38b43a31d284021508637ccc5 parent 359f40c
1 file changed, +13 −0
  • internal/console/remotemetrics_test.go +13 −0
diff --git a/internal/console/remotemetrics_test.go b/internal/console/remotemetrics_test.go
index 2f98674ac..ff2cdc166 100644
--- a/internal/console/remotemetrics_test.go
+++ b/internal/console/remotemetrics_test.go
@@ -370,6 +370,19 @@ func TestRemoteMetricsGraphOnlyTheOwnersSamples(t *testing.T) {
if m := tb.remoteMetricsRow(t, remoteHost); m.Reporting() {
t.Fatalf("a remote row read another app's sample: %+v", m)
}
+ // Only another app of this account was ever sampled: nothing.
+ writeSamples(t, tb.fx.rel, status.Label("box-b"), sample(created.Add(time.Second), 0.95, otherApp), sample(created.Add(2*time.Second), 0.96, otherApp))
+ tb.fresh()
+ if m := tb.remoteMetricsRow(t, remoteHost); m.Reporting() || m.SparkCPU != "" {
+ t.Fatalf("a remote row read only another app's samples: %+v", m)
+ }
+ // Only this account's samples from before its record (an earlier
+ // instance of the hostname): nothing, not even as the current reading.
+ writeSamples(t, tb.fx.rel, status.Label("box-b"), sample(created.Add(-2*time.Minute), 0.97, own), sample(created.Add(-time.Minute), 0.98, own))
+ tb.fresh()
+ if m := tb.remoteMetricsRow(t, remoteHost); m.Reporting() || m.SparkCPU != "" {
+ t.Fatalf("a remote row read samples from before its record: %+v", m)
+ }
}
// metricsBudgetStore counts the metrics sweep's reads: LISTs and GETs under