mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 23:04:20 +01:00
runtime: move all code to src/runtime
To prepare for merging into kata-containers repository. Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
52
src/runtime/virtcontainers/factory/direct/direct_test.go
Normal file
52
src/runtime/virtcontainers/factory/direct/direct_test.go
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2018 HyperHQ Inc.
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
package direct
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
vc "github.com/kata-containers/runtime/virtcontainers"
|
||||
"github.com/kata-containers/runtime/virtcontainers/persist/fs"
|
||||
)
|
||||
|
||||
func TestTemplateFactory(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
testDir := fs.MockStorageRootPath()
|
||||
defer fs.MockStorageDestroy()
|
||||
|
||||
hyperConfig := vc.HypervisorConfig{
|
||||
KernelPath: testDir,
|
||||
ImagePath: testDir,
|
||||
}
|
||||
vmConfig := vc.VMConfig{
|
||||
HypervisorType: vc.MockHypervisor,
|
||||
AgentType: vc.NoopAgentType,
|
||||
ProxyType: vc.NoopProxyType,
|
||||
HypervisorConfig: hyperConfig,
|
||||
}
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
// New
|
||||
f := New(ctx, vmConfig)
|
||||
|
||||
// Config
|
||||
assert.Equal(f.Config(), vmConfig)
|
||||
|
||||
// GetBaseVM
|
||||
vm, err := f.GetBaseVM(ctx, vmConfig)
|
||||
assert.Nil(err)
|
||||
|
||||
err = vm.Stop()
|
||||
assert.Nil(err)
|
||||
|
||||
// CloseFactory
|
||||
f.CloseFactory(ctx)
|
||||
}
|
||||
Reference in New Issue
Block a user