aboutsummaryrefslogtreecommitdiffhomepage
path: root/hst/config_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-07 21:29:16 +0900
committerOphestra <cat@gensokyo.uk>2025-10-07 21:29:16 +0900
commit5d18af00077ae6ba8ef686d1fd93d888f69681b2 (patch)
treeeff32422fe3ef095c6a915ccb41c2a10a06990f7 /hst/config_test.go
parent0e6c1a50260de141c50bb50fd3f2b2bcf9a3fe64 (diff)
container/fhs: move pathname constants
This allows referencing FHS pathnames without importing container. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'hst/config_test.go')
-rw-r--r--hst/config_test.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/hst/config_test.go b/hst/config_test.go
index f57be3dc..ea50d4f1 100644
--- a/hst/config_test.go
+++ b/hst/config_test.go
@@ -4,7 +4,7 @@ import (
"reflect"
"testing"
- "hakurei.app/container"
+ "hakurei.app/container/fhs"
"hakurei.app/hst"
)
@@ -25,18 +25,18 @@ func TestConfigValidate(t *testing.T) {
{"home", &hst.Config{Container: &hst.ContainerConfig{}}, &hst.AppError{Step: "validate configuration", Err: hst.ErrConfigNull,
Msg: "container configuration missing path to home directory"}},
{"shell", &hst.Config{Container: &hst.ContainerConfig{
- Home: container.AbsFHSTmp,
+ Home: fhs.AbsTmp,
}}, &hst.AppError{Step: "validate configuration", Err: hst.ErrConfigNull,
Msg: "container configuration missing path to shell"}},
{"path", &hst.Config{Container: &hst.ContainerConfig{
- Home: container.AbsFHSTmp,
- Shell: container.AbsFHSTmp,
+ Home: fhs.AbsTmp,
+ Shell: fhs.AbsTmp,
}}, &hst.AppError{Step: "validate configuration", Err: hst.ErrConfigNull,
Msg: "container configuration missing path to initial program"}},
{"valid", &hst.Config{Container: &hst.ContainerConfig{
- Home: container.AbsFHSTmp,
- Shell: container.AbsFHSTmp,
- Path: container.AbsFHSTmp,
+ Home: fhs.AbsTmp,
+ Shell: fhs.AbsTmp,
+ Path: fhs.AbsTmp,
}}, nil},
}
for _, tc := range testCases {
@@ -56,14 +56,14 @@ func TestExtraPermConfig(t *testing.T) {
}{
{"nil", nil, "<invalid>"},
{"nil path", &hst.ExtraPermConfig{Path: nil}, "<invalid>"},
- {"r", &hst.ExtraPermConfig{Path: container.AbsFHSRoot, Read: true}, "r--:/"},
- {"r+", &hst.ExtraPermConfig{Ensure: true, Path: container.AbsFHSRoot, Read: true}, "r--+:/"},
+ {"r", &hst.ExtraPermConfig{Path: fhs.AbsRoot, Read: true}, "r--:/"},
+ {"r+", &hst.ExtraPermConfig{Ensure: true, Path: fhs.AbsRoot, Read: true}, "r--+:/"},
{"w", &hst.ExtraPermConfig{Path: hst.AbsTmp, Write: true}, "-w-:/.hakurei"},
{"w+", &hst.ExtraPermConfig{Ensure: true, Path: hst.AbsTmp, Write: true}, "-w-+:/.hakurei"},
- {"x", &hst.ExtraPermConfig{Path: container.AbsFHSRunUser, Execute: true}, "--x:/run/user/"},
- {"x+", &hst.ExtraPermConfig{Ensure: true, Path: container.AbsFHSRunUser, Execute: true}, "--x+:/run/user/"},
- {"rwx", &hst.ExtraPermConfig{Path: container.AbsFHSTmp, Read: true, Write: true, Execute: true}, "rwx:/tmp/"},
- {"rwx+", &hst.ExtraPermConfig{Ensure: true, Path: container.AbsFHSTmp, Read: true, Write: true, Execute: true}, "rwx+:/tmp/"},
+ {"x", &hst.ExtraPermConfig{Path: fhs.AbsRunUser, Execute: true}, "--x:/run/user/"},
+ {"x+", &hst.ExtraPermConfig{Ensure: true, Path: fhs.AbsRunUser, Execute: true}, "--x+:/run/user/"},
+ {"rwx", &hst.ExtraPermConfig{Path: fhs.AbsTmp, Read: true, Write: true, Execute: true}, "rwx:/tmp/"},
+ {"rwx+", &hst.ExtraPermConfig{Ensure: true, Path: fhs.AbsTmp, Read: true, Write: true, Execute: true}, "rwx+:/tmp/"},
}
for _, tc := range testCases {