aboutsummaryrefslogtreecommitdiffhomepage
path: root/hst/fs_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-07 23:59:48 +0900
committerOphestra <cat@gensokyo.uk>2025-10-07 23:59:48 +0900
commit12ab7ea3b465a130933efd9e7fe044f3636dc6ed (patch)
tree0085bf02e3afb0c1da7d7893ff71d430ee1591ea /hst/fs_test.go
parent1f0226f7e01822a2a5b37d8626b59b7b6f4d0144 (diff)
hst/fs: access ops through interface
This removes the final hakurei.app/container import from hst. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/fs_test.go')
-rw-r--r--hst/fs_test.go37
1 files changed, 36 insertions, 1 deletions
diff --git a/hst/fs_test.go b/hst/fs_test.go
index 35d58ad6..8350be54 100644
--- a/hst/fs_test.go
+++ b/hst/fs_test.go
@@ -3,6 +3,7 @@ package hst_test
import (
"encoding/json"
"errors"
+ "os"
"reflect"
"strings"
"syscall"
@@ -249,7 +250,7 @@ func checkFs(t *testing.T, testCases []fsTestCase) {
t.Run("ops", func(t *testing.T) {
ops := new(container.Ops)
- tc.fs.Apply(&hst.ApplyState{AutoEtcPrefix: ":3", Ops: ops})
+ tc.fs.Apply(&hst.ApplyState{AutoEtcPrefix: ":3", Ops: opsAdapter{ops}})
if !reflect.DeepEqual(ops, &tc.ops) {
gotString := new(strings.Builder)
for _, op := range *ops {
@@ -288,6 +289,40 @@ func checkFs(t *testing.T, testCases []fsTestCase) {
}
}
+type opsAdapter struct{ *container.Ops }
+
+func (p opsAdapter) Tmpfs(target *check.Absolute, size int, perm os.FileMode) hst.Ops {
+ return opsAdapter{p.Ops.Tmpfs(target, size, perm)}
+}
+
+func (p opsAdapter) Readonly(target *check.Absolute, perm os.FileMode) hst.Ops {
+ return opsAdapter{p.Ops.Readonly(target, perm)}
+}
+
+func (p opsAdapter) Bind(source, target *check.Absolute, flags int) hst.Ops {
+ return opsAdapter{p.Ops.Bind(source, target, flags)}
+}
+
+func (p opsAdapter) Overlay(target, state, work *check.Absolute, layers ...*check.Absolute) hst.Ops {
+ return opsAdapter{p.Ops.Overlay(target, state, work, layers...)}
+}
+
+func (p opsAdapter) OverlayReadonly(target *check.Absolute, layers ...*check.Absolute) hst.Ops {
+ return opsAdapter{p.Ops.OverlayReadonly(target, layers...)}
+}
+
+func (p opsAdapter) Link(target *check.Absolute, linkName string, dereference bool) hst.Ops {
+ return opsAdapter{p.Ops.Link(target, linkName, dereference)}
+}
+
+func (p opsAdapter) Root(host *check.Absolute, flags int) hst.Ops {
+ return opsAdapter{p.Ops.Root(host, flags)}
+}
+
+func (p opsAdapter) Etc(host *check.Absolute, prefix string) hst.Ops {
+ return opsAdapter{p.Ops.Etc(host, prefix)}
+}
+
func m(pathname string) *check.Absolute { return check.MustAbs(pathname) }
func ms(pathnames ...string) []*check.Absolute {
as := make([]*check.Absolute, len(pathnames))