diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-03-26 18:31:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-26 18:31:52 +0000 |
commit | c81e273835303664d62c4e958a7f34877c05ed49 (patch) | |
tree | e9fe02ffa86a63b41f41b8daf120f3b9331c978d | |
parent | 47006d32ed6648d4e4e3904ce480a2dbfab056cd (diff) | |
parent | 8762d875c2e0d480b2fb9c9fccc07ad300128347 (diff) | |
download | podman-c81e273835303664d62c4e958a7f34877c05ed49.tar.gz podman-c81e273835303664d62c4e958a7f34877c05ed49.tar.bz2 podman-c81e273835303664d62c4e958a7f34877c05ed49.zip |
Merge pull request #9832 from rhatdan/commit
Use TMPDIR when commiting images
-rw-r--r-- | libpod/image/docker_registry_options.go | 1 | ||||
-rw-r--r-- | libpod/image/image_test.go | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/libpod/image/docker_registry_options.go b/libpod/image/docker_registry_options.go index 0a2a375ae..d95234e3d 100644 --- a/libpod/image/docker_registry_options.go +++ b/libpod/image/docker_registry_options.go @@ -69,6 +69,7 @@ func GetSystemContext(signaturePolicyPath, authFilePath string, forceCompress bo sc.AuthFilePath = authFilePath sc.DirForceCompress = forceCompress sc.DockerRegistryUserAgent = fmt.Sprintf("libpod/%s", podmanVersion.Version) + sc.BigFilesTemporaryDir = parse.GetTempDir() return sc } diff --git a/libpod/image/image_test.go b/libpod/image/image_test.go index d95a22f76..2b42d6394 100644 --- a/libpod/image/image_test.go +++ b/libpod/image/image_test.go @@ -9,6 +9,7 @@ import ( "github.com/containers/podman/v3/libpod/events" "github.com/containers/podman/v3/pkg/util" + podmanVersion "github.com/containers/podman/v3/version" "github.com/containers/storage" "github.com/containers/storage/pkg/reexec" "github.com/opencontainers/go-digest" @@ -293,3 +294,25 @@ func TestNormalizedTag(t *testing.T) { } } } + +func TestGetSystemContext(t *testing.T) { + sc := GetSystemContext("", "", false) + assert.Equal(t, sc.SignaturePolicyPath, "") + assert.Equal(t, sc.AuthFilePath, "") + assert.Equal(t, sc.DirForceCompress, false) + assert.Equal(t, sc.DockerRegistryUserAgent, fmt.Sprintf("libpod/%s", podmanVersion.Version)) + assert.Equal(t, sc.BigFilesTemporaryDir, "/var/tmp") + + oldtmpdir := os.Getenv("TMPDIR") + os.Setenv("TMPDIR", "/mnt") + sc = GetSystemContext("/tmp/foo", "/tmp/bar", true) + assert.Equal(t, sc.SignaturePolicyPath, "/tmp/foo") + assert.Equal(t, sc.AuthFilePath, "/tmp/bar") + assert.Equal(t, sc.DirForceCompress, true) + assert.Equal(t, sc.BigFilesTemporaryDir, "/mnt") + if oldtmpdir != "" { + os.Setenv("TMPDIR", oldtmpdir) + } else { + os.Unsetenv("TMPDIR") + } +} |