ut: fs test should set RunStoragePath

Otherwise it failes with permission errors.

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
Peng Tao 2019-12-25 01:51:41 -08:00
parent 9bf0d67fdd
commit e5b04a5bf2

View File

@ -7,6 +7,7 @@ package fs
import (
"fmt"
"io/ioutil"
"os"
"testing"
@ -32,6 +33,13 @@ func TestFsLock(t *testing.T) {
assert.Nil(t, err)
assert.NotNil(t, fs)
testDir, err := ioutil.TempDir("", "fs-tmp-")
assert.Nil(t, err)
TestSetRunStoragePath(testDir)
defer func() {
os.RemoveAll(testDir)
}()
fs.sandboxState.SandboxContainer = "test-fs-driver"
sandboxDir, err := fs.sandboxDir()
assert.Nil(t, err)
@ -51,6 +59,13 @@ func TestFsDriver(t *testing.T) {
assert.Nil(t, err)
assert.NotNil(t, fs)
testDir, err := ioutil.TempDir("", "fs-tmp-")
assert.Nil(t, err)
TestSetRunStoragePath(testDir)
defer func() {
os.RemoveAll(testDir)
}()
ss := persistapi.SandboxState{}
cs := make(map[string]persistapi.ContainerState)
// missing sandbox container id