diff options
| author | Paul Buetow <paul@buetow.org> | 2026-04-14 22:05:08 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-04-14 22:05:08 +0300 |
| commit | f90a9e0063dbe4ca06c193aec7e7469a32e0b422 (patch) | |
| tree | 72124595231432f26aef9916ba0b8006d5dd8518 /internal/goprecords/order_test.go | |
| parent | 91a42298f46ee659a951211d4c47f9096fe97b29 (diff) | |
Release 0.4.0: foo.zone HTML styling, uptime-stats section order, dashboard without full Kernel tables.HEADv0.4.0master
- Link foo.zone stylesheet and mirror header/heading/quote layout for HTML reports.
- Default -all stats order matches foo.zone (Host Uptime through Score, then KernelMajor and KernelName; full Kernel last when include-kernel).
- Daemon root HTML uses include-kernel=false like the public stats page.
- Refresh HTML integration fixtures.
Made-with: Cursor
Diffstat (limited to 'internal/goprecords/order_test.go')
| -rw-r--r-- | internal/goprecords/order_test.go | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/internal/goprecords/order_test.go b/internal/goprecords/order_test.go index c085723..0a7d5cb 100644 --- a/internal/goprecords/order_test.go +++ b/internal/goprecords/order_test.go @@ -50,15 +50,34 @@ func TestParseStatsOrder(t *testing.T) { } func TestStatsOrderList(t *testing.T) { - // Empty string returns default order (all category×metric pairs). + wantDefaultPrefix := []CategoryMetric{ + {CategoryHost, MetricUptime}, + {CategoryHost, MetricLifespan}, + {CategoryHost, MetricDowntime}, + {CategoryHost, MetricBoots}, + {CategoryHost, MetricScore}, + {CategoryKernelMajor, MetricBoots}, + {CategoryKernelMajor, MetricUptime}, + {CategoryKernelMajor, MetricScore}, + {CategoryKernelName, MetricBoots}, + {CategoryKernelName, MetricUptime}, + {CategoryKernelName, MetricScore}, + {CategoryKernel, MetricBoots}, + {CategoryKernel, MetricUptime}, + {CategoryKernel, MetricScore}, + } got, err := StatsOrderList("") if err != nil { t.Fatalf("StatsOrderList(\"\"): %v", err) } - if len(got) == 0 { - t.Error("StatsOrderList(\"\"): got empty order") + if len(got) != len(wantDefaultPrefix) { + t.Fatalf("StatsOrderList(\"\"): len=%d want %d", len(got), len(wantDefaultPrefix)) + } + for i := range wantDefaultPrefix { + if got[i] != wantDefaultPrefix[i] { + t.Errorf("StatsOrderList(\"\")[%d] = %v; want %v", i, got[i], wantDefaultPrefix[i]) + } } - // Custom order: Host:Uptime first, then rest of default. got, err = StatsOrderList("Host:Uptime") if err != nil { t.Fatalf("StatsOrderList(\"Host:Uptime\"): %v", err) @@ -69,4 +88,7 @@ func TestStatsOrderList(t *testing.T) { if got[0].Category != CategoryHost || got[0].Metric != MetricUptime { t.Errorf("StatsOrderList(\"Host:Uptime\")[0] = %v; want Host:Uptime", got[0]) } + if got[1] != (CategoryMetric{CategoryHost, MetricLifespan}) { + t.Errorf("StatsOrderList(\"Host:Uptime\")[1] = %v; want Host:Lifespan", got[1]) + } } |
