Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Fix: flaky metrics fallback test — use WriteBatchSync for deterministic writes

rcourtmaned5ab5eebfbe
diff --git a/pkg/metrics/store_test.go b/pkg/metrics/store_test.go
index 08b97639a9..9efe1343f6 100644
--- a/pkg/metrics/store_test.go
+++ b/pkg/metrics/store_test.go
@@ -113,8 +113,14 @@ func TestStoreQueryFallbacksToRaw(t *testing.T) {
defer store.Close()
ts := time.Now()
- store.WriteWithTier("vm", "vm-101", "cpu", 42.0, ts, TierRaw)
- store.Flush()
+ store.WriteBatchSync([]WriteMetric{{
+ ResourceType: "vm",
+ ResourceID: "vm-101",
+ MetricType: "cpu",
+ Value: 42.0,
+ Timestamp: ts,
+ Tier: TierRaw,
+ }})
points, err := store.Query("vm", "vm-101", "cpu", ts.Add(-24*time.Hour), ts.Add(time.Second), 0)
if err != nil {