diff --git a/staging/src/k8s.io/apiserver/pkg/util/wsstream/stream.go b/staging/src/k8s.io/apiserver/pkg/util/wsstream/stream.go index 4253c17cf57..ba7e6a519af 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/wsstream/stream.go +++ b/staging/src/k8s.io/apiserver/pkg/util/wsstream/stream.go @@ -63,7 +63,7 @@ type Reader struct { protocols map[string]ReaderProtocolConfig selectedProtocol string - handleCrash func() // overridable for testing + handleCrash func(additionalHandlers ...func(interface{})) // overridable for testing } // NewReader creates a WebSocket pipe that will copy the contents of r to a provided @@ -78,7 +78,7 @@ func NewReader(r io.Reader, ping bool, protocols map[string]ReaderProtocolConfig err: make(chan error), ping: ping, protocols: protocols, - handleCrash: func() { runtime.HandleCrash() }, + handleCrash: runtime.HandleCrash, } } diff --git a/staging/src/k8s.io/apiserver/pkg/util/wsstream/stream_test.go b/staging/src/k8s.io/apiserver/pkg/util/wsstream/stream_test.go index 09dda761f8c..433eabc5bc8 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/wsstream/stream_test.go +++ b/staging/src/k8s.io/apiserver/pkg/util/wsstream/stream_test.go @@ -169,7 +169,7 @@ func TestStreamSurvivesPanic(t *testing.T) { r := NewReader(errs, false, NewDefaultReaderProtocols()) // do not call runtime.HandleCrash() in handler. Otherwise, the tests are interrupted. - r.handleCrash = func() { recover() } + r.handleCrash = func(additionalHandlers ...func(interface{})) { recover() } data, err := readWebSocket(r, t, nil) if !reflect.DeepEqual(data, []byte(input)) {