aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/autoroot_test.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-09-29 02:33:10 +0900
committerOphestra <cat@gensokyo.uk>2025-09-29 06:11:47 +0900
commit46cd3a28c83e93b5d66c52d06a8366c11910d5c0 (patch)
tree6e25c5078b5cd9de78b7a6c9b253f1132358812b /container/autoroot_test.go
parentad1bc6794f0053c3e63eab408a0d530d53e8b51c (diff)
container: remove global msg
This frees all container instances of side effects. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'container/autoroot_test.go')
-rw-r--r--container/autoroot_test.go23
1 files changed, 15 insertions, 8 deletions
diff --git a/container/autoroot_test.go b/container/autoroot_test.go
index 3c904312..fe662226 100644
--- a/container/autoroot_test.go
+++ b/container/autoroot_test.go
@@ -180,19 +180,26 @@ func TestIsAutoRootBindable(t *testing.T) {
testCases := []struct {
name string
want bool
+ log bool
}{
- {"proc", false},
- {"dev", false},
- {"tmp", false},
- {"mnt", false},
- {"etc", false},
- {"", false},
+ {"proc", false, false},
+ {"dev", false, false},
+ {"tmp", false, false},
+ {"mnt", false, false},
+ {"etc", false, false},
+ {"", false, true},
- {"var", true},
+ {"var", true, false},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
- if got := IsAutoRootBindable(tc.name); got != tc.want {
+ var msg Msg
+ if tc.log {
+ msg = &kstub{nil, stub.New(t, func(s *stub.Stub[syscallDispatcher]) syscallDispatcher { panic("unreachable") }, stub.Expect{Calls: []stub.Call{
+ call("verbose", stub.ExpectArgs{[]any{"got unexpected root entry"}}, nil, nil),
+ }})}
+ }
+ if got := IsAutoRootBindable(msg, tc.name); got != tc.want {
t.Errorf("IsAutoRootBindable: %v, want %v", got, tc.want)
}
})