test/e2e: fix and re-enable healthcheck run test flake

The 'podman healthcheck on valid container' test was skipped since 2019 due to a consistent flake. The root cause was a brittle manual 5-second polling loop that failed on heavily loaded CI runners before the healthcheck daemon could initialize.

This commit modernizes the polling logic by replacing the manual loop with Ginkgo's robust Eventually block with a 30-second timeout, allowing the test to run reliably on all environments, and removes the Skip directive.

Signed-off-by: Aryanbhargava18 <aryanbhargava644@gmail.com>
This commit is contained in:
Aryanbhargava18 2026-07-29 20:12:56 +05:30
parent 30234265b2
commit b050cb8a80

View file

@ -103,24 +103,17 @@ var _ = Describe("Podman healthcheck run", func() {
})
It("podman healthcheck on valid container", func() {
Skip("Extremely consistent flake - re-enable on debugging")
SkipIfNotAMD64() // https://github.com/containers/podman/issues/28269
session := podmanTest.Podman([]string{"run", "-dt", "--name", "hc", HEALTHCHECK_IMAGE})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
exitCode := 999
// Buy a little time to get container running
for i := range 5 {
Eventually(func() int {
hc := podmanTest.Podman([]string{"healthcheck", "run", "hc"})
hc.WaitWithDefaultTimeout()
exitCode = hc.ExitCode()
if exitCode == 0 || i == 4 {
break
}
time.Sleep(1 * time.Second)
}
Expect(exitCode).To(Equal(0))
return hc.ExitCode()
}, 30*time.Second, 1*time.Second).Should(Equal(0))
ps := podmanTest.Podman([]string{"ps"})
ps.WaitWithDefaultTimeout()