mirror of
https://github.com/containers/podman.git
synced 2025-06-30 15:49:03 +08:00
Fix test flakes caused by improper podman-logs
This one has been a thorn in my side: it's a podman-log issue, but not remote, so I _almost_ retitled #16132 (removing "remote"). Nope, it's a bug in the tests themselves. One solution would be to podman-wait, but I see no reason for logs to be involved, so I went with podman start -a instead. This removes the k8s-log stuff which is no longer necessary. Cleanup all around. Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
@ -54,10 +54,8 @@ var _ = Describe("Podman create with --ip flag", func() {
|
||||
})
|
||||
|
||||
It("Podman create with specified static IP has correct IP", func() {
|
||||
// NOTE: we force the k8s-file log driver to make sure the
|
||||
// tests are passing inside a container.
|
||||
ip := GetRandomIPAddress()
|
||||
result := podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test", "--ip", ip, ALPINE, "ip", "addr"})
|
||||
result := podmanTest.Podman([]string{"create", "--name", "test", "--ip", ip, ALPINE, "ip", "addr"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
// Rootless static ip assignment without network should error
|
||||
if rootless.IsRootless() {
|
||||
@ -65,11 +63,7 @@ var _ = Describe("Podman create with --ip flag", func() {
|
||||
} else {
|
||||
Expect(result).Should(Exit(0))
|
||||
|
||||
result = podmanTest.Podman([]string{"start", "test"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
|
||||
result = podmanTest.Podman([]string{"logs", "test"})
|
||||
result = podmanTest.Podman([]string{"start", "-a", "test"})
|
||||
result.WaitWithDefaultTimeout()
|
||||
Expect(result).Should(Exit(0))
|
||||
Expect(result.OutputToString()).To(ContainSubstring(ip + "/16"))
|
||||
|
@ -155,11 +155,7 @@ var _ = Describe("Podman create", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
session = podmanTest.Podman([]string{"start", "test"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
|
||||
session = podmanTest.Podman([]string{"logs", "test"})
|
||||
session = podmanTest.Podman([]string{"start", "-a", "test"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToString()).ToNot(ContainSubstring("cannot touch"))
|
||||
@ -169,41 +165,30 @@ var _ = Describe("Podman create", func() {
|
||||
if podmanTest.Host.Arch == "ppc64le" {
|
||||
Skip("skip failing test on ppc64le")
|
||||
}
|
||||
// NOTE: we force the k8s-file log driver to make sure the
|
||||
// tests are passing inside a container.
|
||||
|
||||
mountPath := filepath.Join(podmanTest.TempDir, "secrets")
|
||||
err := os.Mkdir(mountPath, 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session := podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
|
||||
session := podmanTest.Podman([]string{"create", "--name", "test", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
session = podmanTest.Podman([]string{"start", "test"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
session = podmanTest.Podman([]string{"logs", "test"})
|
||||
session = podmanTest.Podman([]string{"start", "-a", "test"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToString()).To(ContainSubstring("/create/test rw"))
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test_ro", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test,ro", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
|
||||
session = podmanTest.Podman([]string{"create", "--name", "test_ro", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test,ro", mountPath), ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
session = podmanTest.Podman([]string{"start", "test_ro"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
session = podmanTest.Podman([]string{"logs", "test_ro"})
|
||||
session = podmanTest.Podman([]string{"start", "-a", "test_ro"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToString()).To(ContainSubstring("/create/test ro"))
|
||||
|
||||
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test_shared", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test,shared", mountPath), ALPINE, "awk", `$5 == "/create/test" { print $6 " " $7}`, "/proc/self/mountinfo"})
|
||||
session = podmanTest.Podman([]string{"create", "--name", "test_shared", "--mount", fmt.Sprintf("type=bind,src=%s,target=/create/test,shared", mountPath), ALPINE, "awk", `$5 == "/create/test" { print $6 " " $7}`, "/proc/self/mountinfo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
session = podmanTest.Podman([]string{"start", "test_shared"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
session = podmanTest.Podman([]string{"logs", "test_shared"})
|
||||
session = podmanTest.Podman([]string{"start", "-a", "test_shared"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToString()).To(ContainSubstring("rw"))
|
||||
@ -212,13 +197,10 @@ var _ = Describe("Podman create", func() {
|
||||
mountPath = filepath.Join(podmanTest.TempDir, "scratchpad")
|
||||
err = os.Mkdir(mountPath, 0755)
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
session = podmanTest.Podman([]string{"create", "--log-driver", "k8s-file", "--name", "test_tmpfs", "--mount", "type=tmpfs,target=/create/test", ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
|
||||
session = podmanTest.Podman([]string{"create", "--name", "test_tmpfs", "--mount", "type=tmpfs,target=/create/test", ALPINE, "grep", "/create/test", "/proc/self/mountinfo"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
session = podmanTest.Podman([]string{"start", "test_tmpfs"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
session = podmanTest.Podman([]string{"logs", "test_tmpfs"})
|
||||
session = podmanTest.Podman([]string{"start", "-a", "test_tmpfs"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToString()).To(ContainSubstring("/create/test rw,nosuid,nodev,relatime - tmpfs"))
|
||||
|
Reference in New Issue
Block a user