From 7f6f85bd7b47db239868bcd868ae3472373a4f05 Mon Sep 17 00:00:00 2001 From: Clayton Coleman Date: Thu, 15 Oct 2015 16:38:24 -0400 Subject: [PATCH] Fix attach, which was broken during the refactor The new e2e test catches the break in attach (no e2e test exposed this codepath before). --- pkg/kubectl/cmd/attach.go | 10 ++++++++-- pkg/kubectl/cmd/attach_test.go | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pkg/kubectl/cmd/attach.go b/pkg/kubectl/cmd/attach.go index 6dcd579ccc9..611cc0b6565 100644 --- a/pkg/kubectl/cmd/attach.go +++ b/pkg/kubectl/cmd/attach.go @@ -202,8 +202,14 @@ func (p *AttachOptions) Run() error { Resource("pods"). Name(pod.Name). Namespace(pod.Namespace). - SubResource("attach"). - Param("container", p.GetContainerName(pod)) + SubResource("attach") + req.VersionedParams(&api.PodAttachOptions{ + Container: p.GetContainerName(pod), + Stdin: stdin != nil, + Stdout: p.Out != nil, + Stderr: p.Err != nil, + TTY: tty, + }, api.Scheme) return p.Attach.Attach("POST", req.URL(), p.Config, stdin, p.Out, p.Err, tty) } diff --git a/pkg/kubectl/cmd/attach_test.go b/pkg/kubectl/cmd/attach_test.go index acf44470fd9..c508fcf27c6 100644 --- a/pkg/kubectl/cmd/attach_test.go +++ b/pkg/kubectl/cmd/attach_test.go @@ -186,6 +186,9 @@ func TestAttach(t *testing.T) { if ex.method != "POST" { t.Errorf("%s: Did not get method for attach request: %s", test.name, ex.method) } + if ex.url.Query().Get("container") != "bar" { + t.Errorf("%s: Did not have query parameters: %s", test.name, ex.url.Query()) + } } }