ut: direct factory needs to set VCStorePrefix

Otherwise it fails with permission errors.

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

View File

@ -8,17 +8,26 @@ package direct
import (
"context"
"io/ioutil"
"os"
"testing"
"github.com/stretchr/testify/assert"
vc "github.com/kata-containers/runtime/virtcontainers"
"github.com/kata-containers/runtime/virtcontainers/store"
)
func TestTemplateFactory(t *testing.T) {
assert := assert.New(t)
testDir, _ := ioutil.TempDir("", "vmfactory-tmp-")
testDir, err := ioutil.TempDir("", "vmfactory-tmp-")
assert.Nil(err)
store.VCStorePrefix = testDir
defer func() {
os.RemoveAll(testDir)
store.VCStorePrefix = ""
}()
hyperConfig := vc.HypervisorConfig{
KernelPath: testDir,
ImagePath: testDir,