summaryrefslogtreecommitdiff
path: root/cmd/podman/run_test.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2018-01-17 11:03:07 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-18 12:26:43 +0000
commit0d69ca6637b30a3370529b3e272f27f6fafdb0c3 (patch)
treed6a69ad97b497eb5304c3a5b516a6056f4c85460 /cmd/podman/run_test.go
parent0befd8dafd116ea5f231f5b360b500be08c39297 (diff)
downloadpodman-0d69ca6637b30a3370529b3e272f27f6fafdb0c3.tar.gz
podman-0d69ca6637b30a3370529b3e272f27f6fafdb0c3.tar.bz2
podman-0d69ca6637b30a3370529b3e272f27f6fafdb0c3.zip
Fix seccomp support
If user does not specify seccomp file or seccomp file does not exist, then use the default seccomp settings. Still need to not hard code /etc/crio/seccomp.json, should move this to /usr/share/seccomp/seccomp.json Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #233 Approved by: baude
Diffstat (limited to 'cmd/podman/run_test.go')
-rw-r--r--cmd/podman/run_test.go38
1 files changed, 30 insertions, 8 deletions
diff --git a/cmd/podman/run_test.go b/cmd/podman/run_test.go
index f083b39af..b82df86db 100644
--- a/cmd/podman/run_test.go
+++ b/cmd/podman/run_test.go
@@ -66,11 +66,24 @@ func createCLI() cli.App {
return a
}
-func getRuntimeSpec(c *cli.Context) *spec.Spec {
- runtime, _ := getRuntime(c)
- createConfig, _ := parseCreateOpts(c, runtime, "alpine", generateAlpineImageData())
- runtimeSpec, _ := createConfigToOCISpec(createConfig)
- return runtimeSpec
+func getRuntimeSpec(c *cli.Context) (*spec.Spec, error) {
+ /*
+ TODO: This test has never worked. Need to install content
+ runtime, err := getRuntime(c)
+ if err != nil {
+ return nil, err
+ }
+ createConfig, err := parseCreateOpts(c, runtime, "alpine", generateAlpineImageData())
+ */
+ createConfig, err := parseCreateOpts(c, nil, "alpine", generateAlpineImageData())
+ if err != nil {
+ return nil, err
+ }
+ runtimeSpec, err := createConfigToOCISpec(createConfig)
+ if err != nil {
+ return nil, err
+ }
+ return runtimeSpec, nil
}
// TestPIDsLimit verifies the inputed pid-limit is correctly defined in the spec
@@ -78,7 +91,10 @@ func TestPIDsLimit(t *testing.T) {
a := createCLI()
args := []string{"--pids-limit", "22"}
a.Run(append(cmd, args...))
- runtimeSpec := getRuntimeSpec(CLI)
+ runtimeSpec, err := getRuntimeSpec(CLI)
+ if err != nil {
+ t.Fatalf(err.Error())
+ }
assert.Equal(t, runtimeSpec.Linux.Resources.Pids.Limit, int64(22))
}
@@ -87,7 +103,10 @@ func TestBLKIOWeightDevice(t *testing.T) {
a := createCLI()
args := []string{"--blkio-weight-device", "/dev/sda:100"}
a.Run(append(cmd, args...))
- runtimeSpec := getRuntimeSpec(CLI)
+ runtimeSpec, err := getRuntimeSpec(CLI)
+ if err != nil {
+ t.Fatalf(err.Error())
+ }
assert.Equal(t, *runtimeSpec.Linux.Resources.BlockIO.WeightDevice[0].Weight, uint16(100))
}
@@ -96,7 +115,10 @@ func TestMemorySwap(t *testing.T) {
a := createCLI()
args := []string{"--memory-swap", "45m", "--memory", "40m"}
a.Run(append(cmd, args...))
- runtimeSpec := getRuntimeSpec(CLI)
+ runtimeSpec, err := getRuntimeSpec(CLI)
+ if err != nil {
+ t.Fatalf(err.Error())
+ }
mem, _ := units.RAMInBytes("45m")
assert.Equal(t, *runtimeSpec.Linux.Resources.Memory.Swap, mem)
}