fd28d70bff
Operator rulings 2026-10-12, 09 §3 decisions 196, 204-207, 223, 227. MinAgent 0.131.0 unchanged. R-255's sweep found one leak, fixed here: an optional-config secret_input was rendered into its settings page; it is now revealed on demand. Hungarian parity fixtures re-captured once for R-562. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
package report
|
|
|
|
import (
|
|
"encoding/json"
|
|
"strings"
|
|
"testing"
|
|
|
|
"gitea.dooplex.hu/admin/felhom-controller/internal/system"
|
|
)
|
|
|
|
// R-266: a failed root statfs reaches the hub as read_failed, not as a 0-of-0 disk the hub would band
|
|
// as "0 % used". A measured disk carries no read_failed at all (omitempty), so an old hub sees no change.
|
|
func TestRootStorageEntry_ReadFailed(t *testing.T) {
|
|
failed := rootStorageEntry(system.SystemInfo{DiskKnown: false})
|
|
if !failed.ReadFailed {
|
|
t.Fatal("root statfs failed (DiskKnown false) but the storage entry does not say read_failed")
|
|
}
|
|
if failed.TotalGB != 0 || failed.UsedGB != 0 || failed.Percent != 0 || failed.Mount != "/" {
|
|
t.Errorf("failed entry changed its numbers or mount: %+v", failed)
|
|
}
|
|
b, _ := json.Marshal(failed)
|
|
if !strings.Contains(string(b), `"read_failed":true`) {
|
|
t.Errorf("wire form lacks read_failed: %s", b)
|
|
}
|
|
|
|
ok := rootStorageEntry(system.SystemInfo{DiskKnown: true, DiskTotalGB: 100, DiskUsedGB: 40, DiskPercent: 40})
|
|
if ok.ReadFailed {
|
|
t.Error("a measured root disk is marked read_failed")
|
|
}
|
|
b, _ = json.Marshal(ok)
|
|
if strings.Contains(string(b), "read_failed") {
|
|
t.Errorf("a measured disk must not carry read_failed on the wire: %s", b)
|
|
}
|
|
if ok.TotalGB != 100 || ok.Percent != 40 {
|
|
t.Errorf("measured numbers lost: %+v", ok)
|
|
}
|
|
}
|