mirror of
https://github.com/containers/podman.git
synced 2025-07-25 00:58:03 +08:00
Make sure tests are cleaned up when they complete
Fixes: https://github.com/containers/podman/issues/13789 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
@ -786,17 +786,18 @@ RUN ls /dev/test1`, ALPINE)
|
|||||||
|
|
||||||
It("podman build use absolute path even if given relative", func() {
|
It("podman build use absolute path even if given relative", func() {
|
||||||
containerFile := fmt.Sprintf(`FROM %s`, ALPINE)
|
containerFile := fmt.Sprintf(`FROM %s`, ALPINE)
|
||||||
err = os.Mkdir("relative", 0755)
|
relativeDir := filepath.Join(podmanTest.TempDir, "relativeDir")
|
||||||
|
containerFilePath := filepath.Join(relativeDir, "Containerfile")
|
||||||
|
buildRoot := filepath.Join(relativeDir, "build-root")
|
||||||
|
|
||||||
|
err = os.Mkdir(relativeDir, 0755)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
containerFilePath := filepath.Join("relative", "Containerfile")
|
err = os.Mkdir(buildRoot, 0755)
|
||||||
err = os.Mkdir("relative/build-root", 0755)
|
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
err = ioutil.WriteFile(containerFilePath, []byte(containerFile), 0755)
|
err = ioutil.WriteFile(containerFilePath, []byte(containerFile), 0755)
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
build := podmanTest.Podman([]string{"build", "-f", "./relative/Containerfile", "./relative/build-root"})
|
build := podmanTest.Podman([]string{"build", "-f", containerFilePath, buildRoot})
|
||||||
build.WaitWithDefaultTimeout()
|
build.WaitWithDefaultTimeout()
|
||||||
Expect(build).To(Exit(0))
|
Expect(build).To(Exit(0))
|
||||||
err = os.RemoveAll("relative")
|
|
||||||
Expect(err).To(BeNil())
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -164,12 +164,13 @@ var _ = Describe("Podman save", func() {
|
|||||||
err = cmd.Run()
|
err = cmd.Run()
|
||||||
Expect(err).To(BeNil())
|
Expect(err).To(BeNil())
|
||||||
|
|
||||||
cmd = exec.Command("cp", "/etc/containers/registries.d/default.yaml", "default.yaml")
|
defaultYaml := filepath.Join(podmanTest.TempDir, "default.yaml")
|
||||||
|
cmd = exec.Command("cp", "/etc/containers/registries.d/default.yaml", defaultYaml)
|
||||||
if err = cmd.Run(); err != nil {
|
if err = cmd.Run(); err != nil {
|
||||||
Skip("no signature store to verify")
|
Skip("no signature store to verify")
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
cmd = exec.Command("cp", "default.yaml", "/etc/containers/registries.d/default.yaml")
|
cmd = exec.Command("cp", defaultYaml, "/etc/containers/registries.d/default.yaml")
|
||||||
err := cmd.Run()
|
err := cmd.Run()
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
}()
|
}()
|
||||||
|
@ -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"
|
||||||
@ -90,7 +91,8 @@ var _ = Describe("Podman volume create", func() {
|
|||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "export", volName, "--output=hello.tar"})
|
helloTar := filepath.Join(podmanTest.TempDir, "hello.tar")
|
||||||
|
session = podmanTest.Podman([]string{"volume", "export", volName, "--output", helloTar})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
|
|
||||||
@ -98,7 +100,7 @@ var _ = Describe("Podman volume create", func() {
|
|||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"volume", "import", "my_vol2", "hello.tar"})
|
session = podmanTest.Podman([]string{"volume", "import", "my_vol2", helloTar})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.OutputToString()).To(Equal(""), "output of volume import")
|
Expect(session.OutputToString()).To(Equal(""), "output of volume import")
|
||||||
|
Reference in New Issue
Block a user