R-1199 reopened: a box with no list of its own reads the household's from the hub and adopts it, pushes its default once only when no household saved one; every push names its source; an empty saved list stays empty; R-1216 (D28 = A): the install page's swap sentence only when host swap is really short (shared case table); unreleased
gates / gates (push) Successful in 1m55s
gates / gates (push) Successful in 1m55s
This commit is contained in:
1 parent
08fa440d04
commit
add310c80a
13 files changed
+509
-58
No files matched your search
@@ -1,6 +1,8 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"gitea.dooplex.hu/admin/felhom-controller/internal/agentapi"
|
||||
@@ -26,3 +28,39 @@ func TestR1192_SwapShortJudgesTheHostSwapAgainstTheGuestRAM(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// R-1216 / D28 = A: the shared case table (byte-identical in felhom.eu hub/internal/api/testdata/, checked by felhom.eu
|
||||
// scripts/host_swap_rule_gate.py), plus the page's own input: a 12 GB guest on an 8 GB-swap host (demo-felhom) is NOT
|
||||
// short; the guest's RAM stands in when the agent sends no guest_swap_mb.
|
||||
// RED-PROOF: with the morning's rule (`host < the guest's RAM`) the demo-hp, demo-felhom and 32 GB rows fail — seen
|
||||
// failing 2026-10-22.
|
||||
func TestR1216_HostSwapRuleCases(t *testing.T) {
|
||||
b, err := os.ReadFile("testdata/host_swap_rule_cases.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
var f struct {
|
||||
Cases []struct {
|
||||
Name string `json:"name"`
|
||||
Host int64 `json:"host_swap_mb"`
|
||||
Guest int64 `json:"guest_swap_mb"`
|
||||
Short bool `json:"short"`
|
||||
} `json:"cases"`
|
||||
}
|
||||
if err := json.Unmarshal(b, &f); err != nil || len(f.Cases) < 10 {
|
||||
t.Fatalf("case table: %v (%d cases)", err, len(f.Cases))
|
||||
}
|
||||
mb := func(v int64) *int64 { return &v }
|
||||
for _, c := range f.Cases {
|
||||
if got := hostSwapRuleShort(c.Host, c.Guest); got != c.Short {
|
||||
t.Errorf("%s: host %d / guests %d → short=%t, want %t", c.Name, c.Host, c.Guest, got, c.Short)
|
||||
}
|
||||
// Through the page's own input, the agent's answer.
|
||||
if got := swapShort(agentapi.GuestMemoryInfo{AllocatedMB: c.Guest, HostSwapMB: mb(c.Host), GuestSwapMB: mb(c.Guest)}); got != c.Short {
|
||||
t.Errorf("%s (page input): short=%t, want %t", c.Name, got, c.Short)
|
||||
}
|
||||
}
|
||||
if swapShort(agentapi.GuestMemoryInfo{AllocatedMB: 12288, HostSwapMB: mb(8191)}) {
|
||||
t.Error("demo-felhom without guest_swap_mb (the guest's RAM stands in) must not be short")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user