kubectl port-forward allows using resource name to select a matching pod

This commit is contained in:
Shawn Hsiao
2018-02-13 12:10:02 -05:00
parent 245ca8ef1f
commit 139c62c3e9
2 changed files with 54 additions and 22 deletions

View File

@@ -70,6 +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{
VersionedAPIPath: "/api/v1",
GroupVersion: schema.GroupVersion{Group: ""},
NegotiatedSerializer: ns,
Client: fake.CreateHTTPClient(func(req *http.Request) (*http.Response, error) {
@@ -131,7 +132,3 @@ func testPortForward(t *testing.T, flags map[string]string, args []string) {
func TestPortForward(t *testing.T) {
testPortForward(t, nil, []string{"foo", ":5000", ":1000"})
}
func TestPortForwardWithPFlag(t *testing.T) {
testPortForward(t, map[string]string{"pod": "foo"}, []string{":5000", ":1000"})
}