mirror of
https://github.com/containers/podman.git
synced 2025-05-21 00:56:36 +08:00

It qemu cannot be compiled anyway so make sure we do not try to compile parts where the typechecker complains about on windows. Also all the e2e test files are only used on linux as well. pkg/machine/wsl also reports some error but to many for me to fix them now. One minor problem was fixed in pkg/machine/machine_windows.go. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
138 lines
4.6 KiB
Go
138 lines
4.6 KiB
Go
//go:build linux || freebsd
|
|
|
|
package integration
|
|
|
|
import (
|
|
. "github.com/containers/podman/v5/test/utils"
|
|
. "github.com/onsi/ginkgo/v2"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("Podman pod pause", func() {
|
|
pausedState := "Paused"
|
|
|
|
BeforeEach(func() {
|
|
SkipIfRootlessCgroupsV1("Pause is not supported in cgroups v1")
|
|
})
|
|
|
|
It("podman pod pause bogus pod", func() {
|
|
session := podmanTest.Podman([]string{"pod", "pause", "foobar"})
|
|
session.WaitWithDefaultTimeout()
|
|
expect := "no pod with name or ID foobar found: no such pod"
|
|
if IsRemote() {
|
|
expect = `unable to find pod "foobar": no such pod`
|
|
}
|
|
Expect(session).To(ExitWithError(125, expect))
|
|
})
|
|
|
|
It("podman unpause bogus pod", func() {
|
|
session := podmanTest.Podman([]string{"pod", "unpause", "foobar"})
|
|
session.WaitWithDefaultTimeout()
|
|
expect := "no pod with name or ID foobar found: no such pod"
|
|
if IsRemote() {
|
|
expect = `unable to find pod "foobar": no such pod`
|
|
}
|
|
Expect(session).To(ExitWithError(125, expect))
|
|
})
|
|
|
|
It("podman pod pause a created pod by id", func() {
|
|
_, ec, podid := podmanTest.CreatePod(nil)
|
|
Expect(ec).To(Equal(0))
|
|
|
|
result := podmanTest.Podman([]string{"pod", "pause", podid})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(ExitCleanly())
|
|
})
|
|
|
|
It("pause a running pod by id", func() {
|
|
_, ec, podid := podmanTest.CreatePod(nil)
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session := podmanTest.RunTopContainerInPod("", podid)
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session).Should(ExitCleanly())
|
|
|
|
result := podmanTest.Podman([]string{"pod", "pause", podid})
|
|
result.WaitWithDefaultTimeout()
|
|
|
|
Expect(result).Should(ExitCleanly())
|
|
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
|
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring(pausedState))
|
|
|
|
result = podmanTest.Podman([]string{"pod", "unpause", podid})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
|
})
|
|
|
|
It("unpause a paused pod by id", func() {
|
|
_, ec, podid := podmanTest.CreatePod(nil)
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session := podmanTest.RunTopContainerInPod("", podid)
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session).Should(ExitCleanly())
|
|
|
|
result := podmanTest.Podman([]string{"pod", "pause", podid})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(ExitCleanly())
|
|
Expect(result.OutputToStringArray()).Should(HaveLen(1))
|
|
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
|
Expect(podmanTest.GetContainerStatus()).To(Equal(pausedState))
|
|
|
|
result = podmanTest.Podman([]string{"pod", "unpause", podid})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(ExitCleanly())
|
|
Expect(result.OutputToStringArray()).Should(HaveLen(1))
|
|
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
|
})
|
|
|
|
It("unpause a paused pod by name", func() {
|
|
_, ec, _ := podmanTest.CreatePod(map[string][]string{"--name": {"test1"}})
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session := podmanTest.RunTopContainerInPod("", "test1")
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session).Should(ExitCleanly())
|
|
|
|
result := podmanTest.Podman([]string{"pod", "pause", "test1"})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(ExitCleanly())
|
|
Expect(result.OutputToStringArray()).Should(HaveLen(1))
|
|
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(0))
|
|
Expect(podmanTest.GetContainerStatus()).To(Equal(pausedState))
|
|
|
|
result = podmanTest.Podman([]string{"pod", "unpause", "test1"})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(ExitCleanly())
|
|
Expect(result.OutputToStringArray()).Should(HaveLen(1))
|
|
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
|
})
|
|
|
|
It("unpause --all", func() {
|
|
_, ec, podid1 := podmanTest.CreatePod(nil)
|
|
Expect(ec).To(Equal(0))
|
|
_, ec, podid2 := podmanTest.CreatePod(nil)
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session := podmanTest.RunTopContainerInPod("", podid1)
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session).Should(ExitCleanly())
|
|
session = podmanTest.RunTopContainerInPod("", podid2)
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session).Should(ExitCleanly())
|
|
|
|
result := podmanTest.Podman([]string{"pod", "pause", podid1})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(ExitCleanly())
|
|
Expect(result.OutputToStringArray()).Should(HaveLen(1))
|
|
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
|
Expect(podmanTest.GetContainerStatus()).To(ContainSubstring(pausedState))
|
|
|
|
result = podmanTest.Podman([]string{"pod", "unpause", "--all"})
|
|
result.WaitWithDefaultTimeout()
|
|
Expect(result).Should(ExitCleanly())
|
|
Expect(result.OutputToStringArray()).Should(HaveLen(1))
|
|
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(2))
|
|
})
|
|
})
|