hst/fsbind: optional autoetc behaviour
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m18s
Test / Hpkg (push) Successful in 4m9s
Test / Sandbox (race detector) (push) Successful in 4m31s
Test / Hakurei (race detector) (push) Successful in 5m6s
Test / Hakurei (push) Successful in 2m24s
Test / Flake checks (push) Successful in 1m29s
All checks were successful
Test / Create distribution (push) Successful in 34s
Test / Sandbox (push) Successful in 2m18s
Test / Hpkg (push) Successful in 4m9s
Test / Sandbox (race detector) (push) Successful in 4m31s
Test / Hakurei (race detector) (push) Successful in 5m6s
Test / Hakurei (push) Successful in 2m24s
Test / Flake checks (push) Successful in 1m29s
This generalises the special field allowing any special behaviour to be matched from target. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -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/"},
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user