From 17916156129fa40fadd57c99bdcd285e763f5859 Mon Sep 17 00:00:00 2001 From: apostasie Date: Mon, 23 Jun 2025 14:26:45 -0700 Subject: [PATCH] Kube test: wait for image Signed-off-by: apostasie --- .../container/container_commit_linux_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/cmd/nerdctl/container/container_commit_linux_test.go b/cmd/nerdctl/container/container_commit_linux_test.go index 5ddbf501643..3bd5b98cf42 100644 --- a/cmd/nerdctl/container/container_commit_linux_test.go +++ b/cmd/nerdctl/container/container_commit_linux_test.go @@ -19,6 +19,7 @@ package container import ( "strings" "testing" + "time" "github.com/containerd/nerdctl/mod/tigron/test" "github.com/containerd/nerdctl/mod/tigron/tig" @@ -55,6 +56,20 @@ func TestKubeCommitSave(t *testing.T) { testCase.Command = func(data test.Data, helpers test.Helpers) test.TestableCommand { helpers.Ensure("commit", data.Labels().Get("containerID"), data.Identifier("testcommitsave")) + // Wait for the image to show up + for range 5 { + found := false + cmd := helpers.Command("images", data.Identifier("testcommitsave"), "--format", "json") + cmd.Run(&test.Expected{ + Output: func(stdout string, t tig.T) { + found = strings.TrimSpace(stdout) != "" + }, + }) + if found { + break + } + time.Sleep(1 * time.Second) + } return helpers.Command("save", data.Identifier("testcommitsave")) }