In a concurrent removal test, don't remove concurrently with builds

This test is intended to test concurrent removals, so don't
risk a removal breaking a build.

Fixes #18659 .

(The sitaution that removals can break a build WIP is a real
problem that should be fixed, but that's not a target of this test.)

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač
2023-05-23 18:14:33 +02:00
parent c894a12b74
commit fb8a124905

View File

@ -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()
})