From 46cd3a28c83e93b5d66c52d06a8366c11910d5c0 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 29 Sep 2025 02:33:10 +0900 Subject: container: remove global msg This frees all container instances of side effects. Signed-off-by: Ophestra --- container/autoroot_test.go | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'container/autoroot_test.go') 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}, - - {"var", true}, + {"proc", false, false}, + {"dev", false, false}, + {"tmp", false, false}, + {"mnt", false, false}, + {"etc", false, false}, + {"", false, 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) } }) -- cgit v1.3.1