diff options
author | cdoern <cbdoer23@g.holycross.edu> | 2021-06-17 17:36:35 -0400 |
---|---|---|
committer | cdoern <cbdoer23@g.holycross.edu> | 2021-06-23 13:47:57 -0400 |
commit | bbd085ad1e3cf9c5b543c907ad7014ccf8a5cb34 (patch) | |
tree | 14dd2d240f32586a624f6a786d8127b8bfb95017 /test/e2e | |
parent | 510509bafcdd055b4a6819ed300db7292c6fb6b8 (diff) | |
download | podman-bbd085ad1e3cf9c5b543c907ad7014ccf8a5cb34.tar.gz podman-bbd085ad1e3cf9c5b543c907ad7014ccf8a5cb34.tar.bz2 podman-bbd085ad1e3cf9c5b543c907ad7014ccf8a5cb34.zip |
Podman Pod Create --cpus and --cpuset-cpus flags
Added logic and handling for two new Podman pod create Flags.
--cpus specifies the total number of cores on which the pod can execute, this
is a combination of the period and quota for the CPU.
--cpuset-cpus is a string value which determines of these available cores,
how many we will truly execute on.
Signed-off-by: cdoern <cbdoer23@g.holycross.edu>
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/pod_create_test.go | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/e2e/pod_create_test.go b/test/e2e/pod_create_test.go index a70d9f13f..e437c98e6 100644 --- a/test/e2e/pod_create_test.go +++ b/test/e2e/pod_create_test.go @@ -5,9 +5,12 @@ import ( "io/ioutil" "os" "path/filepath" + "strconv" "strings" + "github.com/containers/common/pkg/sysinfo" "github.com/containers/podman/v3/pkg/rootless" + "github.com/containers/podman/v3/pkg/util" . "github.com/containers/podman/v3/test/utils" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -515,4 +518,45 @@ ENTRYPOINT ["sleep","99999"] Expect(create.ExitCode()).To(BeZero()) }) + It("podman pod create --cpus", func() { + podName := "testPod" + numCPU := float64(sysinfo.NumCPU()) + period, quota := util.CoresToPeriodAndQuota(numCPU) + numCPUStr := strconv.Itoa(int(numCPU)) + podCreate := podmanTest.Podman([]string{"pod", "create", "--cpus", numCPUStr, "--name", podName}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate.ExitCode()).To(Equal(0)) + + contCreate := podmanTest.Podman([]string{"container", "create", "--pod", podName, "alpine"}) + contCreate.WaitWithDefaultTimeout() + Expect(podCreate.ExitCode()).To(Equal(0)) + + podInspect := podmanTest.Podman([]string{"pod", "inspect", podName}) + podInspect.WaitWithDefaultTimeout() + Expect(podInspect.ExitCode()).To(Equal(0)) + podJSON := podInspect.InspectPodToJSON() + Expect(podJSON.CPUPeriod).To(Equal(period)) + Expect(podJSON.CPUQuota).To(Equal(quota)) + }) + + It("podman pod create --cpuset-cpus", func() { + podName := "testPod" + ctrName := "testCtr" + numCPU := float64(sysinfo.NumCPU()) + numCPUStr := strconv.Itoa(int(numCPU)) + in := "0-" + numCPUStr + podCreate := podmanTest.Podman([]string{"pod", "create", "--cpuset-cpus", in, "--name", podName}) + podCreate.WaitWithDefaultTimeout() + Expect(podCreate.ExitCode()).To(Equal(0)) + + contCreate := podmanTest.Podman([]string{"container", "create", "--name", ctrName, "--pod", podName, "alpine"}) + contCreate.WaitWithDefaultTimeout() + Expect(podCreate.ExitCode()).To(Equal(0)) + + podInspect := podmanTest.Podman([]string{"pod", "inspect", podName}) + podInspect.WaitWithDefaultTimeout() + Expect(podInspect.ExitCode()).To(Equal(0)) + podJSON := podInspect.InspectPodToJSON() + Expect(podJSON.CPUSetCPUs).To(Equal(in)) + }) }) |