diff --git a/pkg/helpers/repository.go b/pkg/helpers/repository.go index b4e16346..370471d0 100644 --- a/pkg/helpers/repository.go +++ b/pkg/helpers/repository.go @@ -17,6 +17,7 @@ package helpers import ( + "io/ioutil" "os" "path/filepath" @@ -44,9 +45,12 @@ func GetSystemRepoDatabaseDirPath() string { } func GetSystemPkgsCacheDirPath() (ans string) { - cachepath := "packages" + var cachepath string if config.LuetCfg.GetSystem().PkgsCachePath != "" { cachepath = config.LuetCfg.GetSystem().PkgsCachePath + } else { + // Create dynamic cache for test suites + cachepath, _ = ioutil.TempDir(os.TempDir(), "cachepkgs") } if filepath.IsAbs(cachepath) { diff --git a/pkg/installer/installer_suite_test.go b/pkg/installer/installer_suite_test.go index 7c7c514e..37292be4 100644 --- a/pkg/installer/installer_suite_test.go +++ b/pkg/installer/installer_suite_test.go @@ -28,5 +28,9 @@ import ( func TestInstaller(t *testing.T) { RegisterFailHandler(Fail) LoadConfig(config.LuetCfg) + // Set temporary directory for rootfs + config.LuetCfg.GetSystem().Rootfs = "/tmp/luet-root" + // Force dynamic path for packages cache + config.LuetCfg.GetSystem().PkgsCachePath = "" RunSpecs(t, "Installer Suite") }