convert more command to use a generated clientset

This commit is contained in:
deads2k
2016-09-07 16:29:57 -04:00
parent fc30bf7e8b
commit 9d43f7e52c
14 changed files with 130 additions and 88 deletions

View File

@@ -27,8 +27,6 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/restclient"
"k8s.io/kubernetes/pkg/client/unversioned/fake"
)
@@ -48,20 +46,19 @@ func TestPortForward(t *testing.T) {
version := testapi.Default.GroupVersion().Version
tests := []struct {
name, version, podPath, pfPath, container string
pod *api.Pod
pfErr bool
name string
podPath, pfPath, container string
pod *api.Pod
pfErr bool
}{
{
name: "pod portforward",
version: version,
podPath: "/api/" + version + "/namespaces/test/pods/foo",
pfPath: "/api/" + version + "/namespaces/test/pods/foo/portforward",
pod: execPod(),
},
{
name: "pod portforward error",
version: version,
podPath: "/api/" + version + "/namespaces/test/pods/foo",
pfPath: "/api/" + version + "/namespaces/test/pods/foo/portforward",
pod: execPod(),
@@ -86,7 +83,7 @@ func TestPortForward(t *testing.T) {
}),
}
tf.Namespace = "test"
tf.ClientConfig = &restclient.Config{ContentConfig: restclient.ContentConfig{GroupVersion: &unversioned.GroupVersion{Version: test.version}}}
tf.ClientConfig = defaultClientConfig()
ff := &fakePortForwarder{}
if test.pfErr {
ff.pfErr = fmt.Errorf("pf error")
@@ -130,20 +127,18 @@ func TestPortForwardWithPFlag(t *testing.T) {
version := testapi.Default.GroupVersion().Version
tests := []struct {
name, version, podPath, pfPath, container string
pod *api.Pod
pfErr bool
name, podPath, pfPath, container string
pod *api.Pod
pfErr bool
}{
{
name: "pod portforward",
version: version,
podPath: "/api/" + version + "/namespaces/test/pods/foo",
pfPath: "/api/" + version + "/namespaces/test/pods/foo/portforward",
pod: execPod(),
},
{
name: "pod portforward error",
version: version,
podPath: "/api/" + version + "/namespaces/test/pods/foo",
pfPath: "/api/" + version + "/namespaces/test/pods/foo/portforward",
pod: execPod(),
@@ -168,7 +163,7 @@ func TestPortForwardWithPFlag(t *testing.T) {
}),
}
tf.Namespace = "test"
tf.ClientConfig = &restclient.Config{ContentConfig: restclient.ContentConfig{GroupVersion: &unversioned.GroupVersion{Version: test.version}}}
tf.ClientConfig = defaultClientConfig()
ff := &fakePortForwarder{}
if test.pfErr {
ff.pfErr = fmt.Errorf("pf error")