switch some commands to use its own scheme

This commit is contained in:
ymqytw
2017-10-27 18:31:42 -07:00
parent 35468469eb
commit 4487cc5e15
64 changed files with 362 additions and 450 deletions

View File

@@ -25,9 +25,9 @@ import (
"github.com/spf13/cobra"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/client-go/rest/fake"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/legacyscheme"
cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
)
@@ -44,7 +44,7 @@ func (f *fakePortForwarder) ForwardPorts(method string, url *url.URL, opts PortF
}
func testPortForward(t *testing.T, flags map[string]string, args []string) {
version := legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion.Version
version := "v1"
tests := []struct {
name string
@@ -70,7 +70,7 @@ func testPortForward(t *testing.T, flags map[string]string, args []string) {
var err error
f, tf, codec, ns := cmdtesting.NewAPIFactory()
tf.Client = &fake.RESTClient{
GroupVersion: legacyscheme.Registry.GroupOrDie(api.GroupName).GroupVersion,
GroupVersion: schema.GroupVersion{Group: ""},
NegotiatedSerializer: ns,
Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
switch p, m := req.URL.Path, req.Method; {