mirror of
https://github.com/containers/podman.git
synced 2025-06-22 01:48:54 +08:00
Merge pull request #18664 from mtrmac/rm-concurrent-flake
In a concurrent removal test, don't remove concurrently with builds
This commit is contained in:
@ -266,22 +266,33 @@ RUN find $LOCAL
|
||||
podmanTest.AddImageToRWStore(CIRROS_IMAGE)
|
||||
var wg sync.WaitGroup
|
||||
|
||||
buildAndRemove := func(i int) {
|
||||
defer GinkgoRecover()
|
||||
defer wg.Done()
|
||||
imageName := fmt.Sprintf("rmtest:%d", i)
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
RUN touch %s`, CIRROS_IMAGE, imageName)
|
||||
|
||||
podmanTest.BuildImage(containerfile, imageName, "false")
|
||||
session := podmanTest.Podman([]string{"rmi", "-f", imageName})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
}
|
||||
|
||||
// Prepare images
|
||||
wg.Add(10)
|
||||
for i := 0; i < 10; i++ {
|
||||
go buildAndRemove(i)
|
||||
go func(i int) {
|
||||
defer GinkgoRecover()
|
||||
defer wg.Done()
|
||||
imageName := fmt.Sprintf("rmtest:%d", i)
|
||||
containerfile := fmt.Sprintf(`FROM %s
|
||||
RUN touch %s`, CIRROS_IMAGE, imageName)
|
||||
|
||||
podmanTest.BuildImage(containerfile, imageName, "false")
|
||||
}(i)
|
||||
}
|
||||
wg.Wait()
|
||||
|
||||
// A herd of concurrent removals
|
||||
wg.Add(10)
|
||||
for i := 0; i < 10; i++ {
|
||||
go func(i int) {
|
||||
defer GinkgoRecover()
|
||||
defer wg.Done()
|
||||
|
||||
imageName := fmt.Sprintf("rmtest:%d", i)
|
||||
session := podmanTest.Podman([]string{"rmi", "-f", imageName})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
}(i)
|
||||
}
|
||||
wg.Wait()
|
||||
})
|
||||
|
Reference in New Issue
Block a user