Merge pull request #17243 from sstosh/e2e-imagecachedir

e2e: Avoid hard-coding ImageCacheDir
This commit is contained in:
OpenShift Merge Robot
2023-01-30 07:04:00 -05:00
committed by GitHub
2 changed files with 12 additions and 3 deletions

View File

@ -103,7 +103,8 @@ func TestLibpod(t *testing.T) {
var _ = SynchronizedBeforeSuite(func() []byte { var _ = SynchronizedBeforeSuite(func() []byte {
// make cache dir // 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) fmt.Printf("%q\n", err)
os.Exit(1) os.Exit(1)
} }
@ -192,7 +193,7 @@ var _ = SynchronizedAfterSuite(func() {},
} }
// for localized tests, this removes the image cache dir and for remote tests // for localized tests, this removes the image cache dir and for remote tests
// this is a no-op // this is a no-op
podmanTest.removeCache(ImageCacheDir) podmanTest.removeCache(podmanTest.ImageCacheDir)
// LockTmpDir can already be removed // LockTmpDir can already be removed
os.RemoveAll(LockTmpDir) os.RemoveAll(LockTmpDir)
@ -278,6 +279,9 @@ func PodmanTestCreateUtil(tempDir string, remote bool) *PodmanTestIntegration {
storageFs = os.Getenv("STORAGE_FS") storageFs = os.Getenv("STORAGE_FS")
storageOptions = "--storage-driver " + storageFs storageOptions = "--storage-driver " + storageFs
} }
ImageCacheDir = filepath.Join(os.TempDir(), "imagecachedir")
p := &PodmanTestIntegration{ p := &PodmanTestIntegration{
PodmanTest: PodmanTest{ PodmanTest: PodmanTest{
PodmanBinary: podmanBinary, PodmanBinary: podmanBinary,

View File

@ -13,7 +13,6 @@ var (
INFRA_IMAGE = "k8s.gcr.io/pause:3.2" //nolint:revive,stylecheck INFRA_IMAGE = "k8s.gcr.io/pause:3.2" //nolint:revive,stylecheck
BB = "quay.io/libpod/busybox:latest" BB = "quay.io/libpod/busybox:latest"
HEALTHCHECK_IMAGE = "quay.io/libpod/alpine_healthcheck:latest" //nolint:revive,stylecheck HEALTHCHECK_IMAGE = "quay.io/libpod/alpine_healthcheck:latest" //nolint:revive,stylecheck
ImageCacheDir = "/tmp/podman/imagecachedir"
fedoraToolbox = "registry.fedoraproject.org/fedora-toolbox:36" fedoraToolbox = "registry.fedoraproject.org/fedora-toolbox:36"
volumeTest = "quay.io/libpod/volume-plugin-test-img:20220623" volumeTest = "quay.io/libpod/volume-plugin-test-img:20220623"
@ -25,4 +24,10 @@ var (
// This image has a bogus/invalid seccomp profile which should // This image has a bogus/invalid seccomp profile which should
// yield a json error when being read. // yield a json error when being read.
alpineBogusSeccomp = "quay.io/libpod/alpine-with-bogus-seccomp:label" 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 = ""
) )