mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 15:05:20 +00:00
Move the common test functions from cmd_test.go to cmd/testing/fake.go
This is so that we can use NewAPIFactory() from cmd/set/*test.go Up until now we would get a import loop error. This commit also adds a basic unit test case for cmd/set/set_image.go
This commit is contained in:
@@ -28,6 +28,7 @@ import (
|
||||
"k8s.io/kubernetes/pkg/api"
|
||||
"k8s.io/kubernetes/pkg/apimachinery/registered"
|
||||
"k8s.io/kubernetes/pkg/client/unversioned/fake"
|
||||
cmdtesting "k8s.io/kubernetes/pkg/kubectl/cmd/testing"
|
||||
)
|
||||
|
||||
type fakePortForwarder struct {
|
||||
@@ -67,7 +68,7 @@ func testPortForward(t *testing.T, flags map[string]string, args []string) {
|
||||
}
|
||||
for _, test := range tests {
|
||||
var err error
|
||||
f, tf, codec, ns := NewAPIFactory()
|
||||
f, tf, codec, ns := cmdtesting.NewAPIFactory()
|
||||
tf.Client = &fake.RESTClient{
|
||||
NegotiatedSerializer: ns,
|
||||
Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
|
||||
|
||||
Reference in New Issue
Block a user