Fix a potential flake in volume plugins tests

We could remove the container running the volume plugins, before
the containers using the volume plugins; this could cause
unmounting the volumes to fail because the plugin could not be
contacted.

Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
Matthew Heon
2022-02-17 09:46:35 -05:00
parent f918a9418f
commit 1252f9dd33

View File

@ -166,11 +166,13 @@ var _ = Describe("Podman volume plugins", func() {
create.WaitWithDefaultTimeout() create.WaitWithDefaultTimeout()
Expect(create).Should(Exit(0)) Expect(create).Should(Exit(0))
ctr1 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "sh", "-c", "touch /test/testfile && echo helloworld > /test/testfile"}) ctr1Name := "ctr1"
ctr1 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "--name", ctr1Name, "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "sh", "-c", "touch /test/testfile && echo helloworld > /test/testfile"})
ctr1.WaitWithDefaultTimeout() ctr1.WaitWithDefaultTimeout()
Expect(ctr1).Should(Exit(0)) Expect(ctr1).Should(Exit(0))
ctr2 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "cat", "/test/testfile"}) ctr2Name := "ctr2"
ctr2 := podmanTest.Podman([]string{"run", "--security-opt", "label=disable", "--name", ctr2Name, "-v", fmt.Sprintf("%v:/test", volName), ALPINE, "cat", "/test/testfile"})
ctr2.WaitWithDefaultTimeout() ctr2.WaitWithDefaultTimeout()
Expect(ctr2).Should(Exit(0)) Expect(ctr2).Should(Exit(0))
Expect(ctr2.OutputToString()).To(ContainSubstring("helloworld")) Expect(ctr2.OutputToString()).To(ContainSubstring("helloworld"))
@ -178,7 +180,7 @@ var _ = Describe("Podman volume plugins", func() {
// HACK: `volume rm -f` is timing out trying to remove containers using the volume. // HACK: `volume rm -f` is timing out trying to remove containers using the volume.
// Solution: remove them manually... // Solution: remove them manually...
// TODO: fix this when I get back // TODO: fix this when I get back
rmAll := podmanTest.Podman([]string{"rm", "-af"}) rmAll := podmanTest.Podman([]string{"rm", "-f", ctr2Name, ctr1Name})
rmAll.WaitWithDefaultTimeout() rmAll.WaitWithDefaultTimeout()
Expect(rmAll).Should(Exit(0)) Expect(rmAll).Should(Exit(0))
}) })