Support cancelable SPDY executor stream

Mark remotecommand.Executor as deprecated and related modifications.

Handle crash when streamer.stream panics

Add a test to verify if stream is closed after connection being closed

Remove blank line and update waiting time to 1s to avoid test flakes in CI.

Refine the tests of StreamExecutor according to comments.

Remove the comment of context controlling the negotiation progress and misc.

Signed-off-by: arkbriar <arkbriar@gmail.com>

Kubernetes-commit: 42808c8343671e6783ba4c901dcd619bed648c3d
This commit is contained in:
arkbriar 2022-08-24 10:21:35 +08:00 committed by Kubernetes Publisher
parent f0a2aee8eb
commit d17f0318cc
2 changed files with 3 additions and 2 deletions

View File

@ -17,6 +17,7 @@ limitations under the License.
package attach
import (
"context"
"fmt"
"io"
"net/url"
@ -159,7 +160,7 @@ func (*DefaultRemoteAttach) Attach(method string, url *url.URL, config *restclie
if err != nil {
return err
}
return exec.Stream(remotecommand.StreamOptions{
return exec.StreamWithContext(context.Background(), remotecommand.StreamOptions{
Stdin: stdin,
Stdout: stdout,
Stderr: stderr,

View File

@ -122,7 +122,7 @@ func (*DefaultRemoteExecutor) Execute(method string, url *url.URL, config *restc
if err != nil {
return err
}
return exec.Stream(remotecommand.StreamOptions{
return exec.StreamWithContext(context.Background(), remotecommand.StreamOptions{
Stdin: stdin,
Stdout: stdout,
Stderr: stderr,