9bdb4dae8f
gates / gates (push) Successful in 13s
Space preflight before anything is created (uncompressed size from the vzdump log / PBS snapshot, x1.2 + 5 GiB, thin metadata, off the tested guest's pool when another storage is eligible, unknown refuses, reported as a non-pass result). Failed scratch teardown and the stale-lock sweep retried every 10 min (the sweep under the heavy-op gate). A thin pool crossing 90% requests an immediate host report. Six red-proofs. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
35 lines
1.3 KiB
Go
35 lines
1.3 KiB
Go
package storage
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"gitea.dooplex.hu/admin/felhom-agent/internal/proxmox"
|
|
)
|
|
|
|
// R-672 (v0.133.0): a thin pool crossing 90 % requests an out-of-band host report ONCE, through the
|
|
// watchdog's own read path (Known — every few seconds), so the hub's storage-fill alarm sees the pool in
|
|
// seconds, not at the next 15-minute report. Re-armed below 85 %.
|
|
//
|
|
// COMPANION RED-PROOF (REPORT): remove the noteThinFill call from the data path → "no report was
|
|
// requested when the pool crossed 90 %".
|
|
func TestThinHigh_RequestsOneReportPerCrossing(t *testing.T) {
|
|
pool := proxmox.Storage{Storage: "local-lvm", Type: "lvmthin", Content: "rootdir,images", Total: 1000, Active: 1}
|
|
api := &fakeStorageAPI{node: "n", cluster: []proxmox.Storage{pool}}
|
|
o := NewObserver(api, &fakeHostReader{}, nil, quietLogger())
|
|
asked := 0
|
|
o.SetThinHighTrigger(func() { asked++ })
|
|
for i, used := range []int64{800, 910, 950, 1000, 840, 920} {
|
|
p := pool
|
|
p.Used, p.Avail, p.UsedFraction = used, 1000-used, float64(used)/1000
|
|
api.nodeSt = []proxmox.Storage{p}
|
|
if _, err := o.Known(context.Background()); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
want := map[int]int{0: 0, 1: 1, 2: 1, 3: 1, 4: 1, 5: 2}[i]
|
|
if asked != want {
|
|
t.Fatalf("after %d/1000 used: %d report requests, want %d", used, asked, want)
|
|
}
|
|
}
|
|
}
|