Revert "test/e2e: build in subdirectory"

This reverts commit 79e7b0f6fd.

With the proper tmpdir split we no longer need this.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2026-06-15 16:26:53 +02:00
parent 6e20527004
commit 776bcd74c2
4 changed files with 12 additions and 41 deletions

View File

@@ -1551,11 +1551,8 @@ func (s *PodmanSessionIntegration) jq(jqCommand string) (string, error) {
}
func (p *PodmanTestIntegration) buildImage(dockerfile, imageName string, layers string, label string, extraOptions []string) string {
buildDir := filepath.Join(p.TempDir, "build"+stringid.GenerateRandomID())
err := os.Mkdir(buildDir, 0o755)
Expect(err).ToNot(HaveOccurred())
dockerfilePath := filepath.Join(buildDir, "Dockerfile-"+stringid.GenerateRandomID())
err = os.WriteFile(dockerfilePath, []byte(dockerfile), 0o644)
dockerfilePath := filepath.Join(p.TempDir, "Dockerfile-"+stringid.GenerateRandomID())
err := os.WriteFile(dockerfilePath, []byte(dockerfile), 0o755)
Expect(err).ToNot(HaveOccurred())
cmd := []string{"build", "--pull-never", "--layers=" + layers, "--file", dockerfilePath}
if label != "" {
@@ -1567,7 +1564,7 @@ func (p *PodmanTestIntegration) buildImage(dockerfile, imageName string, layers
if len(extraOptions) > 0 {
cmd = append(cmd, extraOptions...)
}
cmd = append(cmd, buildDir)
cmd = append(cmd, p.TempDir)
session := p.Podman(cmd)
session.Wait(240)
Expect(session).Should(Exit(0), fmt.Sprintf("BuildImage session output: %q", session.OutputToString()))

View File

@@ -10,17 +10,12 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
. "go.podman.io/podman/v6/test/utils"
"go.podman.io/storage/pkg/stringid"
)
func buildDataVolumeImage(pTest *PodmanTestIntegration, image, data, dest string) {
buildDir := filepath.Join(pTest.TempDir, "build"+stringid.GenerateRandomID())
err := os.Mkdir(buildDir, 0o755)
Expect(err).ToNot(HaveOccurred())
// Create a dummy file for data volume
dummyFile := filepath.Join(buildDir, data)
err = os.WriteFile(dummyFile, []byte(data), 0o644)
dummyFile := filepath.Join(pTest.TempDir, data)
err := os.WriteFile(dummyFile, []byte(data), 0o644)
Expect(err).ToNot(HaveOccurred())
// Create a data volume container image but no CMD binary in it
@@ -28,11 +23,7 @@ func buildDataVolumeImage(pTest *PodmanTestIntegration, image, data, dest string
CMD doesnotexist.sh
ADD %s %s/
VOLUME %s/`, data, dest, dest)
containerFilePath := filepath.Join(buildDir, "Containerfile")
err = os.WriteFile(containerFilePath, []byte(containerFile), 0o644)
Expect(err).ToNot(HaveOccurred())
pTest.PodmanExitCleanly("build", "--pull-never", "-q", "-t", image, "--layers=false", "--file", containerFilePath)
pTest.BuildImage(containerFile, image, "false")
}
func createContainersConfFile(pTest *PodmanTestIntegration) {

View File

@@ -20,7 +20,6 @@ import (
"go.podman.io/common/pkg/sysinfo"
"go.podman.io/podman/v6/pkg/util"
. "go.podman.io/podman/v6/test/utils"
"go.podman.io/storage/pkg/stringid"
)
var _ = Describe("Podman pod create", func() {
@@ -176,12 +175,8 @@ var _ = Describe("Podman pod create", func() {
Describe("podman create pod with --hosts-file", func() {
BeforeEach(func() {
buildDir := filepath.Join(podmanTest.TempDir, "build"+stringid.GenerateRandomID())
err := os.Mkdir(buildDir, 0o755)
Expect(err).ToNot(HaveOccurred())
imageHosts := filepath.Join(buildDir, "pause_hosts")
err = os.WriteFile(imageHosts, []byte("56.78.12.34 image.example.com"), 0o755)
imageHosts := filepath.Join(podmanTest.TempDir, "pause_hosts")
err := os.WriteFile(imageHosts, []byte("56.78.12.34 image.example.com"), 0o755)
Expect(err).ToNot(HaveOccurred())
configHosts := filepath.Join(podmanTest.TempDir, "hosts")
@@ -196,16 +191,11 @@ var _ = Describe("Podman pod create", func() {
podmanTest.RestartRemoteService()
}
containerfile := strings.Join([]string{
dockerfile := strings.Join([]string{
`FROM ` + INFRA_IMAGE,
`COPY pause_hosts /etc/hosts`,
}, "\n")
containerFilePath := filepath.Join(buildDir, "Containerfile")
err = os.WriteFile(containerFilePath, []byte(containerfile), 0o644)
Expect(err).ToNot(HaveOccurred())
podmanTest.PodmanExitCleanly("build", "-q", "-t", "foobar.com/hosts_test_pause:latest", "--layers=false", "--no-hosts", buildDir)
podmanTest.BuildImage(dockerfile, "foobar.com/hosts_test_pause:latest", "false", "--no-hosts")
})
It("--hosts-file=path", func() {

View File

@@ -69,18 +69,11 @@ func pullChunkedTests() { // included in pull_test.go, must use a Ginkgo DSL at
registryRef: pullChunkedRegistryPrefix + "chunked-normal",
dirPath: filepath.Join(imageDir, "chunked-normal"),
}
buildDir := filepath.Join(podmanTest.TempDir, "build")
err := os.Mkdir(buildDir, 0o755)
Expect(err).ToNot(HaveOccurred())
chunkedNormalContentPath := "chunked-normal-image-content"
err = os.WriteFile(filepath.Join(buildDir, chunkedNormalContentPath), fmt.Appendf(nil, "content-%d", rand.Int64()), 0o600)
err := os.WriteFile(filepath.Join(podmanTest.TempDir, chunkedNormalContentPath), fmt.Appendf(nil, "content-%d", rand.Int64()), 0o600)
Expect(err).NotTo(HaveOccurred())
chunkedNormalContainerFile := fmt.Sprintf("FROM scratch\nADD %s /content", chunkedNormalContentPath)
err = os.WriteFile(filepath.Join(buildDir, "Containerfile"), []byte(chunkedNormalContainerFile), 0o600)
Expect(err).NotTo(HaveOccurred())
podmanTest.PodmanExitCleanly("build", "-q", "-t", chunkedNormal.localTag(), "--layers=true", buildDir)
podmanTest.BuildImage(chunkedNormalContainerFile, chunkedNormal.localTag(), "true")
podmanTest.PodmanExitCleanly("push", "-q", "--tls-verify=false", "--force-compression", "--compression-format=zstd:chunked", chunkedNormal.localTag(), chunkedNormal.registryRef)
skopeo := SystemExec("skopeo", []string{"copy", "-q", "--preserve-digests", "--all", "--src-tls-verify=false", chunkedNormal.registryRef, "dir:" + chunkedNormal.dirPath})
skopeo.WaitWithDefaultTimeout()