Skip to content

Commit

Permalink
mantle: fix podman.workflow stop test
Browse files Browse the repository at this point in the history
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: coreos#1478
  • Loading branch information
dustymabe committed Oct 5, 2020
1 parent 6c15e32 commit c010477
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mantle/kola/tests/podman/podman.go
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c010477

Please sign in to comment.