mirror of
https://github.com/containers/podman.git
synced 2025-06-22 18:08:11 +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,7 +266,10 @@ RUN find $LOCAL
|
|||||||
podmanTest.AddImageToRWStore(CIRROS_IMAGE)
|
podmanTest.AddImageToRWStore(CIRROS_IMAGE)
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
||||||
buildAndRemove := func(i int) {
|
// Prepare images
|
||||||
|
wg.Add(10)
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
go func(i int) {
|
||||||
defer GinkgoRecover()
|
defer GinkgoRecover()
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
imageName := fmt.Sprintf("rmtest:%d", i)
|
imageName := fmt.Sprintf("rmtest:%d", i)
|
||||||
@ -274,14 +277,22 @@ RUN find $LOCAL
|
|||||||
RUN touch %s`, CIRROS_IMAGE, imageName)
|
RUN touch %s`, CIRROS_IMAGE, imageName)
|
||||||
|
|
||||||
podmanTest.BuildImage(containerfile, imageName, "false")
|
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 := podmanTest.Podman([]string{"rmi", "-f", imageName})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
}
|
}(i)
|
||||||
|
|
||||||
wg.Add(10)
|
|
||||||
for i := 0; i < 10; i++ {
|
|
||||||
go buildAndRemove(i)
|
|
||||||
}
|
}
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user