mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #123460 from liggitt/drain-proxy-output
Fix kubectl proxy e2e test
This commit is contained in:
commit
003f4c5de4
@ -2218,13 +2218,21 @@ func startProxyServer(ns string) (int, *exec.Cmd, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return -1, nil, err
|
return -1, nil, err
|
||||||
}
|
}
|
||||||
defer stdout.Close()
|
|
||||||
defer stderr.Close()
|
|
||||||
buf := make([]byte, 128)
|
buf := make([]byte, 128)
|
||||||
var n int
|
var n int
|
||||||
if n, err = stdout.Read(buf); err != nil {
|
if n, err = stdout.Read(buf); err != nil {
|
||||||
return -1, cmd, fmt.Errorf("Failed to read from kubectl proxy stdout: %w", err)
|
return -1, cmd, fmt.Errorf("Failed to read from kubectl proxy stdout: %w", err)
|
||||||
}
|
}
|
||||||
|
go func() {
|
||||||
|
out, _ := io.ReadAll(stdout)
|
||||||
|
framework.Logf("kubectl proxy stdout: %s", string(buf[:n])+string(out))
|
||||||
|
stdout.Close()
|
||||||
|
}()
|
||||||
|
go func() {
|
||||||
|
err, _ := io.ReadAll(stderr)
|
||||||
|
framework.Logf("kubectl proxy stderr: %s", string(err))
|
||||||
|
stderr.Close()
|
||||||
|
}()
|
||||||
output := string(buf[:n])
|
output := string(buf[:n])
|
||||||
match := proxyRegexp.FindStringSubmatch(output)
|
match := proxyRegexp.FindStringSubmatch(output)
|
||||||
if len(match) == 2 {
|
if len(match) == 2 {
|
||||||
|
Loading…
Reference in New Issue
Block a user