Commit 4c8d0a3c authored by He Xiaoxi's avatar He Xiaoxi

Fix duplicate container query param on exec pod command

Signed-off-by: 's avatarHe Xiaoxi <xxhe@alauda.io>
parent 72be2f40
...@@ -311,8 +311,7 @@ func (p *ExecOptions) Run() error { ...@@ -311,8 +311,7 @@ func (p *ExecOptions) Run() error {
Resource("pods"). Resource("pods").
Name(pod.Name). Name(pod.Name).
Namespace(pod.Namespace). Namespace(pod.Namespace).
SubResource("exec"). SubResource("exec")
Param("container", containerName)
req.VersionedParams(&corev1.PodExecOptions{ req.VersionedParams(&corev1.PodExecOptions{
Container: containerName, Container: containerName,
Command: p.Command, Command: p.Command,
......
...@@ -244,6 +244,10 @@ func TestExec(t *testing.T) { ...@@ -244,6 +244,10 @@ func TestExec(t *testing.T) {
t.Errorf("%s: Did not get expected path for exec request", test.name) t.Errorf("%s: Did not get expected path for exec request", test.name)
return return
} }
if strings.Count(ex.url.RawQuery, "container=bar") != 1 {
t.Errorf("%s: Did not get expected container query param for exec request", test.name)
return
}
if ex.method != "POST" { if ex.method != "POST" {
t.Errorf("%s: Did not get method for exec request: %s", test.name, ex.method) t.Errorf("%s: Did not get method for exec request: %s", test.name, ex.method)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment