aboutsummaryrefslogtreecommitdiffhomepage
path: root/system
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-07-18 23:18:26 +0900
committerOphestra <cat@gensokyo.uk>2025-07-18 23:18:26 +0900
commit9d7a19d162e7003ce89804f00c526b77b2328baa (patch)
tree115badd81cd1824cfc58bb0c573a210dd5209d73 /system
parent6ba19a7ba5c36a4276dceeab9a5d158c5d9738a0 (diff)
container: use more reliable nonexistence
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'system')
-rw-r--r--system/acl_test.go19
-rw-r--r--system/mkdir_test.go6
2 files changed, 14 insertions, 11 deletions
diff --git a/system/acl_test.go b/system/acl_test.go
index a66207e4..886a62e4 100644
--- a/system/acl_test.go
+++ b/system/acl_test.go
@@ -3,6 +3,7 @@ package system
import (
"testing"
+ "hakurei.app/container"
"hakurei.app/system/acl"
)
@@ -52,19 +53,19 @@ func TestACLString(t *testing.T) {
et Enablement
perms []acl.Perm
}{
- {`--- type: process path: "/nonexistent"`, Process, []acl.Perm{}},
- {`r-- type: user path: "/nonexistent"`, User, []acl.Perm{acl.Read}},
- {`-w- type: wayland path: "/nonexistent"`, EWayland, []acl.Perm{acl.Write}},
- {`--x type: x11 path: "/nonexistent"`, EX11, []acl.Perm{acl.Execute}},
- {`rw- type: dbus path: "/nonexistent"`, EDBus, []acl.Perm{acl.Read, acl.Write}},
- {`r-x type: pulseaudio path: "/nonexistent"`, EPulse, []acl.Perm{acl.Read, acl.Execute}},
- {`rwx type: user path: "/nonexistent"`, User, []acl.Perm{acl.Read, acl.Write, acl.Execute}},
- {`rwx type: process path: "/nonexistent"`, Process, []acl.Perm{acl.Read, acl.Write, acl.Write, acl.Execute}},
+ {`--- type: process path: "/proc/nonexistent"`, Process, []acl.Perm{}},
+ {`r-- type: user path: "/proc/nonexistent"`, User, []acl.Perm{acl.Read}},
+ {`-w- type: wayland path: "/proc/nonexistent"`, EWayland, []acl.Perm{acl.Write}},
+ {`--x type: x11 path: "/proc/nonexistent"`, EX11, []acl.Perm{acl.Execute}},
+ {`rw- type: dbus path: "/proc/nonexistent"`, EDBus, []acl.Perm{acl.Read, acl.Write}},
+ {`r-x type: pulseaudio path: "/proc/nonexistent"`, EPulse, []acl.Perm{acl.Read, acl.Execute}},
+ {`rwx type: user path: "/proc/nonexistent"`, User, []acl.Perm{acl.Read, acl.Write, acl.Execute}},
+ {`rwx type: process path: "/proc/nonexistent"`, Process, []acl.Perm{acl.Read, acl.Write, acl.Write, acl.Execute}},
}
for _, tc := range testCases {
t.Run(tc.want, func(t *testing.T) {
- a := &ACL{et: tc.et, perms: tc.perms, path: "/nonexistent"}
+ a := &ACL{et: tc.et, perms: tc.perms, path: container.Nonexistent}
if got := a.String(); got != tc.want {
t.Errorf("String() = %v, want %v",
got, tc.want)
diff --git a/system/mkdir_test.go b/system/mkdir_test.go
index 4b00bb35..706b3d1f 100644
--- a/system/mkdir_test.go
+++ b/system/mkdir_test.go
@@ -3,6 +3,8 @@ package system
import (
"os"
"testing"
+
+ "hakurei.app/container"
)
func TestEnsure(t *testing.T) {
@@ -60,11 +62,11 @@ func TestMkdirString(t *testing.T) {
t.Run(tc.want, func(t *testing.T) {
m := &Mkdir{
et: tc.et,
- path: "/nonexistent",
+ path: container.Nonexistent,
perm: 0701,
ephemeral: tc.ephemeral,
}
- want := "mode: " + os.FileMode(0701).String() + " type: " + tc.want + " path: \"/nonexistent\""
+ want := "mode: " + os.FileMode(0701).String() + " type: " + tc.want + ` path: "/proc/nonexistent"`
if got := m.String(); got != want {
t.Errorf("String() = %v, want %v", got, want)
}