Unittests

This commit is contained in:
bprashanth
2016-10-28 17:14:33 -07:00
parent aee5b8099c
commit 11638e9ee1
10 changed files with 152 additions and 5 deletions

View File

@@ -27,11 +27,14 @@ import (
)
type fakeNetworkHost struct {
fakeNamespaceGetter
kubeClient clientset.Interface
Legacy bool
Runtime *containertest.FakeRuntime
}
func NewFakeHost(kubeClient clientset.Interface) *fakeNetworkHost {
host := &fakeNetworkHost{kubeClient: kubeClient}
host := &fakeNetworkHost{kubeClient: kubeClient, Legacy: true, Runtime: &containertest.FakeRuntime{}}
return host
}
@@ -44,5 +47,17 @@ func (fnh *fakeNetworkHost) GetKubeClient() clientset.Interface {
}
func (nh *fakeNetworkHost) GetRuntime() kubecontainer.Runtime {
return &containertest.FakeRuntime{}
return nh.Runtime
}
func (nh *fakeNetworkHost) SupportsLegacyFeatures() bool {
return nh.Legacy
}
type fakeNamespaceGetter struct {
ns string
}
func (nh *fakeNamespaceGetter) GetNetNS(containerID string) (string, error) {
return nh.ns, nil
}