config: convert --cache-dir value to an absolute path
This commit is contained in:
parent
0ffdca42d5
commit
f3e71f129c
11 changed files with 47 additions and 33 deletions
|
@ -63,11 +63,12 @@ func assertVolumeInfo(t *testing.T, v *docker.VolInfo, name, path string) {
|
|||
|
||||
func TestDockerPluginLogic(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
oldCacheDir := config.CacheDir
|
||||
oldCacheDir := config.GetCacheDir()
|
||||
testDir, testFs := initialise(ctx, t)
|
||||
config.CacheDir = testDir
|
||||
err := config.SetCacheDir(testDir)
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
config.CacheDir = oldCacheDir
|
||||
_ = config.SetCacheDir(oldCacheDir)
|
||||
if !t.Failed() {
|
||||
fstest.Purge(testFs)
|
||||
_ = os.RemoveAll(testDir)
|
||||
|
@ -304,11 +305,12 @@ func testMountAPI(t *testing.T, sockAddr string) {
|
|||
}
|
||||
|
||||
ctx := context.Background()
|
||||
oldCacheDir := config.CacheDir
|
||||
oldCacheDir := config.GetCacheDir()
|
||||
testDir, testFs := initialise(ctx, t)
|
||||
config.CacheDir = testDir
|
||||
err := config.SetCacheDir(testDir)
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
config.CacheDir = oldCacheDir
|
||||
_ = config.SetCacheDir(oldCacheDir)
|
||||
if !t.Failed() {
|
||||
fstest.Purge(testFs)
|
||||
_ = os.RemoveAll(testDir)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue