Files
felhom-controller/controller/internal/web/r1082_sysdrive_hidden_test.go
T
admin a43d0423d5
gates / gates (push) Successful in 46s
v0.318.0: the internal data place, partitions, an honest whole-box backup offer (R-1084), sys_drive never offered (R-1082)
felhom.eu architecture/16 §4-§6 (build B). MinAgent 0.157.0 — the internal place and the partitions appear only when
agent >= 0.158.0 reports them. Tests red-proved; four parity fixtures refreshed (only the new lines).

Claude-Session: https://claude.ai/code/session_012qRErfCoiTkvDK9N5XHbzb
2026-10-16 03:57:49 +02:00

37 lines
1.6 KiB
Go

package web
import "testing"
// R-1082 (operator ruling 2026-10-16 „hide it now"; felhom.eu architecture/16 §11): the drives page never offers the
// guest's own data volume to attach — /mnt/sys_drive rides in every whole-box copy. The raw filter
// (mountedUnregisteredStores) still sees it; what the page offers (attachableStores) does not.
const r1082Mounts = demoHPMounts +
"/dev/mapper/pve-vm--9201--disk--1 /var/lib/felhom ext4 rw,relatime 0 0\n" +
"/dev/mapper/pve-vm--9201--disk--1 /mnt/films ext4 rw,relatime 0 0\n" + // a second bind of the same volume
"/dev/sdd1 /mnt/usb_films ext4 rw,relatime 0 0\n" // a real USB drive with a filesystem
func TestR1082_SysDriveAndItsAliasesAreNotOffered(t *testing.T) {
got := withoutSystemVolume(mountedUnregisteredStores(r1082Mounts, map[string]bool{}), r1082Mounts, "/mnt/sys_drive")
if len(got) != 1 || got[0].Path != "/mnt/usb_films" {
t.Fatalf("want only the USB drive offered (positive control), got %+v", got)
}
}
func TestR1082_EmptyConfigFallsBackToHiding(t *testing.T) {
got := withoutSystemVolume(mountedUnregisteredStores(demoHPMounts, map[string]bool{}), demoHPMounts, "")
if len(got) != 0 {
t.Fatalf("with no configured system data path, sys_drive must still be hidden, got %+v", got)
}
}
// The page's own list (the derivation the candidates endpoint and the restore page share) hides it.
func TestR1082_AttachableStoresHidesSysDrive(t *testing.T) {
s := testServer(t)
s.cfg.Paths.SystemDataPath = "/mnt/sys_drive"
got := s.attachableStoresFrom(r1082Mounts)
if len(got) != 1 || got[0].Path != "/mnt/usb_films" {
t.Fatalf("the page must offer only the USB drive, got %+v", got)
}
}