From c0104774068221c4d85f368d54d6e2ccf0ddd42c Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Mon, 5 Oct 2020 11:43:18 -0400 Subject: [PATCH] mantle: fix podman.workflow stop test Sometime between podman 1.x and 2.x podman started putting full 64 character IDs into the json output. Dynamically detect the length of the ID and compare that number of characters. We haven't noticed this test failing because we've been denylisting the test in the pipeline: https://github.com/coreos/coreos-assembler/pull/1478 --- mantle/kola/tests/podman/podman.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mantle/kola/tests/podman/podman.go b/mantle/kola/tests/podman/podman.go index 8bc1dda4b2..abda6d29e9 100644 --- a/mantle/kola/tests/podman/podman.go +++ b/mantle/kola/tests/podman/podman.go @@ -140,7 +140,7 @@ func podmanWorkflow(c cluster.TestCluster) { cmd = fmt.Sprintf("sudo podman run -d -p 80:80 -v %s/index.html:%s/index.html:z %s", string(dir), wwwRoot, image) out := c.MustSSH(m, cmd) - id = string(out)[0:12] + id = string(out)[0:64] podIsRunning := func() error { b, err := c.SSH(m, `curl -f http://localhost 2>/dev/null`) @@ -179,7 +179,10 @@ func podmanWorkflow(c cluster.TestCluster) { found := false for _, container := range psInfo.containers { - if container.ID == id { + // Sometime between podman 1.x and 2.x podman started putting + // full 64 character IDs into the json output. Dynamically detect + // the length of the ID and compare that number of characters. + if container.ID == id[0:len(container.ID)] { found = true if !strings.Contains(strings.ToLower(container.Status), "exited") { c.Fatalf("Container %s was not stopped. Current status: %s", id, container.Status)