install page: say when the host has too little swap behind the guest (R-1192 follow-up); restore record log says when a cut restore was put back; unreleased
gates / gates (push) Successful in 1m36s

This commit is contained in:
2026-10-21 22:11:16 +02:00
parent d582feb245
commit 37b79caad9
11 changed files with 78 additions and 6 deletions
@@ -0,0 +1,28 @@
package web
import (
"testing"
"gitea.dooplex.hu/admin/felhom-controller/internal/agentapi"
)
// R-1192 follow-up (night 2026-10-21): the install page adds „A gépen nincs elég cserehely (swap)…" when memory is
// tight AND the agent reports the host's swap below the guest's RAM. An older agent (no number) is not judged.
// RED-PROOF: swapShort returning false always → the first case fails.
func TestR1192_SwapShortJudgesTheHostSwapAgainstTheGuestRAM(t *testing.T) {
mb := func(v int64) *int64 { return &v }
for _, c := range []struct {
name string
info agentapi.GuestMemoryInfo
want bool
}{
{"a host with no swap", agentapi.GuestMemoryInfo{AllocatedMB: 4096, HostSwapMB: mb(0)}, true},
{"a host with 2 GB swap behind a 4 GB guest", agentapi.GuestMemoryInfo{AllocatedMB: 4096, HostSwapMB: mb(2048)}, true},
{"the installer's 8 GB host (7.75 GB swap)", agentapi.GuestMemoryInfo{AllocatedMB: 4096, HostSwapMB: mb(7935)}, false},
{"an older agent (no number)", agentapi.GuestMemoryInfo{AllocatedMB: 4096}, false},
} {
if got := swapShort(c.info); got != c.want {
t.Errorf("%s: swapShort = %v, want %v", c.name, got, c.want)
}
}
}