Skip to content

OCPBUGS-78480: handle bookmark events in project watch tests#31095

Open
ricardomaraschini wants to merge 1 commit intoopenshift:mainfrom
ricardomaraschini:OCPBUGS-78480
Open

OCPBUGS-78480: handle bookmark events in project watch tests#31095
ricardomaraschini wants to merge 1 commit intoopenshift:mainfrom
ricardomaraschini:OCPBUGS-78480

Conversation

@ricardomaraschini
Copy link
Copy Markdown
Contributor

@ricardomaraschini ricardomaraschini commented Apr 29, 2026

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.

Summary by CodeRabbit

  • Tests
    • Improved watch-event handling in project tests to increase test reliability by filtering out bookmark events.

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.
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: automatic mode

@openshift-ci-robot openshift-ci-robot added jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Apr 29, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@ricardomaraschini: This pull request references Jira Issue OCPBUGS-78480, which is invalid:

  • expected the bug to target either version "5.0." or "openshift-5.0.", but it targets "4.23.0" instead

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

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.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

Walkthrough

Changes to the watch-event handling in TestProjectWatch add a loop-based timeout mechanism and modify event filtering to explicitly skip watch.Bookmark events rather than treating them as unexpected test failures.

Changes

Cohort / File(s) Summary
Test Watch-Event Handling
test/extended/project/project.go
Modified TestProjectWatch to use a loop with 2-second timeout instead of one-shot select; updated waitForOnlyAdd to skip watch.Bookmark events before enforcing that the first event is watch.Added, preventing bookmark noise from triggering test failures.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 9 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ⚠️ Warning Channel read at line 146 lacks ok value check, causing panic on watch closure; inconsistent with waitForOnlyDelete() pattern and violates safe channel handling practices. Add ok check: case event, ok := <-fromNowWatch.ResultChan(): if !ok { fail }. Refactor multi-scenario test into focused tests. Add descriptive failure messages to all assertions.
Microshift Test Compatibility ❓ Inconclusive Unable to locate and examine the modified test/extended/project/project.go file to verify MicroShift compatibility protections for watch event handling changes. Examine the modified test functions (TestProjectWatch and waitForOnlyAdd) to confirm they include [Skipped:MicroShift], [apigroup:project.openshift.io], or exutil.IsMicroShiftCluster() checks.
✅ Passed checks (9 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and specifically addresses the main change: handling bookmark events in project watch tests, matching the core purpose shown in the raw summary and PR objectives.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed Changes modify test logic for watch-event handling but do not introduce dynamic or non-deterministic information in Ginkgo test names.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR adds Ginkgo tests for Project API and RBAC without multi-node assumptions; changes handle bookmark events which are topology-agnostic.
Topology-Aware Scheduling Compatibility ✅ Passed This PR modifies only test code in test/extended/project/project.go to handle bookmark events in watch tests. The custom check assesses deployment manifests, operator code, and controllers for topology-aware scheduling constraints. Since this PR contains no such components, the check is not applicable and passes.
Ote Binary Stdout Contract ✅ Passed PR modifies only test-level code within Ginkgo specifications and helper functions, with no process-level code changes affecting the OTE binary's JSON stdout contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR modifies existing Ginkgo tests to handle Kubernetes watch bookmark events, not adding new tests. The custom check applies only to new tests being added.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Review rate limit: 9/10 reviews remaining, refill in 6 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci openshift-ci Bot requested review from deads2k and sjenning April 29, 2026 08:15
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@test/extended/project/project.go`:
- Around line 144-154: The loop reads from fromNowWatch.ResultChan() without
checking the channel close, which can panic when event is nil; update the select
case that receives "event := <-fromNowWatch.ResultChan()" to use the comma-ok
form (event, ok := <-fromNowWatch.ResultChan()), treat ok==false as a closed
watch and break/return (or continue as appropriate), and only access event.Type
and event.Object when ok is true (preserving the existing watch.Bookmark check
and g.Fail call otherwise).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 43553b6e-60d0-4644-a283-f54560dc7bb4

📥 Commits

Reviewing files that changed from the base of the PR and between 131c4f1 and 3e8ced4.

📒 Files selected for processing (1)
  • test/extended/project/project.go

Comment thread test/extended/project/project.go
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Scheduling required tests:
/test e2e-aws-csi
/test e2e-aws-ovn-fips
/test e2e-aws-ovn-microshift
/test e2e-aws-ovn-microshift-serial
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-gcp-csi
/test e2e-gcp-ovn
/test e2e-gcp-ovn-upgrade
/test e2e-metal-ipi-ovn-ipv6
/test e2e-vsphere-ovn
/test e2e-vsphere-ovn-upi

@openshift-merge-bot openshift-merge-bot Bot added the ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review label Apr 29, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 29, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: coderabbitai[bot], ricardomaraschini
Once this PR has been reviewed and has the lgtm label, please assign stbenjam for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 29, 2026

@ricardomaraschini: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-ovn-upgrade 3e8ced4 link true /test e2e-gcp-ovn-upgrade
ci/prow/e2e-aws-ovn-serial-1of2 3e8ced4 link true /test e2e-aws-ovn-serial-1of2

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. jira/severity-critical Referenced Jira bug's severity is critical for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. ready-for-human-review Indicates a PR has been reviewed by automated tools and is ready for human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants