summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/terminal_unsupported.go23
-rw-r--r--pkg/specgen/config_unsupported.go3
-rw-r--r--pkg/util/utils_linux_test.go29
-rw-r--r--pkg/util/utils_test.go19
4 files changed, 54 insertions, 20 deletions
diff --git a/pkg/adapter/terminal_unsupported.go b/pkg/adapter/terminal_unsupported.go
new file mode 100644
index 000000000..3009f0a38
--- /dev/null
+++ b/pkg/adapter/terminal_unsupported.go
@@ -0,0 +1,23 @@
+// +build !linux
+
+package adapter
+
+import (
+ "context"
+ "os"
+
+ "github.com/containers/libpod/libpod"
+ "github.com/containers/libpod/libpod/define"
+)
+
+// ExecAttachCtr execs and attaches to a container
+func ExecAttachCtr(ctx context.Context, ctr *libpod.Container, tty, privileged bool, env map[string]string, cmd []string, user, workDir string, streams *libpod.AttachStreams, preserveFDs uint, detachKeys string) (int, error) {
+ return -1, define.ErrNotImplemented
+}
+
+// StartAttachCtr starts and (if required) attaches to a container
+// if you change the signature of this function from os.File to io.Writer, it will trigger a downstream
+// error. we may need to just lint disable this one.
+func StartAttachCtr(ctx context.Context, ctr *libpod.Container, stdout, stderr, stdin *os.File, detachKeys string, sigProxy bool, startContainer bool, recursive bool) error { //nolint-interfacer
+ return define.ErrNotImplemented
+}
diff --git a/pkg/specgen/config_unsupported.go b/pkg/specgen/config_unsupported.go
index 5d24ac39c..c2d3257c9 100644
--- a/pkg/specgen/config_unsupported.go
+++ b/pkg/specgen/config_unsupported.go
@@ -3,10 +3,11 @@
package specgen
import (
+ "github.com/containers/libpod/libpod/image"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
)
-func (s *SpecGenerator) getSeccompConfig(configSpec *spec.Spec) (*spec.LinuxSeccomp, error) {
+func (s *SpecGenerator) getSeccompConfig(configSpec *spec.Spec, img *image.Image) (*spec.LinuxSeccomp, error) {
return nil, errors.New("function not supported on non-linux OS's")
}
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)
+}
diff --git a/pkg/util/utils_test.go b/pkg/util/utils_test.go
index f4b03599d..0995d1e20 100644
--- a/pkg/util/utils_test.go
+++ b/pkg/util/utils_test.go
@@ -219,25 +219,6 @@ func TestGetImageConfigLabel(t *testing.T) {
assert.NotNil(t, err)
}
-func TestGetImageConfigStopSignal(t *testing.T) {
- 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)
-}
-
func TestGetImageConfigOnBuild(t *testing.T) {
onBuildOne, err := GetImageConfig([]string{"ONBUILD ADD /testdir1"})
require.Nil(t, err)