diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-03-21 14:48:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-21 14:48:50 +0100 |
commit | 89a3e5979b5f247e83a1723c7f355983fa7c7a86 (patch) | |
tree | b984a7371d05de8713df0f662eca8a33935f9c30 /pkg/util/utils_linux_test.go | |
parent | 195a82ffbc435716ef5bb69f6eefa333abe3f840 (diff) | |
parent | de7bcca7d5b0129329b6b08fd241cdc1a768bafb (diff) | |
download | podman-89a3e5979b5f247e83a1723c7f355983fa7c7a86.tar.gz podman-89a3e5979b5f247e83a1723c7f355983fa7c7a86.tar.bz2 podman-89a3e5979b5f247e83a1723c7f355983fa7c7a86.zip |
Merge pull request #5579 from mtrmac/macOS-unit-tests
Make macOS unit tests runnable
Diffstat (limited to 'pkg/util/utils_linux_test.go')
-rw-r--r-- | pkg/util/utils_linux_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/pkg/util/utils_linux_test.go b/pkg/util/utils_linux_test.go new file mode 100644 index 000000000..38e6dbef9 --- /dev/null +++ b/pkg/util/utils_linux_test.go @@ -0,0 +1,29 @@ +package util + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +func TestGetImageConfigStopSignal(t *testing.T) { + // Linux-only beause parsing signal names is not supported on non-Linux systems by + // pkg/signal. + stopSignalValidInt, err := GetImageConfig([]string{"STOPSIGNAL 9"}) + require.Nil(t, err) + assert.Equal(t, stopSignalValidInt.StopSignal, "9") + + stopSignalValidString, err := GetImageConfig([]string{"STOPSIGNAL SIGKILL"}) + require.Nil(t, err) + assert.Equal(t, stopSignalValidString.StopSignal, "9") + + _, err = GetImageConfig([]string{"STOPSIGNAL 0"}) + assert.NotNil(t, err) + + _, err = GetImageConfig([]string{"STOPSIGNAL garbage"}) + assert.NotNil(t, err) + + _, err = GetImageConfig([]string{"STOPSIGNAL "}) + assert.NotNil(t, err) +} |