Fix hotloop once the watch closes

This commit is contained in:
carlory 2024-08-21 23:18:32 +08:00
parent b6ef1c80e2
commit 231d9af5fe

View File

@ -1068,7 +1068,16 @@ func TestPersistentVolumeProvisionMultiPVCs(t *testing.T) {
}
for {
select {
case event := <-w.ResultChan():
case event, ok := <-w.ResultChan():
if !ok {
klog.Info("Event watch channel closed")
w, err = testClient.EventsV1().Events(ns.Name).Watch(tCtx, metav1.ListOptions{})
if err != nil {
klog.ErrorS(err, "Failed to restart event watch")
return
}
continue
}
reportToArtifacts(t.Name()+"-events.text", event.Object)
case <-tCtx.Done():
w.Stop()