aboutsummaryrefslogtreecommitdiffhomepage
path: root/hst/fsbind_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-25 18:30:40 +0900
committerOphestra <cat@gensokyo.uk>2025-08-25 18:38:19 +0900
commit6d202d73b41d28166f7bea7da36d1ce054711ff9 (patch)
tree8af4f9212fe7c3c49c8035119e8a4405e2c97070 /hst/fsbind_test.go
parent1438096339f49bdd466f3b057c7e695aa126fc3c (diff)
hst/fsbind: optional autoetc behaviour
This generalises the special field allowing any special behaviour to be matched from target. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/fsbind_test.go')
-rw-r--r--hst/fsbind_test.go40
1 files changed, 25 insertions, 15 deletions
diff --git a/hst/fsbind_test.go b/hst/fsbind_test.go
index 750dd93a..b2fb0f7a 100644
--- a/hst/fsbind_test.go
+++ b/hst/fsbind_test.go
@@ -63,35 +63,45 @@ func TestFSBind(t *testing.T) {
}}, m("/"), ms("/"),
"*/"},
- {"autoroot nil target", &hst.FSBind{
- Source: m("/"),
- AutoRoot: true,
+ {"special nil target", &hst.FSBind{
+ Source: m("/"),
+ Special: true,
}, false, nil, nil, nil, "<invalid>"},
- {"autoroot bad target", &hst.FSBind{
- Source: m("/"),
- Target: m("/etc/"),
- AutoRoot: true,
+ {"special bad target", &hst.FSBind{
+ Source: m("/"),
+ Target: m("/var/"),
+ Special: true,
}, false, nil, nil, nil, "<invalid>"},
{"autoroot pd", &hst.FSBind{
- Target: m("/"),
- Source: m("/"),
- Write: true,
- AutoRoot: true,
+ Target: m("/"),
+ Source: m("/"),
+ Write: true,
+ Special: true,
}, true, container.Ops{&container.AutoRootOp{
Host: m("/"),
Flags: container.BindWritable,
}}, m("/"), ms("/"), "autoroot:w"},
{"autoroot silly", &hst.FSBind{
- Target: m("/"),
- Source: m("/etc"),
- Write: true,
- AutoRoot: true,
+ Target: m("/"),
+ Source: m("/etc"),
+ Write: true,
+ Special: true,
}, true, container.Ops{&container.AutoRootOp{
Host: m("/etc"),
Flags: container.BindWritable,
}}, m("/"), ms("/etc"), "autoroot:w:/etc"},
+
+ {"autoetc", &hst.FSBind{
+ Target: m("/etc/"),
+ Source: m("/etc/"),
+ Special: true,
+ }, true, container.Ops{
+ &container.MkdirOp{Path: m("/etc/"), Perm: 0755},
+ &container.BindMountOp{Source: m("/etc/"), Target: m("/etc/.host/:3")},
+ &container.AutoEtcOp{Prefix: ":3"},
+ }, m("/etc/"), ms("/etc/"), "autoetc:/etc/"},
})
}