diff options
author | umohnani8 <umohnani@redhat.com> | 2018-01-12 10:19:48 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-01-15 19:27:10 +0000 |
commit | 2bfb31ddf4b7f28a67ef94b8b318536c367a663b (patch) | |
tree | f76fca0eb6087cc4d5c3b65dc06b73113fe588d9 /cmd/podman/run_test.go | |
parent | 7853262a84b1312e29a78708865a28bd41c4cc2f (diff) | |
download | podman-2bfb31ddf4b7f28a67ef94b8b318536c367a663b.tar.gz podman-2bfb31ddf4b7f28a67ef94b8b318536c367a663b.tar.bz2 podman-2bfb31ddf4b7f28a67ef94b8b318536c367a663b.zip |
Implement and test the following flags for podman run and create
memory, memory-reservation, memory-swap, memory-swappiness, kernel-memory,
cpu-period, cou-quota, cpu-shares, cpus, cpuset-cpus, cpuset-mems,
blkio-weight, blkio-weight-device, sysctl, and ulimit
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #221
Approved by: mheon
Diffstat (limited to 'cmd/podman/run_test.go')
-rw-r--r-- | cmd/podman/run_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/cmd/podman/run_test.go b/cmd/podman/run_test.go index 622e75d3e..f083b39af 100644 --- a/cmd/podman/run_test.go +++ b/cmd/podman/run_test.go @@ -3,6 +3,7 @@ package main import ( "testing" + units "github.com/docker/go-units" ociv1 "github.com/opencontainers/image-spec/specs-go/v1" spec "github.com/opencontainers/runtime-spec/specs-go" "github.com/projectatomic/libpod/libpod" @@ -80,3 +81,22 @@ func TestPIDsLimit(t *testing.T) { runtimeSpec := getRuntimeSpec(CLI) assert.Equal(t, runtimeSpec.Linux.Resources.Pids.Limit, int64(22)) } + +// TestBLKIOWeightDevice verifies the inputed blkio weigh device is correctly defined in the spec +func TestBLKIOWeightDevice(t *testing.T) { + a := createCLI() + args := []string{"--blkio-weight-device", "/dev/sda:100"} + a.Run(append(cmd, args...)) + runtimeSpec := getRuntimeSpec(CLI) + assert.Equal(t, *runtimeSpec.Linux.Resources.BlockIO.WeightDevice[0].Weight, uint16(100)) +} + +// TestMemorySwap verifies that the inputed memory swap is correctly defined in the spec +func TestMemorySwap(t *testing.T) { + a := createCLI() + args := []string{"--memory-swap", "45m", "--memory", "40m"} + a.Run(append(cmd, args...)) + runtimeSpec := getRuntimeSpec(CLI) + mem, _ := units.RAMInBytes("45m") + assert.Equal(t, *runtimeSpec.Linux.Resources.Memory.Swap, mem) +} |