From b71273be851d40a48c7b442ac4b7981d2a1830b7 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 29 Sep 2026 13:03:28 +0200 Subject: [PATCH 1/2] test/e2e: remove duplicated test logic The kube down test does the exact same thing already so there is really no need to duplicate this in the interest of test runtime. Signed-off-by: Paul Holzinger --- test/e2e/play_kube_test.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index 3872707f2c..b99b42f30e 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -6967,16 +6967,6 @@ RUN echo "nested-build-marker" > /nested-marker`), 0o644)).To(Succeed()) podsCount := podmanTest.PodmanExitCleanly("pod", "ps", "-n") Expect(podsCount.OutputToStringArray()).To(HaveLen(2)) - }) - - It("multiple Pod replicas down", func() { - err := writeYaml(replicasPodYaml, kubeYaml) - Expect(err).ToNot(HaveOccurred()) - - podmanTest.PodmanExitCleanly("kube", "play", "-q", "--multiple-pods", "--publish", fmt.Sprintf("%d:%d,%d:%d", GetPort(), 80, GetPort(), 80), kubeYaml) - - podsCount := podmanTest.PodmanExitCleanly("pod", "ps", "-n") - Expect(podsCount.OutputToStringArray()).To(HaveLen(2)) podmanTest.PodmanExitCleanly("kube", "down", kubeYaml) From b2262db560675b97519606df3b4739c9b00e6d97 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Tue, 29 Sep 2026 13:12:32 +0200 Subject: [PATCH 2/2] test/e2e: fix flake in "multiple Pod replicas" GetPort() may return the same port twice, ensure we avoid the case to not make the startup fail on a port conflict. I saw this fail in CI once: $ podman [options] kube play -q --multiple-pods --publish 5811:80,5811:80 /tmp/podman-e2e-759165132/subtest-4128675097/p/ptemp/kube.yaml starting container b0aea9c7e396: rootlessport listen tcp :5811: bind: address already in use Signed-off-by: Paul Holzinger --- test/e2e/play_kube_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go index b99b42f30e..a950542259 100644 --- a/test/e2e/play_kube_test.go +++ b/test/e2e/play_kube_test.go @@ -6963,7 +6963,22 @@ RUN echo "nested-build-marker" > /nested-marker`), 0o644)).To(Succeed()) err := writeYaml(replicasPodYaml, kubeYaml) Expect(err).ToNot(HaveOccurred()) - podmanTest.PodmanExitCleanly("kube", "play", "-q", "--multiple-pods", "--publish", fmt.Sprintf("%d:%d,%d:%d", GetPort(), 80, GetPort(), 80), kubeYaml) + port1 := GetPort() + port2 := 0 + // Nothing in GetPort() ensures we will not get the same port twice, if we do, this test would fail. + // Thus make sure it does not happen to avoid flakes. + const iter = 1000 + for i := range iter { + port2 = GetPort() + if port2 != port1 { + break + } + if i == iter-1 { + Fail("No second free port found") + } + } + + podmanTest.PodmanExitCleanly("kube", "play", "-q", "--multiple-pods", "--publish", fmt.Sprintf("%d:%d,%d:%d", port1, 80, port2, 80), kubeYaml) podsCount := podmanTest.PodmanExitCleanly("pod", "ps", "-n") Expect(podsCount.OutputToStringArray()).To(HaveLen(2))