From 3e8ced4bf95b8deb0ea15f8a5fa3902ae3b05db4 Mon Sep 17 00:00:00 2001 From: Ricardo Maraschini Date: Wed, 29 Apr 2026 10:10:00 +0200 Subject: [PATCH] OCPBUGS-78480: handle bookmark events in project watch tests The Kubernetes apiserver watch implementation sends bookmark events to signal completion of the initial list when SendInitialEvents=true (KEP-3157). This change updates tests to handle these bookmark events in preparation for enabling watch-list support for the project resource type. --- test/extended/project/project.go | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/test/extended/project/project.go b/test/extended/project/project.go index 10274fb78604..ec52770d4da3 100644 --- a/test/extended/project/project.go +++ b/test/extended/project/project.go @@ -141,11 +141,17 @@ var _ = g.Describe("[sig-auth][Feature:ProjectAPI] ", func() { time.Sleep(5 * time.Second) fromNowWatch, err := bobProjectClient.Projects().Watch(ctx, metav1.ListOptions{}) o.Expect(err).NotTo(o.HaveOccurred()) - select { - case event := <-fromNowWatch.ResultChan(): - g.Fail(fmt.Sprintf("unexpected event %s %#v", event.Type, event.Object)) + for { + select { + case event := <-fromNowWatch.ResultChan(): + if event.Type == watch.Bookmark { + continue + } + g.Fail(fmt.Sprintf("unexpected event %s %#v", event.Type, event.Object)) - case <-time.After(2 * time.Second): + case <-time.After(2 * time.Second): + return + } } }) }) @@ -275,6 +281,9 @@ func waitForOnlyAdd(projectName string, w watch.Interface) { } g.Fail(fmt.Sprintf("got unexpected project ADD waiting for %s: %v", project.Name, event)) } + if event.Type == watch.Bookmark { + continue + } if event.Type == watch.Modified { // ignore modifications from other projects continue