mirror of
https://github.com/containers/podman.git
synced 2025-06-26 04:46:57 +08:00
e2e: fix containers_conf_test
Prevents overwriting of TMPDIR environment. Signed-off-by: Toshiki Sonoda <sonoda.toshiki@fujitsu.com>
This commit is contained in:
@ -419,6 +419,14 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
})
|
||||
|
||||
It("add image_copy_tmp_dir", func() {
|
||||
// Prevents overwriting of TMPDIR environment
|
||||
if cacheDir, found := os.LookupEnv("TMPDIR"); found {
|
||||
defer os.Setenv("TMPDIR", cacheDir)
|
||||
os.Unsetenv("TMPDIR")
|
||||
} else {
|
||||
defer os.Unsetenv("TMPDIR")
|
||||
}
|
||||
|
||||
session := podmanTest.Podman([]string{"info", "--format", "{{.Store.ImageCopyTmpDir}}"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
@ -462,6 +470,13 @@ var _ = Describe("Verify podman containers.conf usage", func() {
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(125))
|
||||
Expect(session.Err.Contents()).To(ContainSubstring("invalid image_copy_tmp_dir value \"storage1\" (relative paths are not accepted)"))
|
||||
|
||||
os.Setenv("TMPDIR", "/hoge")
|
||||
session = podmanTest.Podman([]string{"info", "--format", "{{.Store.ImageCopyTmpDir}}"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
Expect(session).Should(Exit(0))
|
||||
Expect(session.OutputToString()).To(Equal("/hoge"))
|
||||
os.Unsetenv("TMPDIR")
|
||||
}
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user