mirror of
https://github.com/containers/podman.git
synced 2025-06-21 17:38:12 +08:00
test/e2e: fix incorrect usage of CreateTempDirInTempDir()
Creating a new diretory results in the test leaking it when it is not removed via a defer call. All tests have already access to `podmanTest.TempDir` which will be automatically removed in the `AfterEach()` block. While some test were fine other forgot the defer call. To keep the test consitent and prevent other from making the same mistake convert all users to `podmanTest.TempDir`. `CreateTempDirInTempDir()` is only used for the `podmanTest.Setup()` call. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@ -211,16 +211,10 @@ var _ = Describe("Podman build", func() {
|
|||||||
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
||||||
defer Expect(os.Chdir(cwd)).To(BeNil())
|
defer Expect(os.Chdir(cwd)).To(BeNil())
|
||||||
|
|
||||||
// Write target and fake files
|
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
|
||||||
if err != nil {
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
fakeFile := filepath.Join(os.TempDir(), "Containerfile")
|
fakeFile := filepath.Join(os.TempDir(), "Containerfile")
|
||||||
Expect(os.WriteFile(fakeFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(Succeed())
|
Expect(os.WriteFile(fakeFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(Succeed())
|
||||||
|
|
||||||
targetFile := filepath.Join(targetPath, "Containerfile")
|
targetFile := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||||
Expect(os.WriteFile(targetFile, []byte("FROM scratch"), 0755)).To(Succeed())
|
Expect(os.WriteFile(targetFile, []byte("FROM scratch"), 0755)).To(Succeed())
|
||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -247,11 +241,7 @@ var _ = Describe("Podman build", func() {
|
|||||||
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
||||||
defer Expect(os.Chdir(cwd)).To(BeNil())
|
defer Expect(os.Chdir(cwd)).To(BeNil())
|
||||||
|
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
targetFile := filepath.Join(podmanTest.TempDir, "idFile")
|
||||||
if err != nil {
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
targetFile := filepath.Join(targetPath, "idFile")
|
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"build", "--pull-never", "build/basicalpine", "--iidfile", targetFile})
|
session := podmanTest.Podman([]string{"build", "--pull-never", "build/basicalpine", "--iidfile", targetFile})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
@ -431,8 +421,7 @@ COPY /* /dir`, ALPINE)
|
|||||||
podmanTest.AddImageToRWStore(ALPINE)
|
podmanTest.AddImageToRWStore(ALPINE)
|
||||||
|
|
||||||
// Write target and fake files
|
// Write target and fake files
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
targetPath := podmanTest.TempDir
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
targetSubPath := filepath.Join(targetPath, "subdir")
|
targetSubPath := filepath.Join(targetPath, "subdir")
|
||||||
err = os.Mkdir(targetSubPath, 0755)
|
err = os.Mkdir(targetSubPath, 0755)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -450,7 +439,6 @@ RUN find /test`, ALPINE)
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
Expect(os.Chdir(cwd)).To(Succeed())
|
Expect(os.Chdir(cwd)).To(Succeed())
|
||||||
Expect(os.RemoveAll(targetPath)).To(Succeed())
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// make cwd as context root path
|
// make cwd as context root path
|
||||||
@ -504,8 +492,7 @@ RUN find /test`, ALPINE)
|
|||||||
podmanTest.AddImageToRWStore(ALPINE)
|
podmanTest.AddImageToRWStore(ALPINE)
|
||||||
|
|
||||||
// Write target and fake files
|
// Write target and fake files
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
targetPath := podmanTest.TempDir
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
targetSubPath := filepath.Join(targetPath, "subdir")
|
targetSubPath := filepath.Join(targetPath, "subdir")
|
||||||
err = os.Mkdir(targetSubPath, 0755)
|
err = os.Mkdir(targetSubPath, 0755)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -518,7 +505,6 @@ RUN find /test`, ALPINE)
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
Expect(os.Chdir(cwd)).To(Succeed())
|
Expect(os.Chdir(cwd)).To(Succeed())
|
||||||
Expect(os.RemoveAll(targetPath)).To(Succeed())
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// make cwd as context root path
|
// make cwd as context root path
|
||||||
@ -544,7 +530,8 @@ RUN find /test`, ALPINE)
|
|||||||
podmanTest.AddImageToRWStore(ALPINE)
|
podmanTest.AddImageToRWStore(ALPINE)
|
||||||
|
|
||||||
// Write target and fake files
|
// Write target and fake files
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
targetPath := filepath.Join(podmanTest.TempDir, "build")
|
||||||
|
err = os.Mkdir(targetPath, 0755)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
containerfile := fmt.Sprintf(`FROM %s
|
containerfile := fmt.Sprintf(`FROM %s
|
||||||
@ -616,9 +603,9 @@ subdir**`
|
|||||||
containerfile := filepath.Join(tempdir, "Containerfile")
|
containerfile := filepath.Join(tempdir, "Containerfile")
|
||||||
Expect(os.WriteFile(containerfile, contents.Bytes(), 0644)).ToNot(HaveOccurred())
|
Expect(os.WriteFile(containerfile, contents.Bytes(), 0644)).ToNot(HaveOccurred())
|
||||||
|
|
||||||
contextDir, err := CreateTempDirInTempDir()
|
contextDir := filepath.Join(podmanTest.TempDir, "context")
|
||||||
|
err = os.MkdirAll(contextDir, os.ModePerm)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
defer os.RemoveAll(contextDir)
|
|
||||||
|
|
||||||
Expect(os.WriteFile(filepath.Join(contextDir, "expected"), contents.Bytes(), 0644)).
|
Expect(os.WriteFile(filepath.Join(contextDir, "expected"), contents.Bytes(), 0644)).
|
||||||
ToNot(HaveOccurred())
|
ToNot(HaveOccurred())
|
||||||
@ -665,8 +652,7 @@ subdir**`
|
|||||||
podmanTest.AddImageToRWStore(ALPINE)
|
podmanTest.AddImageToRWStore(ALPINE)
|
||||||
|
|
||||||
// Write target and fake files
|
// Write target and fake files
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
targetPath := podmanTest.TempDir
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
targetSubPath := filepath.Join(targetPath, "subdir")
|
targetSubPath := filepath.Join(targetPath, "subdir")
|
||||||
err = os.Mkdir(targetSubPath, 0755)
|
err = os.Mkdir(targetSubPath, 0755)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -691,7 +677,6 @@ RUN [[ -L /test/dummy-symlink ]] && echo SYMLNKOK || echo SYMLNKERR`, ALPINE)
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
Expect(os.Chdir(cwd)).To(Succeed())
|
Expect(os.Chdir(cwd)).To(Succeed())
|
||||||
Expect(os.RemoveAll(targetPath)).To(Succeed())
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// make cwd as context root path
|
// make cwd as context root path
|
||||||
@ -707,8 +692,7 @@ RUN [[ -L /test/dummy-symlink ]] && echo SYMLNKOK || echo SYMLNKERR`, ALPINE)
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman build --from, --add-host, --cap-drop, --cap-add", func() {
|
It("podman build --from, --add-host, --cap-drop, --cap-add", func() {
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
targetPath := podmanTest.TempDir
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
containerFile := filepath.Join(targetPath, "Containerfile")
|
containerFile := filepath.Join(targetPath, "Containerfile")
|
||||||
content := `FROM scratch
|
content := `FROM scratch
|
||||||
@ -738,9 +722,7 @@ RUN grep CapEff /proc/self/status`
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman build --isolation && --arch", func() {
|
It("podman build --isolation && --arch", func() {
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
targetPath := podmanTest.TempDir
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
containerFile := filepath.Join(targetPath, "Containerfile")
|
containerFile := filepath.Join(targetPath, "Containerfile")
|
||||||
Expect(os.WriteFile(containerFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(Succeed())
|
Expect(os.WriteFile(containerFile, []byte(fmt.Sprintf("FROM %s", ALPINE)), 0755)).To(Succeed())
|
||||||
|
|
||||||
@ -798,8 +780,7 @@ RUN echo hello`, ALPINE)
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman build --log-rusage", func() {
|
It("podman build --log-rusage", func() {
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
targetPath := podmanTest.TempDir
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
containerFile := filepath.Join(targetPath, "Containerfile")
|
containerFile := filepath.Join(targetPath, "Containerfile")
|
||||||
content := `FROM scratch`
|
content := `FROM scratch`
|
||||||
|
@ -1327,6 +1327,7 @@ var _ = Describe("Podman checkpoint", func() {
|
|||||||
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
Expect(podmanTest.NumberOfContainersRunning()).To(Equal(1))
|
||||||
cid := session.OutputToString()
|
cid := session.OutputToString()
|
||||||
fileName := filepath.Join(podmanTest.TempDir, "/checkpoint-"+cid+".tar.gz")
|
fileName := filepath.Join(podmanTest.TempDir, "/checkpoint-"+cid+".tar.gz")
|
||||||
|
defer os.Remove(fileName)
|
||||||
|
|
||||||
result := podmanTest.Podman([]string{
|
result := podmanTest.Podman([]string{
|
||||||
"container",
|
"container",
|
||||||
@ -1343,8 +1344,9 @@ var _ = Describe("Podman checkpoint", func() {
|
|||||||
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
Expect(podmanTest.NumberOfContainers()).To(Equal(0))
|
||||||
|
|
||||||
// Extract checkpoint archive
|
// Extract checkpoint archive
|
||||||
destinationDirectory, err := CreateTempDirInTempDir()
|
destinationDirectory := filepath.Join(podmanTest.TempDir, "dest")
|
||||||
Expect(err).ShouldNot(HaveOccurred())
|
err = os.MkdirAll(destinationDirectory, os.ModePerm)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
tarsession := SystemExec(
|
tarsession := SystemExec(
|
||||||
"tar",
|
"tar",
|
||||||
@ -1359,11 +1361,6 @@ var _ = Describe("Podman checkpoint", func() {
|
|||||||
|
|
||||||
_, err = os.Stat(filepath.Join(destinationDirectory, stats.StatsDump))
|
_, err = os.Stat(filepath.Join(destinationDirectory, stats.StatsDump))
|
||||||
Expect(err).ShouldNot(HaveOccurred())
|
Expect(err).ShouldNot(HaveOccurred())
|
||||||
|
|
||||||
Expect(os.RemoveAll(destinationDirectory)).To(Succeed())
|
|
||||||
|
|
||||||
// Remove exported checkpoint
|
|
||||||
os.Remove(fileName)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman checkpoint and restore containers with --print-stats", func() {
|
It("podman checkpoint and restore containers with --print-stats", func() {
|
||||||
|
@ -270,12 +270,8 @@ var _ = Describe("Podman commit", func() {
|
|||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
targetPath := podmanTest.TempDir
|
||||||
if err != nil {
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
targetFile := filepath.Join(targetPath, "idFile")
|
targetFile := filepath.Join(targetPath, "idFile")
|
||||||
defer Expect(os.RemoveAll(targetFile)).To(BeNil())
|
|
||||||
defer Expect(os.Chdir(cwd)).To(BeNil())
|
defer Expect(os.Chdir(cwd)).To(BeNil())
|
||||||
|
|
||||||
_, ec, _ := podmanTest.RunLsContainer("test1")
|
_, ec, _ := podmanTest.RunLsContainer("test1")
|
||||||
|
@ -110,8 +110,6 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
|||||||
// FIXME: Needs crun-1.8.2-2 to allow this with --cgroup-manager=cgroupfs, once this is available remove the skip below.
|
// FIXME: Needs crun-1.8.2-2 to allow this with --cgroup-manager=cgroupfs, once this is available remove the skip below.
|
||||||
SkipIfRootless("--cgroup-manager=cgoupfs and --cgroup-conf not supported in rootless mode with crun")
|
SkipIfRootless("--cgroup-manager=cgoupfs and --cgroup-conf not supported in rootless mode with crun")
|
||||||
conffile := filepath.Join(podmanTest.TempDir, "container.conf")
|
conffile := filepath.Join(podmanTest.TempDir, "container.conf")
|
||||||
tempdir, err = CreateTempDirInTempDir()
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
err := os.WriteFile(conffile, []byte("[containers]\ncgroup_conf = [\"pids.max=1234\",]\n"), 0755)
|
err := os.WriteFile(conffile, []byte("[containers]\ncgroup_conf = [\"pids.max=1234\",]\n"), 0755)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
@ -281,17 +279,18 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
|||||||
|
|
||||||
It("add volumes", func() {
|
It("add volumes", func() {
|
||||||
conffile := filepath.Join(podmanTest.TempDir, "container.conf")
|
conffile := filepath.Join(podmanTest.TempDir, "container.conf")
|
||||||
tempdir, err = CreateTempDirInTempDir()
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
err := os.WriteFile(conffile, []byte(fmt.Sprintf("[containers]\nvolumes=[\"%s:%s:Z\",]\n", tempdir, tempdir)), 0755)
|
volume := filepath.Join(podmanTest.TempDir, "vol")
|
||||||
|
err = os.MkdirAll(volume, os.ModePerm)
|
||||||
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
err := os.WriteFile(conffile, []byte(fmt.Sprintf("[containers]\nvolumes=[\"%s:%s:Z\",]\n", volume, volume)), 0755)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
os.Setenv("CONTAINERS_CONF", conffile)
|
os.Setenv("CONTAINERS_CONF", conffile)
|
||||||
if IsRemote() {
|
if IsRemote() {
|
||||||
podmanTest.RestartRemoteService()
|
podmanTest.RestartRemoteService()
|
||||||
}
|
}
|
||||||
result := podmanTest.Podman([]string{"run", ALPINE, "ls", tempdir})
|
result := podmanTest.Podman([]string{"run", ALPINE, "ls", volume})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0))
|
Expect(result).Should(Exit(0))
|
||||||
})
|
})
|
||||||
|
@ -1072,9 +1072,7 @@ var _ = Describe("Podman kube generate", func() {
|
|||||||
containerfile := `FROM quay.io/libpod/alpine:latest
|
containerfile := `FROM quay.io/libpod/alpine:latest
|
||||||
ENTRYPOINT ["sleep"]`
|
ENTRYPOINT ["sleep"]`
|
||||||
|
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
|
||||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
@ -1126,9 +1124,7 @@ ENTRYPOINT ["sleep"]`
|
|||||||
containerfile := `FROM quay.io/libpod/alpine:latest
|
containerfile := `FROM quay.io/libpod/alpine:latest
|
||||||
USER 1000`
|
USER 1000`
|
||||||
|
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
|
||||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
@ -1197,9 +1193,7 @@ USER 1000`
|
|||||||
RUN adduser -u 10001 -S test1
|
RUN adduser -u 10001 -S test1
|
||||||
USER test1`
|
USER test1`
|
||||||
|
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
|
||||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
|
@ -297,20 +297,17 @@ var _ = Describe("Podman healthcheck run", func() {
|
|||||||
|
|
||||||
podmanTest.AddImageToRWStore(ALPINE)
|
podmanTest.AddImageToRWStore(ALPINE)
|
||||||
// Write target and fake files
|
// Write target and fake files
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
containerfile := fmt.Sprintf(`FROM %s
|
containerfile := fmt.Sprintf(`FROM %s
|
||||||
HEALTHCHECK CMD ls -l / 2>&1`, ALPINE)
|
HEALTHCHECK CMD ls -l / 2>&1`, ALPINE)
|
||||||
containerfilePath := filepath.Join(targetPath, "Containerfile")
|
containerfilePath := filepath.Join(podmanTest.TempDir, "Containerfile")
|
||||||
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
err = os.WriteFile(containerfilePath, []byte(containerfile), 0644)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
defer func() {
|
defer func() {
|
||||||
Expect(os.Chdir(cwd)).To(Succeed())
|
Expect(os.Chdir(cwd)).To(Succeed())
|
||||||
Expect(os.RemoveAll(targetPath)).To(Succeed())
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// make cwd as context root path
|
// make cwd as context root path
|
||||||
Expect(os.Chdir(targetPath)).To(Succeed())
|
Expect(os.Chdir(podmanTest.TempDir)).To(Succeed())
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"build", "--format", "docker", "-t", "test", "."})
|
session := podmanTest.Podman([]string{"build", "--format", "docker", "-t", "test", "."})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/containers/common/libnetwork/types"
|
"github.com/containers/common/libnetwork/types"
|
||||||
@ -39,9 +40,7 @@ var _ = Describe("Podman network", func() {
|
|||||||
|
|
||||||
It("podman --cni-config-dir backwards compat", func() {
|
It("podman --cni-config-dir backwards compat", func() {
|
||||||
SkipIfRemote("--cni-config-dir only works locally")
|
SkipIfRemote("--cni-config-dir only works locally")
|
||||||
netDir, err := CreateTempDirInTempDir()
|
netDir := filepath.Join(podmanTest.TempDir, "networks123")
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
defer os.RemoveAll(netDir)
|
|
||||||
session := podmanTest.Podman([]string{"--cni-config-dir", netDir, "network", "ls", "--noheading"})
|
session := podmanTest.Podman([]string{"--cni-config-dir", netDir, "network", "ls", "--noheading"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
|
@ -2933,8 +2933,6 @@ spec:
|
|||||||
Expect(c).Should(Exit(0))
|
Expect(c).Should(Exit(0))
|
||||||
|
|
||||||
conffile := filepath.Join(podmanTest.TempDir, "kube.yaml")
|
conffile := filepath.Join(podmanTest.TempDir, "kube.yaml")
|
||||||
tempdir, err = CreateTempDirInTempDir()
|
|
||||||
Expect(err).ToNot(HaveOccurred())
|
|
||||||
|
|
||||||
err := os.WriteFile(conffile, []byte(testyaml), 0755)
|
err := os.WriteFile(conffile, []byte(testyaml), 0755)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
@ -304,11 +304,8 @@ var _ = Describe("Podman pod create", func() {
|
|||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
Expect(os.Chdir(os.TempDir())).To(Succeed())
|
||||||
targetPath, err := CreateTempDirInTempDir()
|
|
||||||
if err != nil {
|
targetFile := filepath.Join(podmanTest.TempDir, "idFile")
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
targetFile := filepath.Join(targetPath, "idFile")
|
|
||||||
defer Expect(os.RemoveAll(targetFile)).To(BeNil())
|
defer Expect(os.RemoveAll(targetFile)).To(BeNil())
|
||||||
defer Expect(os.Chdir(cwd)).To(BeNil())
|
defer Expect(os.Chdir(cwd)).To(BeNil())
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package integration
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
|
||||||
. "github.com/containers/podman/v4/test/utils"
|
. "github.com/containers/podman/v4/test/utils"
|
||||||
. "github.com/onsi/ginkgo"
|
. "github.com/onsi/ginkgo"
|
||||||
@ -47,7 +48,8 @@ var _ = Describe("Podman run", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman run a container using a --workdir under a bind mount", func() {
|
It("podman run a container using a --workdir under a bind mount", func() {
|
||||||
volume, err := CreateTempDirInTempDir()
|
volume := filepath.Join(podmanTest.TempDir, "vol")
|
||||||
|
err = os.MkdirAll(volume, os.ModePerm)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--volume", fmt.Sprintf("%s:/var_ovl/:O", volume), "--workdir", "/var_ovl/log", ALPINE, "true"})
|
session := podmanTest.Podman([]string{"run", "--volume", fmt.Sprintf("%s:/var_ovl/:O", volume), "--workdir", "/var_ovl/log", ALPINE, "true"})
|
||||||
|
Reference in New Issue
Block a user