Use dynamic pkgs cache dir for test suite

This commit is contained in:
Daniele Rondina
2020-02-01 20:05:19 +01:00
parent 2528fe0fb4
commit 40687c3072
2 changed files with 9 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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")
}