mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-16 08:26:16 +00:00
store: UT tmp path should be random
Otherwise we might end up using the previously created store instead. Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
parent
5617120649
commit
3ed472dc8d
@ -20,7 +20,11 @@ type TestNoopStructure struct {
|
||||
Field2 string
|
||||
}
|
||||
|
||||
var rootPath = "/tmp/root1/"
|
||||
var rootPath = func() string {
|
||||
dir, _ := ioutil.TempDir("", "")
|
||||
return dir
|
||||
}()
|
||||
|
||||
var expectedFilesystemData = "{\"Field1\":\"value1\",\"Field2\":\"value2\"}"
|
||||
|
||||
func TestStoreFilesystemStore(t *testing.T) {
|
||||
|
@ -23,14 +23,17 @@ var sandboxDirState = ""
|
||||
var sandboxDirLock = ""
|
||||
var sandboxFileState = ""
|
||||
var sandboxFileLock = ""
|
||||
var storeRoot = "file:///tmp/root1/"
|
||||
var storeRoot, storeRootDir = func() (string, string) {
|
||||
dir, _ := ioutil.TempDir("", "")
|
||||
return "file://" + dir, dir
|
||||
}()
|
||||
|
||||
func TestNewStore(t *testing.T) {
|
||||
s, err := New(context.Background(), storeRoot)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, s.scheme, "file")
|
||||
assert.Equal(t, s.host, "")
|
||||
assert.Equal(t, s.path, "/tmp/root1/")
|
||||
assert.Equal(t, s.path, storeRootDir)
|
||||
}
|
||||
|
||||
func TestDeleteStore(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user