mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 15:02:45 +00:00
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:
parent
4c35d0911a
commit
9bf0d67fdd
@ -8,17 +8,26 @@ package direct
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
|
||||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||||
|
"github.com/kata-containers/runtime/virtcontainers/store"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTemplateFactory(t *testing.T) {
|
func TestTemplateFactory(t *testing.T) {
|
||||||
assert := assert.New(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{
|
hyperConfig := vc.HypervisorConfig{
|
||||||
KernelPath: testDir,
|
KernelPath: testDir,
|
||||||
ImagePath: testDir,
|
ImagePath: testDir,
|
||||||
|
Loading…
Reference in New Issue
Block a user