mirror of
https://github.com/containers/podman.git
synced 2025-10-17 11:14:40 +08:00
e2e: ExitCleanly(): manual fixes to get tests working
Commit 2 of 2: fixes to get tests passing Mostly reverting back to Exit(0) on tests that produce stderr, adding stderr checks when those are missing. One pretty big exception: "run check dns" test was completely broken in many respects. It should never have worked under CNI, but was passing because nslookup in that alpine image was checking /etc/hosts. This has been fixed in subsequent alpine images, which we're now using in this test (CITEST_IMAGE). Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -540,7 +540,7 @@ func (p *PodmanTestIntegration) RunContainerWithNetworkTest(mode string) *Podman
|
||||
if mode != "" {
|
||||
podmanArgs = append(podmanArgs, "--network", mode)
|
||||
}
|
||||
podmanArgs = append(podmanArgs, fedoraMinimal, "curl", "-k", "-o", "/dev/null", "http://www.redhat.com:80")
|
||||
podmanArgs = append(podmanArgs, fedoraMinimal, "curl", "-s", "-S", "-k", "-o", "/dev/null", "http://www.redhat.com:80")
|
||||
session := p.Podman(podmanArgs)
|
||||
return session
|
||||
}
|
||||
|
@ -20,10 +20,6 @@ import (
|
||||
|
||||
var _ = Describe("Podman run networking", func() {
|
||||
|
||||
BeforeEach(func() {
|
||||
Skip("TEMPORARY: to not break git-bisect")
|
||||
})
|
||||
|
||||
hostname, _ := os.Hostname()
|
||||
|
||||
It("podman verify network scoped DNS server and also verify updating network dns server", func() {
|
||||
@ -591,8 +587,8 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
||||
ncListener.WaitWithDefaultTimeout()
|
||||
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(ncListener).Should(ExitCleanly())
|
||||
Expect(ncListener.ErrorToString()).To(ContainSubstring("127.0.0.1"))
|
||||
Expect(ncListener).Should(Exit(0))
|
||||
Expect(ncListener.ErrorToString()).To(ContainSubstring("Connection from 127.0.0.1"))
|
||||
} else {
|
||||
session := podmanTest.Podman([]string{"run", "--network", networkConfiguration, "-dt", ALPINE, "nc", "-w", "2", "10.0.2.2", fmt.Sprintf("%d", port)})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@ -621,8 +617,8 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
||||
ncListener.Wait(30)
|
||||
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(ncListener).Should(ExitCleanly())
|
||||
Expect(ncListener.ErrorToString()).To(ContainSubstring(ip.String()))
|
||||
Expect(ncListener).Should(Exit(0))
|
||||
Expect(ncListener.ErrorToString()).To(ContainSubstring("Connection from " + ip.String()))
|
||||
} else {
|
||||
session := podmanTest.Podman([]string{"run", "--network", networkConfiguration, ALPINE, "nc", "-w", "2", "10.0.2.2", fmt.Sprintf("%d", port)})
|
||||
session.Wait(30)
|
||||
@ -662,7 +658,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
||||
SkipIfRootless("sctp protocol only works as root")
|
||||
session := podmanTest.Podman([]string{"--log-level=info", "run", "--name=test", "-p", "80/sctp", "-p", "81/sctp", ALPINE})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session).Should(Exit(0))
|
||||
// we can only check logrus on local podman
|
||||
if !IsRemote() {
|
||||
// check that the info message for sctp protocol is only displayed once
|
||||
@ -1101,6 +1097,7 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
||||
})
|
||||
|
||||
It("podman run check dns", func() {
|
||||
SkipIfCNI(podmanTest)
|
||||
pod := "testpod"
|
||||
session := podmanTest.Podman([]string{"pod", "create", "--name", pod})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@ -1118,24 +1115,24 @@ EXPOSE 2004-2005/tcp`, ALPINE)
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con1", "--network", net, ALPINE, "nslookup", "con1"})
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con1", "--network", net, CITEST_IMAGE, "nslookup", "con1"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con2", "--pod", pod, "--network", net, ALPINE, "nslookup", "con2"})
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con2", "--pod", pod, "--network", net, CITEST_IMAGE, "nslookup", "con2"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con3", "--pod", pod2, ALPINE, "nslookup", "con1"})
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con3", "--pod", pod2, CITEST_IMAGE, "nslookup", "con1"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(1))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("can't resolve 'con1'"))
|
||||
Expect(session.OutputToString()).To(ContainSubstring("server can't find con1.dns.podman: NXDOMAIN"))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con4", "--network", net, ALPINE, "nslookup", pod2 + ".dns.podman"})
|
||||
session = podmanTest.Podman([]string{"run", "--name", "con4", "--network", net, CITEST_IMAGE, "nslookup", pod2 + ".dns.podman"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--network", net, ALPINE, "nslookup", hostname})
|
||||
session = podmanTest.Podman([]string{"run", "--network", net, CITEST_IMAGE, "nslookup", hostname})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
})
|
||||
|
@ -22,10 +22,6 @@ import (
|
||||
|
||||
var _ = Describe("Podman run", func() {
|
||||
|
||||
BeforeEach(func() {
|
||||
Skip("TEMPORARY: to not break git-bisect")
|
||||
})
|
||||
|
||||
It("podman run a container based on local image", func() {
|
||||
session := podmanTest.Podman([]string{"run", ALPINE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
@ -90,7 +86,7 @@ var _ = Describe("Podman run", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
session = podmanTest.Podman([]string{"build", "-f", "build/Containerfile.with-platform", "--platform", "linux/amd64,linux/arm64", "--manifest", "localhost/test:latest"})
|
||||
session = podmanTest.Podman([]string{"build", "-q", "-f", "build/Containerfile.with-platform", "--platform", "linux/amd64,linux/arm64", "--manifest", "localhost/test:latest"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
|
||||
@ -127,7 +123,8 @@ var _ = Describe("Podman run", func() {
|
||||
Expect(session).To(ExitWithError())
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("unknown flag"))
|
||||
} else {
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("Getting image source signatures"))
|
||||
}
|
||||
})
|
||||
|
||||
@ -1509,14 +1506,16 @@ VOLUME %s`, ALPINE, volPath, volPath)
|
||||
|
||||
container := podmanTest.PodmanSystemdScope([]string{"run", "--rm", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"})
|
||||
container.WaitWithDefaultTimeout()
|
||||
Expect(container).Should(ExitCleanly())
|
||||
Expect(container).Should(Exit(0))
|
||||
checkLines(container.OutputToStringArray())
|
||||
Expect(container.ErrorToString()).To(ContainSubstring("Running scope as unit: "))
|
||||
|
||||
// check that --cgroups=split is honored also when a container runs in a pod
|
||||
container = podmanTest.PodmanSystemdScope([]string{"run", "--rm", "--pod", "new:split-test-pod", "--cgroups=split", ALPINE, "cat", "/proc/self/cgroup"})
|
||||
container.WaitWithDefaultTimeout()
|
||||
Expect(container).Should(ExitCleanly())
|
||||
Expect(container).Should(Exit(0))
|
||||
checkLines(container.OutputToStringArray())
|
||||
Expect(container.ErrorToString()).To(ContainSubstring("Running scope as unit: "))
|
||||
})
|
||||
|
||||
It("podman run with cgroups=disabled runs without cgroups", func() {
|
||||
@ -1749,13 +1748,15 @@ WORKDIR /madethis`, BB)
|
||||
It("podman run a container with log-level (lower case)", func() {
|
||||
session := podmanTest.Podman([]string{"--log-level=info", "run", ALPINE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring(" level=info "))
|
||||
})
|
||||
|
||||
It("podman run a container with log-level (upper case)", func() {
|
||||
session := podmanTest.Podman([]string{"--log-level=INFO", "run", ALPINE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring(" level=info "))
|
||||
})
|
||||
|
||||
It("podman run a container with --pull never should fail if no local store", func() {
|
||||
@ -1767,24 +1768,23 @@ WORKDIR /madethis`, BB)
|
||||
It("podman run container with --pull missing and only pull once", func() {
|
||||
session := podmanTest.Podman([]string{"run", "--pull", "missing", CIRROS_IMAGE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--pull", "missing", CIRROS_IMAGE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session.ErrorToString()).ToNot(ContainSubstring("Trying to pull"))
|
||||
})
|
||||
|
||||
It("podman run container with --pull missing should pull image multiple times", func() {
|
||||
session := podmanTest.Podman([]string{"run", "--pull", "always", CIRROS_IMAGE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--pull", "always", CIRROS_IMAGE, "ls"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
|
||||
})
|
||||
|
||||
@ -2095,7 +2095,7 @@ WORKDIR /madethis`, BB)
|
||||
|
||||
session = podmanTest.Podman([]string{"run", "--decryption-key", privateKeyFileName, imgPath})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(ExitCleanly())
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull"))
|
||||
})
|
||||
|
||||
|
@ -23,7 +23,6 @@ LABEL RUN podman run --name NAME IMAGE`, ALPINE)
|
||||
var _ = Describe("podman container runlabel", func() {
|
||||
|
||||
BeforeEach(func() {
|
||||
Skip("TEMPORARY: to not break git-bisect")
|
||||
SkipIfRemote("runlabel is not supported for remote connections")
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user