mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00

Add the ability to run the integration (ginkgo) suite using the remote client. Only the images_test.go file is run right now; all the rest are isolated with a // +build !remotelinux. As more content is developed for the remote client, we can unblock the files and just block single tests as needed. Signed-off-by: baude <bbaude@redhat.com>
179 lines
6.2 KiB
Go
179 lines
6.2 KiB
Go
// +build !remoteclient
|
|
|
|
package integration
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
. "github.com/containers/libpod/test/utils"
|
|
. "github.com/onsi/ginkgo"
|
|
. "github.com/onsi/gomega"
|
|
)
|
|
|
|
var _ = Describe("Podman pod restart", func() {
|
|
var (
|
|
tempdir string
|
|
err error
|
|
podmanTest *PodmanTestIntegration
|
|
)
|
|
|
|
BeforeEach(func() {
|
|
tempdir, err = CreateTempDirInTempDir()
|
|
if err != nil {
|
|
os.Exit(1)
|
|
}
|
|
podmanTest = PodmanTestCreate(tempdir)
|
|
podmanTest.RestoreAllArtifacts()
|
|
})
|
|
|
|
AfterEach(func() {
|
|
podmanTest.CleanupPod()
|
|
f := CurrentGinkgoTestDescription()
|
|
timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
|
|
GinkgoWriter.Write([]byte(timedResult))
|
|
})
|
|
|
|
It("podman pod restart bogus pod", func() {
|
|
session := podmanTest.Podman([]string{"pod", "restart", "123"})
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(125))
|
|
})
|
|
|
|
It("podman pod restart single empty pod", func() {
|
|
_, ec, podid := podmanTest.CreatePod("")
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session := podmanTest.Podman([]string{"pod", "restart", podid})
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(125))
|
|
})
|
|
|
|
It("podman pod restart single pod by name", func() {
|
|
_, ec, _ := podmanTest.CreatePod("foobar99")
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session := podmanTest.RunTopContainerInPod("test1", "foobar99")
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
|
|
startTime.WaitWithDefaultTimeout()
|
|
|
|
session = podmanTest.Podman([]string{"pod", "restart", "foobar99"})
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1"})
|
|
restartTime.WaitWithDefaultTimeout()
|
|
Expect(restartTime.OutputToString()).To(Not(Equal(startTime.OutputToString())))
|
|
})
|
|
|
|
It("podman pod restart multiple pods", func() {
|
|
_, ec, _ := podmanTest.CreatePod("foobar99")
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session := podmanTest.RunTopContainerInPod("test1", "foobar99")
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
_, ec, _ = podmanTest.CreatePod("foobar100")
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session = podmanTest.RunTopContainerInPod("test2", "foobar100")
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
session = podmanTest.RunTopContainerInPod("test3", "foobar100")
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
session = podmanTest.RunTopContainerInPod("test4", "foobar100")
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2", "test3", "test4"})
|
|
startTime.WaitWithDefaultTimeout()
|
|
|
|
session = podmanTest.Podman([]string{"pod", "restart", "foobar99", "foobar100"})
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2", "test3", "test4"})
|
|
restartTime.WaitWithDefaultTimeout()
|
|
Expect(restartTime.OutputToStringArray()[0]).To(Not(Equal(startTime.OutputToStringArray()[0])))
|
|
Expect(restartTime.OutputToStringArray()[1]).To(Not(Equal(startTime.OutputToStringArray()[1])))
|
|
Expect(restartTime.OutputToStringArray()[2]).To(Not(Equal(startTime.OutputToStringArray()[2])))
|
|
Expect(restartTime.OutputToStringArray()[3]).To(Not(Equal(startTime.OutputToStringArray()[3])))
|
|
})
|
|
|
|
It("podman pod restart all pods", func() {
|
|
_, ec, _ := podmanTest.CreatePod("foobar99")
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session := podmanTest.RunTopContainerInPod("test1", "foobar99")
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
_, ec, _ = podmanTest.CreatePod("foobar100")
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session = podmanTest.RunTopContainerInPod("test2", "foobar100")
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
|
|
startTime.WaitWithDefaultTimeout()
|
|
|
|
session = podmanTest.Podman([]string{"pod", "restart", "-a"})
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
|
|
restartTime.WaitWithDefaultTimeout()
|
|
Expect(restartTime.OutputToStringArray()[0]).To(Not(Equal(startTime.OutputToStringArray()[0])))
|
|
Expect(restartTime.OutputToStringArray()[1]).To(Not(Equal(startTime.OutputToStringArray()[1])))
|
|
})
|
|
|
|
It("podman pod restart latest pod", func() {
|
|
_, ec, _ := podmanTest.CreatePod("foobar99")
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session := podmanTest.RunTopContainerInPod("test1", "foobar99")
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
_, ec, _ = podmanTest.CreatePod("foobar100")
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session = podmanTest.RunTopContainerInPod("test2", "foobar100")
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
startTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
|
|
startTime.WaitWithDefaultTimeout()
|
|
|
|
session = podmanTest.Podman([]string{"pod", "restart", "-l"})
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
restartTime := podmanTest.Podman([]string{"inspect", "--format='{{.State.StartedAt}}'", "test1", "test2"})
|
|
restartTime.WaitWithDefaultTimeout()
|
|
Expect(restartTime.OutputToStringArray()[0]).To(Equal(startTime.OutputToStringArray()[0]))
|
|
Expect(restartTime.OutputToStringArray()[1]).To(Not(Equal(startTime.OutputToStringArray()[1])))
|
|
})
|
|
|
|
It("podman pod restart multiple pods with bogus", func() {
|
|
_, ec, podid1 := podmanTest.CreatePod("foobar99")
|
|
Expect(ec).To(Equal(0))
|
|
|
|
session := podmanTest.RunTopContainerInPod("", "foobar99")
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(0))
|
|
|
|
session = podmanTest.Podman([]string{"pod", "restart", podid1, "doesnotexist"})
|
|
session.WaitWithDefaultTimeout()
|
|
Expect(session.ExitCode()).To(Equal(125))
|
|
})
|
|
})
|