e2e: make BuildImage parallel-safe

"image rm concurrent" test is still failing, even after #18664:

    Error: no contents in "/tmp/podman_test967723851/Dockerfile"

Probable cause: the images are built in parallel, and p.BuildImage()
writes one single Dockerfile. (This almost certainly renders the
test less effective than intended, since the generated images
might end up being identical).

Solution: write and use a uniquely-named Dockerfile

Signed-off-by: Ed Santiago <santiago@redhat.com>
This commit is contained in:
Ed Santiago
2023-05-30 07:38:10 -06:00
parent 0ab95af371
commit 88e78456db

View File

@ -1188,7 +1188,7 @@ func (s *PodmanSessionIntegration) jq(jqCommand string) (string, error) {
}
func (p *PodmanTestIntegration) buildImage(dockerfile, imageName string, layers string, label string) string {
dockerfilePath := filepath.Join(p.TempDir, "Dockerfile")
dockerfilePath := filepath.Join(p.TempDir, "Dockerfile-"+stringid.GenerateRandomID())
err := os.WriteFile(dockerfilePath, []byte(dockerfile), 0755)
Expect(err).ToNot(HaveOccurred())
cmd := []string{"build", "--pull-never", "--layers=" + layers, "--file", dockerfilePath}