From 9635bc02585faea919669bc3afca42639099ea1c Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Mon, 12 Jun 2023 15:11:02 +0100 Subject: [PATCH 1/2] pkg/config: fix unit tests for FreeBSD This just disables the capabilities test - everything else already passed. Signed-off-by: Doug Rabson --- pkg/config/config_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 3b83de794..3f209da71 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -2,8 +2,10 @@ package config import ( "bytes" + "fmt" "io" "os" + "runtime" "sort" "strings" @@ -512,6 +514,9 @@ image_copy_tmp_dir="storage"` // When config, err := NewConfig("") // Then + if runtime.GOOS != "linux" { + Skip(fmt.Sprintf("capabilities not supported on %s", runtime.GOOS)) + } gomega.Expect(err).To(gomega.BeNil()) var addcaps, dropcaps []string caps, err := config.Capabilities("0", addcaps, dropcaps) From d6abc582c9e7b7aaa76fe99c7bb9f7d466fd76b8 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Mon, 12 Jun 2023 13:22:33 +0100 Subject: [PATCH 2/2] pkg/config: override DefaultInitPath for FreeBSD FreeBSD packages typically install files under /usr/local on FreeBSD. Signed-off-by: Doug Rabson --- pkg/config/config_test.go | 6 +++--- pkg/config/default.go | 2 -- pkg/config/default_common.go | 7 +++++++ pkg/config/default_freebsd.go | 3 +++ 4 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 pkg/config/default_common.go diff --git a/pkg/config/config_test.go b/pkg/config/config_test.go index 3f209da71..612609283 100644 --- a/pkg/config/config_test.go +++ b/pkg/config/config_test.go @@ -511,12 +511,12 @@ image_copy_tmp_dir="storage"` It("Test Capabilities call", func() { // Given - // When - config, err := NewConfig("") - // Then if runtime.GOOS != "linux" { Skip(fmt.Sprintf("capabilities not supported on %s", runtime.GOOS)) } + // When + config, err := NewConfig("") + // Then gomega.Expect(err).To(gomega.BeNil()) var addcaps, dropcaps []string caps, err := config.Capabilities("0", addcaps, dropcaps) diff --git a/pkg/config/default.go b/pkg/config/default.go index b7aa5f292..127920997 100644 --- a/pkg/config/default.go +++ b/pkg/config/default.go @@ -32,8 +32,6 @@ const ( ) var ( - // DefaultInitPath is the default path to the container-init binary. - DefaultInitPath = "/usr/libexec/podman/catatonit" // DefaultInfraImage is the default image to run as infrastructure containers in pods. DefaultInfraImage = "" // DefaultRootlessSHMLockPath is the default path for rootless SHM locks. diff --git a/pkg/config/default_common.go b/pkg/config/default_common.go new file mode 100644 index 000000000..f65461043 --- /dev/null +++ b/pkg/config/default_common.go @@ -0,0 +1,7 @@ +//go:build !freebsd +// +build !freebsd + +package config + +// DefaultInitPath is the default path to the container-init binary. +var DefaultInitPath = "/usr/libexec/podman/catatonit" diff --git a/pkg/config/default_freebsd.go b/pkg/config/default_freebsd.go index f3c999bed..637abf981 100644 --- a/pkg/config/default_freebsd.go +++ b/pkg/config/default_freebsd.go @@ -1,5 +1,8 @@ package config +// DefaultInitPath is the default path to the container-init binary. +var DefaultInitPath = "/usr/local/libexec/podman/catatonit" + func getDefaultCgroupsMode() string { return "enabled" }