diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-02-08 11:35:15 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-08 11:35:15 -0500 |
commit | 2bf13219f587d769400f26aeaed05930c34ce3d7 (patch) | |
tree | 131bf0b8c46d035de443d30b9c9aa5f641a9c19d /test/e2e | |
parent | c32913d0a34def9fd3775ccf7dcef631942ee2b9 (diff) | |
parent | feecdf919f37d34033b58977e6af5c34bf26b6c4 (diff) | |
download | podman-2bf13219f587d769400f26aeaed05930c34ce3d7.tar.gz podman-2bf13219f587d769400f26aeaed05930c34ce3d7.tar.bz2 podman-2bf13219f587d769400f26aeaed05930c34ce3d7.zip |
Merge pull request #9266 from vrothberg/fix-6510
make `podman rmi` more robust
Diffstat (limited to 'test/e2e')
-rw-r--r-- | test/e2e/rmi_test.go | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/e2e/rmi_test.go b/test/e2e/rmi_test.go index 4833a282e..257570ea7 100644 --- a/test/e2e/rmi_test.go +++ b/test/e2e/rmi_test.go @@ -1,7 +1,9 @@ package integration import ( + "fmt" "os" + "sync" . "github.com/containers/podman/v2/test/utils" . "github.com/onsi/ginkgo" @@ -275,4 +277,32 @@ RUN find $LOCAL match, _ := session.ErrorGrepString("image name or ID must be specified") Expect(match).To(BeTrue()) }) + + It("podman image rm - concurrent with shared layers", func() { + // #6510 has shown a fairly simple reproducer to force storage + // errors during parallel image removal. Since it's subject to + // a race, we may not hit the condition a 100 percent of times + // but ocal reproducers hit it all the time. + + var wg sync.WaitGroup + + buildAndRemove := func(i int) { + defer GinkgoRecover() + defer wg.Done() + imageName := fmt.Sprintf("rmtest:%d", i) + containerfile := `FROM quay.io/libpod/cirros:latest +RUN ` + fmt.Sprintf("touch %s", imageName) + + podmanTest.BuildImage(containerfile, imageName, "false") + session := podmanTest.Podman([]string{"rmi", "-f", imageName}) + session.WaitWithDefaultTimeout() + Expect(session).Should(Exit(0)) + } + + wg.Add(10) + for i := 0; i < 10; i++ { + go buildAndRemove(i) + } + wg.Wait() + }) }) |