From eb5ee4fece0327b1183ae823d68e4cf4e3e1ced0 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 5 Oct 2025 02:42:41 +0900 Subject: internal/app: modularise outcome finalise This is the initial effort of splitting up host and container side of finalisation for params to shim. The new layout also enables much finer grained unit testing of each step, as well as partition access to per-app state for each step. Signed-off-by: Ophestra --- internal/app/app_stub_test.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'internal/app/app_stub_test.go') diff --git a/internal/app/app_stub_test.go b/internal/app/app_stub_test.go index 8d33cd15..fc0030b4 100644 --- a/internal/app/app_stub_test.go +++ b/internal/app/app_stub_test.go @@ -1,7 +1,9 @@ package app import ( + "bytes" "fmt" + "io" "io/fs" "log" "os/exec" @@ -52,12 +54,21 @@ func (k *stubNixOS) stat(name string) (fs.FileInfo, error) { case "/home/ophestra/.pulse-cookie": return stubFileInfoIsDir(true), nil case "/home/ophestra/xdg/config/pulse/cookie": - return stubFileInfoIsDir(false), nil + return stubFileInfoPulseCookie{false}, nil default: panic(fmt.Sprintf("attempted to stat unexpected path %q", name)) } } +func (k *stubNixOS) open(name string) (osFile, error) { + switch name { + case "/home/ophestra/xdg/config/pulse/cookie": + return stubOsFileReadCloser{io.NopCloser(bytes.NewReader(bytes.Repeat([]byte{0}, pulseCookieSizeMax)))}, nil + default: + panic(fmt.Sprintf("attempted to open unexpected path %q", name)) + } +} + func (k *stubNixOS) readdir(name string) ([]fs.DirEntry, error) { switch name { case "/": -- cgit v1.3.1