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>
36 lines
1.3 KiB
Go
36 lines
1.3 KiB
Go
package hst_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"hakurei.app/container"
|
|
"hakurei.app/hst"
|
|
)
|
|
|
|
func TestExtraPermConfig(t *testing.T) {
|
|
testCases := []struct {
|
|
name string
|
|
config *hst.ExtraPermConfig
|
|
want string
|
|
}{
|
|
{"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--+:/"},
|
|
{"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/"},
|
|
}
|
|
|
|
for _, tc := range testCases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
if got := tc.config.String(); got != tc.want {
|
|
t.Errorf("String: %q, want %q", got, tc.want)
|
|
}
|
|
})
|
|
}
|
|
}
|