Skip to content

Commit

Permalink
Merge pull request containers#17243 from sstosh/e2e-imagecachedir
Browse files Browse the repository at this point in the history
e2e: Avoid hard-coding ImageCacheDir
  • Loading branch information
openshift-merge-robot authored Jan 30, 2023
2 parents 5061589 + 2682d3a commit 929d03a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions test/e2e/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ func TestLibpod(t *testing.T) {

var _ = SynchronizedBeforeSuite(func() []byte {
// make cache dir
if err := os.MkdirAll(ImageCacheDir, 0777); err != nil {
ImageCacheDir = filepath.Join(os.TempDir(), "imagecachedir")
if err := os.MkdirAll(ImageCacheDir, 0700); err != nil {
fmt.Printf("%q\n", err)
os.Exit(1)
}
Expand Down Expand Up @@ -192,7 +193,7 @@ var _ = SynchronizedAfterSuite(func() {},
}
// for localized tests, this removes the image cache dir and for remote tests
// this is a no-op
podmanTest.removeCache(ImageCacheDir)
podmanTest.removeCache(podmanTest.ImageCacheDir)

// LockTmpDir can already be removed
os.RemoveAll(LockTmpDir)
Expand Down Expand Up @@ -278,6 +279,9 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
storageFs = os.Getenv("STORAGE_FS")
storageOptions = "--storage-driver " + storageFs
}

ImageCacheDir = filepath.Join(os.TempDir(), "imagecachedir")

p := &PodmanTestIntegration{
PodmanTest: PodmanTest{
PodmanBinary: podmanBinary,
Expand Down
7 changes: 6 additions & 1 deletion test/e2e/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ var (
INFRA_IMAGE = "k8s.gcr.io/pause:3.2" //nolint:revive,stylecheck
BB = "quay.io/libpod/busybox:latest"
HEALTHCHECK_IMAGE = "quay.io/libpod/alpine_healthcheck:latest" //nolint:revive,stylecheck
ImageCacheDir = "/tmp/podman/imagecachedir"
fedoraToolbox = "registry.fedoraproject.org/fedora-toolbox:36"
volumeTest = "quay.io/libpod/volume-plugin-test-img:20220623"

Expand All @@ -25,4 +24,10 @@ var (
// This image has a bogus/invalid seccomp profile which should
// yield a json error when being read.
alpineBogusSeccomp = "quay.io/libpod/alpine-with-bogus-seccomp:label"

// ImageCacheDir is initialized at runtime.
// e.g., filepath.Join(os.TempDir(), "imagecachedir")
// This directory should be used by per-user.
// Note: "ImageCacheDir" has nothing to do with "PODMAN_TEST_IMAGE_CACHE_DIR".
ImageCacheDir = ""
)

0 comments on commit 929d03a

Please sign in to comment.