podman: run --replace prints only the new container id

print only the new container ID when using --replace instead of the
terminated container ID if it was stopped.

Closes: https://github.com/containers/podman/issues/20185

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2023-09-28 15:41:19 +02:00
parent 35824b647c
commit f21c1d238d
3 changed files with 13 additions and 6 deletions

View File

@@ -1615,9 +1615,12 @@ VOLUME %s`, ALPINE, volPath, volPath)
// Run and replace 5 times in a row the "same" container.
ctrName := "testCtr"
for i := 0; i < 5; i++ {
session := podmanTest.Podman([]string{"run", "--detach", "--replace", "--name", ctrName, ALPINE, "/bin/sh"})
session := podmanTest.Podman([]string{"run", "--detach", "--replace", "--name", ctrName, ALPINE, "top"})
session.WaitWithDefaultTimeout()
Expect(session).Should(ExitCleanly())
// make sure Podman prints only one ID
Expect(session.OutputToString()).To(HaveLen(64))
}
})