aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/autoroot_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-20 01:03:49 +0900
committerOphestra <cat@gensokyo.uk>2025-08-20 01:03:49 +0900
commite0533aaa684ecdc80c6542233570c30f0fcec06a (patch)
tree26c89e553856e92f8f90443b35187026a736c722 /container/autoroot_test.go
parent13c7083bc028616e258e5e6919db7b11c6e739a6 (diff)
container/autoroot: filter dentry with empty name
This is unreachable, but nice to have just in case. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/autoroot_test.go')
-rw-r--r--container/autoroot_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/container/autoroot_test.go b/container/autoroot_test.go
new file mode 100644
index 00000000..7e9d1477
--- /dev/null
+++ b/container/autoroot_test.go
@@ -0,0 +1,26 @@
+package container
+
+import "testing"
+
+func TestIsAutoRootBindable(t *testing.T) {
+ testCases := []struct {
+ name string
+ want bool
+ }{
+ {"proc", false},
+ {"dev", false},
+ {"tmp", false},
+ {"mnt", false},
+ {"etc", false},
+ {"", false},
+
+ {"var", true},
+ }
+ for _, tc := range testCases {
+ t.Run(tc.name, func(t *testing.T) {
+ if got := IsAutoRootBindable(tc.name); got != tc.want {
+ t.Errorf("IsAutoRootBindable: %v, want %v", got, tc.want)
+ }
+ })
+ }
+}