From 289fdebead872b1b011b8fe892d43a2f234703d1 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Tue, 7 Apr 2026 15:03:48 +0900 Subject: [PATCH] container: transparently degrade landlock in tests Explicitly requiring landlock in tests will be supported in a future change. Signed-off-by: Ophestra --- container/container_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/container/container_test.go b/container/container_test.go index bcbcdded..693021bf 100644 --- a/container/container_test.go +++ b/container/container_test.go @@ -453,6 +453,15 @@ func TestContainer(t *testing.T) { c.SeccompDisable = !tc.filter c.RetainSession = tc.session c.HostNet = tc.net + if !c.HostNet { + if _, err := container.LandlockGetABI(); err != nil { + if !errors.Is(err, syscall.ENOSYS) { + t.Fatalf("LandlockGetABI: error = %v", err) + } + c.HostAbstract = true + t.Log("Landlock LSM is unavailable, enabling HostAbstract") + } + } c. Readonly(check.MustAbs(pathReadonly), 0755).