From 231d9af5fe614cfcead76776018fdbb386148f27 Mon Sep 17 00:00:00 2001 From: carlory Date: Wed, 21 Aug 2024 23:18:32 +0800 Subject: [PATCH] Fix hotloop once the watch closes --- test/integration/volume/persistent_volumes_test.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/integration/volume/persistent_volumes_test.go b/test/integration/volume/persistent_volumes_test.go index 22d3b21dd9e..5669301aaf5 100644 --- a/test/integration/volume/persistent_volumes_test.go +++ b/test/integration/volume/persistent_volumes_test.go @@ -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()