move client/unversioned/fake.go to its own package

This commit is contained in:
Chao Xu
2015-09-11 13:47:53 -07:00
parent fbde485548
commit ac5481d089
21 changed files with 320 additions and 284 deletions

View File

@@ -32,6 +32,7 @@ import (
"k8s.io/kubernetes/pkg/api/testapi"
"k8s.io/kubernetes/pkg/api/validation"
client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/fake"
"k8s.io/kubernetes/pkg/kubectl"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/resource"
@@ -200,7 +201,7 @@ func NewAPIFactory() (*cmdutil.Factory, *testFactory, runtime.Codec) {
},
Client: func() (*client.Client, error) {
// Swap out the HTTP client out of the client with the fake's version.
fakeClient := t.Client.(*client.FakeRESTClient)
fakeClient := t.Client.(*fake.RESTClient)
c := client.NewOrDie(t.ClientConfig)
c.Client = fakeClient.Client
return c, t.Err
@@ -261,7 +262,7 @@ func stringBody(body string) io.ReadCloser {
func ExamplePrintReplicationControllerWithNamespace() {
f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, true, false, false, []string{})
tf.Client = &client.FakeRESTClient{
tf.Client = &fake.RESTClient{
Codec: codec,
Client: nil,
}
@@ -303,7 +304,7 @@ func ExamplePrintReplicationControllerWithNamespace() {
func ExamplePrintPodWithWideFormat() {
f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, true, false, []string{})
tf.Client = &client.FakeRESTClient{
tf.Client = &fake.RESTClient{
Codec: codec,
Client: nil,
}
@@ -430,7 +431,7 @@ func newAllPhasePodList() *api.PodList {
func ExamplePrintPodHideTerminated() {
f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, false, []string{})
tf.Client = &client.FakeRESTClient{
tf.Client = &fake.RESTClient{
Codec: codec,
Client: nil,
}
@@ -450,7 +451,7 @@ func ExamplePrintPodHideTerminated() {
func ExamplePrintPodShowAll() {
f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, false, false, true, []string{})
tf.Client = &client.FakeRESTClient{
tf.Client = &fake.RESTClient{
Codec: codec,
Client: nil,
}
@@ -472,7 +473,7 @@ func ExamplePrintPodShowAll() {
func ExamplePrintServiceWithNamespacesAndLabels() {
f, tf, codec := NewAPIFactory()
tf.Printer = kubectl.NewHumanReadablePrinter(false, true, false, false, []string{"l1"})
tf.Client = &client.FakeRESTClient{
tf.Client = &fake.RESTClient{
Codec: codec,
Client: nil,
}