Skip to content

Commit 974117e

Browse files
committed
mockkubeapiserver: send header of watch eagerly
This mirrors reality and allows us to synchronize on watch requests, which don't return until the header has been received.
1 parent 76d36bc commit 974117e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mockkubeapiserver/listresource.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,11 @@ func (req *listResource) doWatch(ctx context.Context, s *MockKubeAPIServer, reso
103103
var opt WatchOptions
104104
opt.Namespace = req.Namespace
105105

106+
w.WriteHeader(200)
107+
if f, ok := w.(http.Flusher); ok {
108+
f.Flush()
109+
}
110+
106111
return s.storage.Watch(ctx, resource, opt, func(ev *watchEvent) error {
107112
klog.V(2).Infof("sending watch event %s", string(ev.JSON()))
108113
if partialObjectMetadata {

0 commit comments

Comments
 (0)