From 99f93d55c4f986441f59936e170e71236e64cc70 Mon Sep 17 00:00:00 2001 From: Ed Santiago Date: Wed, 5 Jul 2023 06:47:38 -0600 Subject: [PATCH] e2e: fix two toolbox flakes 1. toolbox UID/GID allocation: pick numbers < 1500. Otherwise we run the risk of colliding with the Cirrus rootless user. 2. WaitContainerReady(): check the results of the last "podman logs" before timing out. Otherwise, the user will see "READY" followed immediately by "Container is not ready". (global bug, not just toolbox, but that's where I discovered it). Signed-off-by: Ed Santiago --- test/e2e/toolbox_test.go | 4 ++-- test/utils/utils.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/e2e/toolbox_test.go b/test/e2e/toolbox_test.go index 6deb7dee54..d4b054c176 100644 --- a/test/e2e/toolbox_test.go +++ b/test/e2e/toolbox_test.go @@ -257,9 +257,9 @@ var _ = Describe("Toolbox-specific testing", func() { var username string = "testuser" var homeDir string = "/home/testuser" var shell string = "/bin/bash" - var uid string = "2000" + var uid string = "1411" var groupName string = "testgroup" - var gid string = "2000" + var gid string = "1422" // The use of bad* in the name of variables does not imply the invocation // of useradd should fail The user is supposed to be created successfully diff --git a/test/utils/utils.go b/test/utils/utils.go index 24c435ac20..205c4edd89 100644 --- a/test/utils/utils.go +++ b/test/utils/utils.go @@ -225,14 +225,14 @@ func (p *PodmanTest) WaitContainerReady(id string, expStr string, timeout int, s s.WaitWithDefaultTimeout() for { + if strings.Contains(s.OutputToString(), expStr) || strings.Contains(s.ErrorToString(), expStr) { + return true + } + if time.Since(startTime) >= time.Duration(timeout)*time.Second { GinkgoWriter.Printf("Container %s is not ready in %ds", id, timeout) return false } - - if strings.Contains(s.OutputToString(), expStr) || strings.Contains(s.ErrorToString(), expStr) { - return true - } time.Sleep(time.Duration(step) * time.Second) s = p.PodmanBase([]string{"logs", id}, false, true) s.WaitWithDefaultTimeout()