proxy/shim: add unit tests

To test built-in proxy and shim types.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
This commit is contained in:
Peng Tao
2018-04-04 16:11:32 +08:00
parent f483d6f8da
commit 81bb561467
3 changed files with 76 additions and 0 deletions

View File

@@ -89,6 +89,11 @@ func TestStringFromNoopShimType(t *testing.T) {
testStringFromShimType(t, shimType, "noopShim")
}
func TestStringFromKataBuiltInShimType(t *testing.T) {
shimType := KataBuiltInShimType
testStringFromShimType(t, shimType, "kataBuiltInShim")
}
func TestStringFromUnknownShimType(t *testing.T) {
var shimType ShimType
testStringFromShimType(t, shimType, "")
@@ -123,6 +128,12 @@ func TestNewShimFromNoopShimType(t *testing.T) {
testNewShimFromShimType(t, shimType, expectedShim)
}
func TestNewShimFromKataBuiltInShimType(t *testing.T) {
shimType := KataBuiltInShimType
expectedShim := &kataBuiltInShim{}
testNewShimFromShimType(t, shimType, expectedShim)
}
func TestNewShimFromUnknownShimType(t *testing.T) {
var shimType ShimType
@@ -170,6 +181,14 @@ func TestNewShimConfigFromNoopShimPodConfig(t *testing.T) {
testNewShimConfigFromPodConfig(t, podConfig, nil)
}
func TestNewShimConfigFromKataBuiltInShimPodConfig(t *testing.T) {
podConfig := PodConfig{
ShimType: KataBuiltInShimType,
}
testNewShimConfigFromPodConfig(t, podConfig, nil)
}
func TestNewShimConfigFromUnknownShimPodConfig(t *testing.T) {
var shimType ShimType