github.com/ouraigua/jenkins-library@v0.0.0-20231028010029-fbeaf2f3aa9b/pkg/docker/multiarch_test.go (about) 1 //go:build unit 2 // +build unit 3 4 package docker 5 6 import ( 7 "testing" 8 9 "github.com/SAP/jenkins-library/pkg/mock" 10 "github.com/stretchr/testify/assert" 11 ) 12 13 func TestIsBinfmtMiscSupportedByHost(t *testing.T) { 14 t.Run("returns true - binfmt_misc supported by host", func(t *testing.T) { 15 utils := mock.FilesMock{} 16 utils.AddDir("/proc/sys/fs/binfmt_misc") 17 18 b, err := IsBinfmtMiscSupportedByHost(&utils) 19 20 if assert.NoError(t, err) { 21 assert.True(t, b) 22 } 23 }) 24 25 t.Run("returns false - binfmt_misc not supported by host", func(t *testing.T) { 26 utils := mock.FilesMock{} 27 28 b, err := IsBinfmtMiscSupportedByHost(&utils) 29 30 if assert.NoError(t, err) { 31 assert.False(t, b) 32 } 33 }) 34 }