hst/fs: interface filesystem config
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m14s
Test / Hakurei (push) Successful in 3m37s
Test / Hpkg (push) Successful in 4m27s
Test / Sandbox (race detector) (push) Successful in 4m23s
Test / Hakurei (race detector) (push) Successful in 5m22s
Test / Flake checks (push) Successful in 1m22s
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m14s
Test / Hakurei (push) Successful in 3m37s
Test / Hpkg (push) Successful in 4m27s
Test / Sandbox (race detector) (push) Successful in 4m23s
Test / Hakurei (race detector) (push) Successful in 5m22s
Test / Flake checks (push) Successful in 1m22s
This allows mount points to be represented by different underlying structs. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
66
hst/fsbind_test.go
Normal file
66
hst/fsbind_test.go
Normal file
@@ -0,0 +1,66 @@
|
||||
package hst_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"hakurei.app/container"
|
||||
"hakurei.app/hst"
|
||||
)
|
||||
|
||||
func TestFSBind(t *testing.T) {
|
||||
checkFs(t, "bind", []fsTestCase{
|
||||
{"nil", (*hst.FSBind)(nil), nil, nil, nil, "<invalid>"},
|
||||
|
||||
{"full", &hst.FSBind{
|
||||
Dst: m("/dev"),
|
||||
Src: m("/mnt/dev"),
|
||||
Optional: true,
|
||||
Device: true,
|
||||
}, container.Ops{&container.BindMountOp{
|
||||
Source: m("/mnt/dev"),
|
||||
Target: m("/dev"),
|
||||
Flags: container.BindWritable | container.BindDevice | container.BindOptional,
|
||||
}}, m("/dev"), ms("/mnt/dev"),
|
||||
"d+/mnt/dev:/dev"},
|
||||
|
||||
{"full write dev", &hst.FSBind{
|
||||
Dst: m("/dev"),
|
||||
Src: m("/mnt/dev"),
|
||||
Write: true,
|
||||
Device: true,
|
||||
}, container.Ops{&container.BindMountOp{
|
||||
Source: m("/mnt/dev"),
|
||||
Target: m("/dev"),
|
||||
Flags: container.BindWritable | container.BindDevice,
|
||||
}}, m("/dev"), ms("/mnt/dev"),
|
||||
"d*/mnt/dev:/dev"},
|
||||
|
||||
{"full write", &hst.FSBind{
|
||||
Dst: m("/tmp"),
|
||||
Src: m("/mnt/tmp"),
|
||||
Write: true,
|
||||
}, container.Ops{&container.BindMountOp{
|
||||
Source: m("/mnt/tmp"),
|
||||
Target: m("/tmp"),
|
||||
Flags: container.BindWritable,
|
||||
}}, m("/tmp"), ms("/mnt/tmp"),
|
||||
"w*/mnt/tmp:/tmp"},
|
||||
|
||||
{"full no flags", &hst.FSBind{
|
||||
Dst: m("/etc"),
|
||||
Src: m("/mnt/etc"),
|
||||
}, container.Ops{&container.BindMountOp{
|
||||
Source: m("/mnt/etc"),
|
||||
Target: m("/etc"),
|
||||
}}, m("/etc"), ms("/mnt/etc"),
|
||||
"*/mnt/etc:/etc"},
|
||||
|
||||
{"nil dst", &hst.FSBind{
|
||||
Src: m("/"),
|
||||
}, container.Ops{&container.BindMountOp{
|
||||
Source: m("/"),
|
||||
Target: m("/"),
|
||||
}}, m("/"), ms("/"),
|
||||
"*/"},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user