mirror of
https://github.com/containers/podman.git
synced 2025-06-26 04:46:57 +08:00
Merge pull request #19924 from edsantiago/e2e_check_stderr__commit
e2e: commit_test: use ExitCleanly()
This commit is contained in:
@ -22,6 +22,14 @@ var _ = Describe("Podman commit", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
if !IsRemote() {
|
||||
messages := session.ErrorToString()
|
||||
Expect(messages).To(ContainSubstring("Getting image source signatures"))
|
||||
Expect(messages).To(ContainSubstring("Copying blob"))
|
||||
Expect(messages).To(ContainSubstring("Writing manifest to image destination"))
|
||||
Expect(messages).To(Not(ContainSubstring("level=")), "Unexpected logrus messages in stderr")
|
||||
}
|
||||
|
||||
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
|
||||
check.WaitWithDefaultTimeout()
|
||||
data := check.InspectImageJSON()
|
||||
@ -33,9 +41,9 @@ var _ = Describe("Podman commit", func() {
|
||||
Expect(ec).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session := podmanTest.Podman([]string{"commit", "test1", "a"})
|
||||
session := podmanTest.Podman([]string{"commit", "-q", "test1", "a"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
check := podmanTest.Podman([]string{"inspect", "localhost/a:latest"})
|
||||
check.WaitWithDefaultTimeout()
|
||||
@ -48,9 +56,9 @@ var _ = Describe("Podman commit", func() {
|
||||
Expect(ec).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session := podmanTest.Podman([]string{"container", "commit", "test1", "foobar.com/test1-image:latest"})
|
||||
session := podmanTest.Podman([]string{"container", "commit", "-q", "test1", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
check := podmanTest.Podman([]string{"image", "inspect", "foobar.com/test1-image:latest"})
|
||||
check.WaitWithDefaultTimeout()
|
||||
@ -63,9 +71,9 @@ var _ = Describe("Podman commit", func() {
|
||||
Expect(ec).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session := podmanTest.Podman([]string{"commit", "-f", "docker", "--message", "testing-commit", "test1", "foobar.com/test1-image:latest"})
|
||||
session := podmanTest.Podman([]string{"commit", "-q", "-f", "docker", "--message", "testing-commit", "test1", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
|
||||
check.WaitWithDefaultTimeout()
|
||||
@ -78,9 +86,9 @@ var _ = Describe("Podman commit", func() {
|
||||
Expect(ec).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session := podmanTest.Podman([]string{"commit", "--author", "snoopy", "test1", "foobar.com/test1-image:latest"})
|
||||
session := podmanTest.Podman([]string{"commit", "-q", "--author", "snoopy", "test1", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
|
||||
check.WaitWithDefaultTimeout()
|
||||
@ -91,12 +99,12 @@ var _ = Describe("Podman commit", func() {
|
||||
It("podman commit container with change flag", func() {
|
||||
test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", ALPINE, "ls"})
|
||||
test.WaitWithDefaultTimeout()
|
||||
Expect(test).Should(Exit(0))
|
||||
Expect(test).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session := podmanTest.Podman([]string{"commit", "--change", "LABEL=image=blue", "test1", "foobar.com/test1-image:latest"})
|
||||
session := podmanTest.Podman([]string{"commit", "-q", "--change", "LABEL=image=blue", "test1", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
|
||||
check.WaitWithDefaultTimeout()
|
||||
@ -107,16 +115,16 @@ var _ = Describe("Podman commit", func() {
|
||||
It("podman commit container with --squash", func() {
|
||||
test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", ALPINE, "ls"})
|
||||
test.WaitWithDefaultTimeout()
|
||||
Expect(test).Should(Exit(0))
|
||||
Expect(test).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session := podmanTest.Podman([]string{"commit", "--squash", "test1", "foobar.com/test1-image:latest"})
|
||||
session := podmanTest.Podman([]string{"commit", "-q", "--squash", "test1", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{.RootFS.Layers}}", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
// Check for one layers
|
||||
Expect(strings.Fields(session.OutputToString())).To(HaveLen(1))
|
||||
})
|
||||
@ -124,12 +132,12 @@ var _ = Describe("Podman commit", func() {
|
||||
It("podman commit container with change flag and JSON entrypoint with =", func() {
|
||||
test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", ALPINE, "ls"})
|
||||
test.WaitWithDefaultTimeout()
|
||||
Expect(test).Should(Exit(0))
|
||||
Expect(test).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session := podmanTest.Podman([]string{"commit", "--change", `ENTRYPOINT ["foo", "bar=baz"]`, "test1", "foobar.com/test1-image:latest"})
|
||||
session := podmanTest.Podman([]string{"commit", "-q", "--change", `ENTRYPOINT ["foo", "bar=baz"]`, "test1", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
|
||||
check.WaitWithDefaultTimeout()
|
||||
@ -143,25 +151,25 @@ var _ = Describe("Podman commit", func() {
|
||||
It("podman commit container with change CMD flag", func() {
|
||||
test := podmanTest.Podman([]string{"run", "--name", "test1", "-d", ALPINE, "ls"})
|
||||
test.WaitWithDefaultTimeout()
|
||||
Expect(test).Should(Exit(0))
|
||||
Expect(test).Should(ExitCleanly())
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session := podmanTest.Podman([]string{"commit", "--change", "CMD a b c", "test1", "foobar.com/test1-image:latest"})
|
||||
session := podmanTest.Podman([]string{"commit", "-q", "--change", "CMD a b c", "test1", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Config.Cmd}}", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(ContainSubstring("sh -c a b c"))
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "--change", "CMD=[\"a\",\"b\",\"c\"]", "test1", "foobar.com/test1-image:latest"})
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "--change", "CMD=[\"a\",\"b\",\"c\"]", "test1", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"inspect", "--format", "{{.Config.Cmd}}", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(Not(ContainSubstring("sh -c")))
|
||||
})
|
||||
|
||||
@ -170,27 +178,27 @@ var _ = Describe("Podman commit", func() {
|
||||
Expect(ec).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session := podmanTest.Podman([]string{"commit", "--pause=false", "test1", "foobar.com/test1-image:latest"})
|
||||
session := podmanTest.Podman([]string{"commit", "-q", "--pause=false", "test1", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
|
||||
check.WaitWithDefaultTimeout()
|
||||
Expect(check).Should(Exit(0))
|
||||
Expect(check).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman commit with volumes mounts and no include-volumes", func() {
|
||||
s := podmanTest.Podman([]string{"run", "--name", "test1", "-v", "/tmp:/foo", "alpine", "date"})
|
||||
s.WaitWithDefaultTimeout()
|
||||
Expect(s).Should(Exit(0))
|
||||
Expect(s).Should(ExitCleanly())
|
||||
|
||||
c := podmanTest.Podman([]string{"commit", "test1", "newimage"})
|
||||
c := podmanTest.Podman([]string{"commit", "-q", "test1", "newimage"})
|
||||
c.WaitWithDefaultTimeout()
|
||||
Expect(c).Should(Exit(0))
|
||||
Expect(c).Should(ExitCleanly())
|
||||
|
||||
inspect := podmanTest.Podman([]string{"inspect", "newimage"})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect).Should(Exit(0))
|
||||
Expect(inspect).Should(ExitCleanly())
|
||||
image := inspect.InspectImageJSON()
|
||||
Expect(image[0].Config.Volumes).To(Not(HaveKey("/foo")))
|
||||
})
|
||||
@ -201,35 +209,35 @@ var _ = Describe("Podman commit", func() {
|
||||
SkipIfRemote("--testing Remote Volumes")
|
||||
s := podmanTest.Podman([]string{"run", "--name", "test1", "-v", "/tmp:/foo", "alpine", "date"})
|
||||
s.WaitWithDefaultTimeout()
|
||||
Expect(s).Should(Exit(0))
|
||||
Expect(s).Should(ExitCleanly())
|
||||
|
||||
c := podmanTest.Podman([]string{"commit", "--include-volumes", "test1", "newimage"})
|
||||
c := podmanTest.Podman([]string{"commit", "-q", "--include-volumes", "test1", "newimage"})
|
||||
c.WaitWithDefaultTimeout()
|
||||
Expect(c).Should(Exit(0))
|
||||
Expect(c).Should(ExitCleanly())
|
||||
|
||||
inspect := podmanTest.Podman([]string{"inspect", "newimage"})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect).Should(Exit(0))
|
||||
Expect(inspect).Should(ExitCleanly())
|
||||
image := inspect.InspectImageJSON()
|
||||
Expect(image[0].Config.Volumes).To(HaveKey("/foo"))
|
||||
|
||||
r := podmanTest.Podman([]string{"run", "newimage"})
|
||||
r.WaitWithDefaultTimeout()
|
||||
Expect(r).Should(Exit(0))
|
||||
Expect(r).Should(ExitCleanly())
|
||||
})
|
||||
|
||||
It("podman commit container check env variables", func() {
|
||||
s := podmanTest.Podman([]string{"run", "--name", "test1", "-e", "TEST=1=1-01=9.01", "alpine", "true"})
|
||||
s.WaitWithDefaultTimeout()
|
||||
Expect(s).Should(Exit(0))
|
||||
Expect(s).Should(ExitCleanly())
|
||||
|
||||
c := podmanTest.Podman([]string{"commit", "test1", "newimage"})
|
||||
c := podmanTest.Podman([]string{"commit", "-q", "test1", "newimage"})
|
||||
c.WaitWithDefaultTimeout()
|
||||
Expect(c).Should(Exit(0))
|
||||
Expect(c).Should(ExitCleanly())
|
||||
|
||||
inspect := podmanTest.Podman([]string{"inspect", "newimage"})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect).Should(Exit(0))
|
||||
Expect(inspect).Should(ExitCleanly())
|
||||
image := inspect.InspectImageJSON()
|
||||
|
||||
envMap := make(map[string]bool)
|
||||
@ -252,9 +260,9 @@ var _ = Describe("Podman commit", func() {
|
||||
Expect(ec).To(Equal(0))
|
||||
Expect(podmanTest.NumberOfContainers()).To(Equal(1))
|
||||
|
||||
session := podmanTest.Podman([]string{"commit", "test1", "foobar.com/test1-image:latest", "--iidfile", targetFile})
|
||||
session := podmanTest.Podman([]string{"commit", "-q", "test1", "foobar.com/test1-image:latest", "--iidfile", targetFile})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
id, _ := os.ReadFile(targetFile)
|
||||
check := podmanTest.Podman([]string{"inspect", "foobar.com/test1-image:latest"})
|
||||
@ -271,16 +279,16 @@ var _ = Describe("Podman commit", func() {
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--secret", "mysecret", "--name", "secr", ALPINE, "cat", "/run/secrets/mysecret"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(Equal(secretsString))
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "secr", "foobar.com/test1-image:latest"})
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "secr", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "foobar.com/test1-image:latest", "cat", "/run/secrets/mysecret"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@ -296,16 +304,16 @@ var _ = Describe("Podman commit", func() {
|
||||
|
||||
session := podmanTest.Podman([]string{"secret", "create", "mysecret", secretFilePath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--secret", "source=mysecret,type=env", "--name", "secr", ALPINE, "printenv", "mysecret"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.OutputToString()).To(Equal(secretsString))
|
||||
|
||||
session = podmanTest.Podman([]string{"commit", "secr", "foobar.com/test1-image:latest"})
|
||||
session = podmanTest.Podman([]string{"commit", "-q", "secr", "foobar.com/test1-image:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "foobar.com/test1-image:latest", "printenv", "mysecret"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@ -316,16 +324,16 @@ var _ = Describe("Podman commit", func() {
|
||||
name := "testcon"
|
||||
s := podmanTest.Podman([]string{"run", "--name", name, "-p", "8585:80", ALPINE, "true"})
|
||||
s.WaitWithDefaultTimeout()
|
||||
Expect(s).Should(Exit(0))
|
||||
Expect(s).Should(ExitCleanly())
|
||||
|
||||
newImageName := "newimage"
|
||||
c := podmanTest.Podman([]string{"commit", name, newImageName})
|
||||
c := podmanTest.Podman([]string{"commit", "-q", name, newImageName})
|
||||
c.WaitWithDefaultTimeout()
|
||||
Expect(c).Should(Exit(0))
|
||||
Expect(c).Should(ExitCleanly())
|
||||
|
||||
inspect := podmanTest.Podman([]string{"inspect", newImageName})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect).Should(Exit(0))
|
||||
Expect(inspect).Should(ExitCleanly())
|
||||
images := inspect.InspectImageJSON()
|
||||
Expect(images).To(HaveLen(1))
|
||||
Expect(images[0].Config.ExposedPorts).To(HaveKey("80/tcp"))
|
||||
@ -333,16 +341,16 @@ var _ = Describe("Podman commit", func() {
|
||||
name = "testcon2"
|
||||
s = podmanTest.Podman([]string{"run", "--name", name, "-d", NGINX_IMAGE})
|
||||
s.WaitWithDefaultTimeout()
|
||||
Expect(s).Should(Exit(0))
|
||||
Expect(s).Should(ExitCleanly())
|
||||
|
||||
newImageName = "newimage2"
|
||||
c = podmanTest.Podman([]string{"commit", name, newImageName})
|
||||
c = podmanTest.Podman([]string{"commit", "-q", name, newImageName})
|
||||
c.WaitWithDefaultTimeout()
|
||||
Expect(c).Should(Exit(0))
|
||||
Expect(c).Should(ExitCleanly())
|
||||
|
||||
inspect = podmanTest.Podman([]string{"inspect", newImageName})
|
||||
inspect.WaitWithDefaultTimeout()
|
||||
Expect(inspect).Should(Exit(0))
|
||||
Expect(inspect).Should(ExitCleanly())
|
||||
images = inspect.InspectImageJSON()
|
||||
Expect(images).To(HaveLen(1))
|
||||
Expect(images[0].Config.ExposedPorts).To(HaveKey("80/tcp"))
|
||||
|
Reference in New Issue
Block a user