summaryrefslogtreecommitdiff
path: root/test/e2e/libpod_suite_test.go
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2021-12-01 12:47:30 -0700
committerEd Santiago <santiago@redhat.com>2021-12-01 14:06:22 -0700
commit3ac1b9bc0f1d45289d0f014d667f7b45302992b6 (patch)
tree6d0f2c7821eb22ae417f6968392ce571e0d6c987 /test/e2e/libpod_suite_test.go
parent5ac66e2aab68de1d40a01c6f9d00956a45ccaa4d (diff)
downloadpodman-3ac1b9bc0f1d45289d0f014d667f7b45302992b6.tar.gz
podman-3ac1b9bc0f1d45289d0f014d667f7b45302992b6.tar.bz2
podman-3ac1b9bc0f1d45289d0f014d667f7b45302992b6.zip
Image caches: allow overriding cache dir
Images were being cached in /tmp, with no option to override. Now $PODMAN_TEST_IMAGE_CACHE_DIR can be used to point to a user-preferred location. If unset, try $TMPDIR before settling on /tmp. Also: refactor the logic for determining the tarball name. Also: include registry name in tarball name. Also: clean up unused/unnecessary code Also: do not echo "Restoring..." if we're not actually restoring. Signed-off-by: Ed Santiago <santiago@redhat.com>
Diffstat (limited to 'test/e2e/libpod_suite_test.go')
-rw-r--r--test/e2e/libpod_suite_test.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/e2e/libpod_suite_test.go b/test/e2e/libpod_suite_test.go
index 001a869b1..4147ba2c3 100644
--- a/test/e2e/libpod_suite_test.go
+++ b/test/e2e/libpod_suite_test.go
@@ -7,7 +7,6 @@ import (
"io/ioutil"
"os"
"path/filepath"
- "strings"
"github.com/containers/podman/v3/pkg/rootless"
)
@@ -59,11 +58,12 @@ func PodmanTestCreate(tempDir string) *PodmanTestIntegration {
// RestoreArtifact puts the cached image into our test store
func (p *PodmanTestIntegration) RestoreArtifact(image string) error {
- fmt.Printf("Restoring %s...\n", image)
- dest := strings.Split(image, "/")
- destName := fmt.Sprintf("/tmp/%s.tar", strings.Replace(strings.Join(strings.Split(dest[len(dest)-1], "/"), ""), ":", "-", -1))
- restore := p.PodmanNoEvents([]string{"load", "-q", "-i", destName})
- restore.Wait(90)
+ tarball := imageTarPath(image)
+ if _, err := os.Stat(tarball); err == nil {
+ fmt.Printf("Restoring %s...\n", image)
+ restore := p.PodmanNoEvents([]string{"load", "-q", "-i", tarball})
+ restore.Wait(90)
+ }
return nil
}