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

@@ -52,6 +52,10 @@ func TestSetNoProxyType(t *testing.T) {
testSetProxyType(t, "noProxy", NoProxyType)
}
func TestSetKataBuiltInProxyType(t *testing.T) {
testSetProxyType(t, "kataBuiltInProxy", KataBuiltInProxyType)
}
func TestSetUnknownProxyType(t *testing.T) {
var proxyType ProxyType
@@ -97,6 +101,11 @@ func TestStringFromNoopProxyType(t *testing.T) {
testStringFromProxyType(t, proxyType, "noopProxy")
}
func TestStringFromKataBuiltInProxyType(t *testing.T) {
proxyType := KataBuiltInProxyType
testStringFromProxyType(t, proxyType, "kataBuiltInProxy")
}
func TestStringFromUnknownProxyType(t *testing.T) {
var proxyType ProxyType
testStringFromProxyType(t, proxyType, "")
@@ -137,6 +146,12 @@ func TestNewProxyFromNoopProxyType(t *testing.T) {
testNewProxyFromProxyType(t, proxyType, expectedProxy)
}
func TestNewProxyFromKataBuiltInProxyType(t *testing.T) {
proxyType := KataBuiltInProxyType
expectedProxy := &kataBuiltInProxy{}
testNewProxyFromProxyType(t, proxyType, expectedProxy)
}
func TestNewProxyFromUnknownProxyType(t *testing.T) {
var proxyType ProxyType