From f517e5216763f9e51729fa277e8e0045a484d950 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Thu, 10 Oct 2024 12:00:25 +0200 Subject: [PATCH] test/e2e: try debug potential pasta issue Run pasta with --trace and a log file to see if the hangs are caused by pasta not correctly closing connections as assumed in #24219. As the log is super verbose do not log it by default so I added some extra logic to make sure it is only logged when the test fails. Signed-off-by: Paul Holzinger --- test/e2e/pull_test.go | 25 ++++++++++++++++++++++++- test/e2e/run_test.go | 27 ++++++++++++++++++++++++++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/test/e2e/pull_test.go b/test/e2e/pull_test.go index 5523047ab9..ccc508df42 100644 --- a/test/e2e/pull_test.go +++ b/test/e2e/pull_test.go @@ -4,6 +4,7 @@ package integration import ( "fmt" + "io" "os" "path/filepath" "runtime" @@ -664,13 +665,33 @@ var _ = Describe("Podman pull", func() { podmanTest.AddImageToRWStore(ALPINE) + success := false + registryArgs := []string{"run", "-d", "--name", "registry", "-p", "5012:5000"} if isRootless() { err := podmanTest.RestoreArtifact(REGISTRY_IMAGE) Expect(err).ToNot(HaveOccurred()) + + // Debug code for https://github.com/containers/podman/issues/24219 + logFile := filepath.Join(podmanTest.TempDir, "pasta.log") + registryArgs = append(registryArgs, "--network", "pasta:--trace,--log-file,"+logFile) + defer func() { + if success { + // only print the log on errors otherwise it will clutter CI logs way to much + return + } + + f, err := os.Open(logFile) + Expect(err).ToNot(HaveOccurred()) + defer f.Close() + GinkgoWriter.Println("pasta trace log:") + _, err = io.Copy(GinkgoWriter, f) + Expect(err).ToNot(HaveOccurred()) + }() } + registryArgs = append(registryArgs, REGISTRY_IMAGE, "/entrypoint.sh", "/etc/docker/registry/config.yml") lock := GetPortLock("5012") defer lock.Unlock() - session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5012:5000", REGISTRY_IMAGE, "/entrypoint.sh", "/etc/docker/registry/config.yml"}) + session := podmanTest.Podman(registryArgs) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -683,6 +704,8 @@ var _ = Describe("Podman pull", func() { session = decryptionTestHelper(imgPath) Expect(session.LineInOutputContainsTag(imgPath, "latest")).To(BeTrue()) + + success = true }) }) diff --git a/test/e2e/run_test.go b/test/e2e/run_test.go index 0e74eacea8..b956a8a9cd 100644 --- a/test/e2e/run_test.go +++ b/test/e2e/run_test.go @@ -4,6 +4,7 @@ package integration import ( "fmt" + "io" "net" "os" "path/filepath" @@ -2182,9 +2183,31 @@ WORKDIR /madethis`, BB) podmanTest.AddImageToRWStore(ALPINE) + success := false + registryArgs := []string{"run", "-d", "--name", "registry", "-p", "5006:5000"} + if isRootless() { + // Debug code for https://github.com/containers/podman/issues/24219 + logFile := filepath.Join(podmanTest.TempDir, "pasta.log") + registryArgs = append(registryArgs, "--network", "pasta:--trace,--log-file,"+logFile) + defer func() { + if success { + // only print the log on errors otherwise it will clutter CI logs way to much + return + } + + f, err := os.Open(logFile) + Expect(err).ToNot(HaveOccurred()) + defer f.Close() + GinkgoWriter.Println("pasta trace log:") + _, err = io.Copy(GinkgoWriter, f) + Expect(err).ToNot(HaveOccurred()) + }() + } + registryArgs = append(registryArgs, REGISTRY_IMAGE, "/entrypoint.sh", "/etc/docker/registry/config.yml") + lock := GetPortLock("5006") defer lock.Unlock() - session := podmanTest.Podman([]string{"run", "-d", "--name", "registry", "-p", "5006:5000", REGISTRY_IMAGE, "/entrypoint.sh", "/etc/docker/registry/config.yml"}) + session := podmanTest.Podman(registryArgs) session.WaitWithDefaultTimeout() Expect(session).Should(ExitCleanly()) @@ -2218,6 +2241,8 @@ WORKDIR /madethis`, BB) session.WaitWithDefaultTimeout() Expect(session).Should(Exit(0)) Expect(session.ErrorToString()).To(ContainSubstring("Trying to pull " + imgPath)) + + success = true }) It("podman run --shm-size-systemd", func() {