Expand guest metrics and add Proxmox maintenance overview

This commit is contained in:
Maxim
2026-08-01 11:38:03 +03:00
parent 5491be2e0c
commit ad8972320d
8 changed files with 536 additions and 38 deletions

33
maintenance_test.go Normal file
View File

@@ -0,0 +1,33 @@
package main
import (
"os"
"path/filepath"
"testing"
"time"
)
func TestNewestKernel(t *testing.T) {
output := "proxmox-kernel-6.8 6.8.12-5\nproxmox-kernel-6.14 6.14.8-2"
if got := newestKernel(output); got != "6.14.8-2" {
t.Fatalf("unexpected newest kernel: %s", got)
}
}
func TestNextZFSScrubCron(t *testing.T) {
path := filepath.Join(t.TempDir(), "zfs")
if err := os.WriteFile(path, []byte("24 0 8-14 * * root /usr/lib/zfs-linux/scrub\n"), 0600); err != nil {
t.Fatal(err)
}
now := time.Date(2026, 8, 1, 12, 0, 0, 0, time.UTC)
if got := nextZFSScrubCron(path, now); got != "Sun 2026-08-09 00:24 UTC" {
t.Fatalf("unexpected cron scrub: %s", got)
}
}
func TestNextScrubTimer(t *testing.T) {
line := "Sun 2026-08-02 00:24:00 MSK 1 day left zfs-scrub-weekly@tank.timer"
if got := nextScrubTimer(line); got != "Sun 2026-08-02 00:24:00 MSK" {
t.Fatalf("unexpected scrub: %s", got)
}
}