Fix fs_util tests failing on systems with /tmp mountpoint (#2583)

* Rename IgnoreListPath to MountInfoPath in config & constants

The string points to /proc/self/mountinfo

* fs_util_test.go: fix tests failing when /tmp mountpoint present

The tests

* Test_GetFSFromLayers_ignorelist
* Test_GetFSFromLayers_with_whiteouts_include_whiteout_disabled
* Test_GetFSFromLayers_with_whiteouts_include_whiteout_enabled

were failing on systems with a /tmp mountpoint:

fs_util.InitIgnoreList() adds all mountpoints to the ignore list,
but the tests were expecting file operations in a /tmp subdirectory.

This change provides an empty mountinfo list for the affected tests.

Fixes #1779
This commit is contained in:
Andreas Fleig
2023-06-19 12:01:20 -07:00
committed by GitHub
parent bb712b6b39
commit 01763bce5b
5 changed files with 27 additions and 8 deletions
+2 -2
View File
@@ -176,9 +176,9 @@ func setupMultistageTests(t *testing.T) (string, func()) {
if err := ioutil.WriteFile(mFile, []byte(mountInfo), 0644); err != nil {
t.Fatal(err)
}
config.IgnoreListPath = mFile
config.MountInfoPath = mFile
return testDir, func() {
config.RootDir = constants.RootDir
config.IgnoreListPath = constants.IgnoreListPath
config.MountInfoPath = constants.MountInfoPath
}
}