mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 23:15:14 +00:00
parent
c2c86b0a6d
commit
bd2eb2fa8f
@ -261,11 +261,7 @@ func TestForwardPorts(t *testing.T) {
|
||||
go func() {
|
||||
doneChan <- pf.ForwardPorts()
|
||||
}()
|
||||
select {
|
||||
case <-pf.Ready:
|
||||
case <-time.After(500 * time.Millisecond):
|
||||
t.Fatalf("%d: timed out waiting for listeners", i)
|
||||
}
|
||||
<-pf.Ready
|
||||
|
||||
conn := testCase.Upgrader.conn
|
||||
|
||||
@ -301,13 +297,9 @@ func TestForwardPorts(t *testing.T) {
|
||||
close(stopChan)
|
||||
|
||||
// wait for r.ForwardPorts to actually return
|
||||
select {
|
||||
case err := <-doneChan:
|
||||
if err != nil {
|
||||
t.Fatalf("%d: unexpected error: %s", err)
|
||||
}
|
||||
case <-time.After(200 * time.Millisecond):
|
||||
t.Fatalf("%d: timeout waiting for ForwardPorts to finish")
|
||||
err = <-doneChan
|
||||
if err != nil {
|
||||
t.Fatalf("%d: unexpected error: %s", err)
|
||||
}
|
||||
|
||||
if e, a := len(testCase.Send), len(conn.streams); e != a {
|
||||
|
@ -569,17 +569,6 @@ func TestServeExecInContainerIdleTimeout(t *testing.T) {
|
||||
return 100 * time.Millisecond
|
||||
}
|
||||
|
||||
idleSuccess := make(chan struct{})
|
||||
|
||||
fw.fakeKubelet.execFunc = func(podFullName string, uid types.UID, containerName string, cmd []string, in io.Reader, out, stderr io.WriteCloser, tty bool) error {
|
||||
select {
|
||||
case <-idleSuccess:
|
||||
case <-time.After(150 * time.Millisecond):
|
||||
t.Fatalf("execFunc timed out waiting for idle timeout")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
podNamespace := "other"
|
||||
podName := "foo"
|
||||
expectedContainerName := "baz"
|
||||
@ -605,19 +594,14 @@ func TestServeExecInContainerIdleTimeout(t *testing.T) {
|
||||
defer conn.Close()
|
||||
|
||||
h := http.Header{}
|
||||
h.Set("type", "input")
|
||||
h.Set(api.StreamType, api.StreamTypeError)
|
||||
stream, err := conn.CreateStream(h)
|
||||
if err != nil {
|
||||
t.Fatalf("error creating input stream: %v", err)
|
||||
}
|
||||
defer stream.Reset()
|
||||
|
||||
select {
|
||||
case <-conn.CloseChan():
|
||||
close(idleSuccess)
|
||||
case <-time.After(150 * time.Millisecond):
|
||||
t.Fatalf("Timed out waiting for connection closure due to idle timeout")
|
||||
}
|
||||
<-conn.CloseChan()
|
||||
}
|
||||
|
||||
func TestServeExecInContainer(t *testing.T) {
|
||||
@ -698,11 +682,7 @@ func TestServeExecInContainer(t *testing.T) {
|
||||
t.Fatalf("%d:, error writing to stdout: %v", i, err)
|
||||
}
|
||||
out.Close()
|
||||
select {
|
||||
case <-clientStdoutReadDone:
|
||||
case <-time.After(10 * time.Millisecond):
|
||||
t.Fatalf("%d: timed out waiting for client to read stdout", i)
|
||||
}
|
||||
<-clientStdoutReadDone
|
||||
} else if out != nil {
|
||||
t.Fatalf("%d: stdout: expected nil: %#v", i, out)
|
||||
}
|
||||
@ -720,11 +700,7 @@ func TestServeExecInContainer(t *testing.T) {
|
||||
t.Fatalf("%d:, error writing to stderr: %v", i, err)
|
||||
}
|
||||
stderr.Close()
|
||||
select {
|
||||
case <-clientStderrReadDone:
|
||||
case <-time.After(10 * time.Millisecond):
|
||||
t.Fatalf("%d: timed out waiting for client to read stderr", i)
|
||||
}
|
||||
<-clientStderrReadDone
|
||||
} else if stderr != nil {
|
||||
t.Fatalf("%d: stderr: expected nil: %#v", i, stderr)
|
||||
}
|
||||
@ -858,11 +834,7 @@ func TestServeExecInContainer(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
case <-execFuncDone:
|
||||
case <-time.After(10 * time.Millisecond):
|
||||
t.Fatalf("%d: timed out waiting for execFunc to complete", i)
|
||||
}
|
||||
<-execFuncDone
|
||||
}
|
||||
}
|
||||
|
||||
@ -873,17 +845,6 @@ func TestServePortForwardIdleTimeout(t *testing.T) {
|
||||
return 100 * time.Millisecond
|
||||
}
|
||||
|
||||
idleSuccess := make(chan struct{})
|
||||
|
||||
fw.fakeKubelet.portForwardFunc = func(name string, uid types.UID, port uint16, stream io.ReadWriteCloser) error {
|
||||
select {
|
||||
case <-idleSuccess:
|
||||
case <-time.After(150 * time.Millisecond):
|
||||
t.Fatalf("execFunc timed out waiting for idle timeout")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
podNamespace := "other"
|
||||
podName := "foo"
|
||||
|
||||
@ -907,12 +868,7 @@ func TestServePortForwardIdleTimeout(t *testing.T) {
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
select {
|
||||
case <-conn.CloseChan():
|
||||
close(idleSuccess)
|
||||
case <-time.After(150 * time.Millisecond):
|
||||
t.Fatalf("Timed out waiting for connection closure due to idle timeout")
|
||||
}
|
||||
<-conn.CloseChan()
|
||||
}
|
||||
|
||||
func TestServePortForward(t *testing.T) {
|
||||
@ -1054,10 +1010,6 @@ func TestServePortForward(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
select {
|
||||
case <-portForwardFuncDone:
|
||||
case <-time.After(100 * time.Millisecond):
|
||||
t.Fatalf("%d: timed out waiting for portForwardFuncDone", i)
|
||||
}
|
||||
<-portForwardFuncDone
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user