2958946517
${IMPORT_PATH} = <system namespace root>/userdata/import — ONE drop-zone per box,
on the system drive, injected at BOTH compose-env builders with NO per-drive
fallback (unresolvable leaves it unset so compose fails loudly rather than
quietly building a second, dead drop-zone).
Third BindRoot (RootImport) + Import list in BackupSpec, extended through
ValidateBackupSpec/ClassifyBinds. Load-bearing: a stale `userdata: import/<app>`
entry against the moved bind would be a WHOLE-BLOCK reject, taking the app's
mandatory hdd classification with it.
Exhaustive-root audit: resolveAbs/structuralGuard/ComputeCaptureSet/
ComputeFabBuckets now take importRoot explicitly (an import bind resolved
against hddPath would name a directory on the wrong drive); unresolvable is
refused loudly into Skipped. GetImportRoot added to both provider interfaces.
Catalog-derived skeleton: UserdataSkeleton() -> UserdataSkeletonCarry() +
BuildUserdataSkeleton(), SORTED. The carry-list makes zero-removals true by
construction (`documents` is in no catalog app but on both boxes) and is the
fresh-box floor. The sort is not tidiness: the naive map-order derivation
measured 20 distinct outputs from 20 identical runs, which with fbNeedsRecreate
is a fleet-wide FileBrowser restart loop.
One authoritative compose parser: ParseComposeUserdataMounts now delegates to
ParseComposeClassifiableBinds. Import root excluded from per-app migration.
Surfaces: FileBrowser /srv/beolvasas source; app-page "Hova tegyem a fajlokat?"
with PathEscape deep links (never QueryEscape) and class-driven copy;
data_paths: annotation with the Fork-3 asymmetry; system-owned beolvasas SMB
share refused server-side at handler AND store, button omitted in template.
Caught on the way: the sharing template's row struct was function-local, so
adding {{if .System}} would have 500'd every share row. ShareRow is now
package-level and the render test uses the handler's own type.
Tests 915 -> 949, all green. MinAgent unchanged.
56 lines
1.8 KiB
Go
56 lines
1.8 KiB
Go
package appbackup
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
// TestSharedContentGID pins the shared content group to 1000 (FileBrowser's gid + the apps' PUID/PGID).
|
|
func TestSharedContentGID(t *testing.T) {
|
|
if SharedContentGID != 1000 {
|
|
t.Errorf("SharedContentGID = %d, want 1000", SharedContentGID)
|
|
}
|
|
}
|
|
|
|
// TestUserdataSkeleton_List asserts the locked skeleton subdir set. R-75 renamed the hardcoded list
|
|
// to UserdataSkeletonCarry (it is now the non-derived carry-list); the asserted set is UNCHANGED,
|
|
// which is exactly the zero-removals promise.
|
|
func TestUserdataSkeleton_List(t *testing.T) {
|
|
got := map[string]bool{}
|
|
for _, s := range UserdataSkeletonCarry() {
|
|
got[s] = true
|
|
}
|
|
for _, want := range []string{
|
|
"media/movies", "media/tv", "media/music", "media/audiobooks", "media/books",
|
|
"media/comics", "media/photos", "downloads", "import/paperless", "import/calibre",
|
|
"roms", "documents",
|
|
} {
|
|
if !got[want] {
|
|
t.Errorf("skeleton missing %q", want)
|
|
}
|
|
}
|
|
}
|
|
|
|
// TestUserdataDir confirms the userdata root is a sibling under the namespace.
|
|
func TestUserdataDir(t *testing.T) {
|
|
if got := UserdataDir("/mnt/felhom-usb"); got != filepath.Clean("/mnt/felhom-usb/userdata") {
|
|
t.Errorf("UserdataDir = %q", got)
|
|
}
|
|
}
|
|
|
|
// TestEnsureUserdataSkeleton_Structure: every skeleton dir is created (chown may fail off-root, which
|
|
// is ignored — dirs + setgid still land). Runs cross-platform.
|
|
func TestEnsureUserdataSkeleton_Structure(t *testing.T) {
|
|
ns := t.TempDir()
|
|
dirs := BuildUserdataSkeleton(nil) // no catalog derived → the carry-list floor
|
|
_ = EnsureUserdataSkeleton(ns, dirs) // ignore chown error on a non-root CI host
|
|
base := UserdataDir(ns)
|
|
for _, sub := range append([]string{""}, dirs...) {
|
|
p := filepath.Join(base, sub)
|
|
if fi, err := os.Stat(p); err != nil || !fi.IsDir() {
|
|
t.Errorf("skeleton dir missing: %s (%v)", p, err)
|
|
}
|
|
}
|
|
}
|