Skip to content

OCPBUGS-84867: Fix OCL test to handle temporarily empty current-machine-os-build annotation#5913

Open
dkhater-redhat wants to merge 1 commit intoopenshift:mainfrom
dkhater-redhat:fix-ocl-test-handle-empty-annotation
Open

OCPBUGS-84867: Fix OCL test to handle temporarily empty current-machine-os-build annotation#5913
dkhater-redhat wants to merge 1 commit intoopenshift:mainfrom
dkhater-redhat:fix-ocl-test-handle-empty-annotation

Conversation

@dkhater-redhat
Copy link
Copy Markdown
Contributor

@dkhater-redhat dkhater-redhat commented May 1, 2026

The waitForMOSCToUpdateCurrentMOSB helper was failing when the current-machine-os-build annotation was temporarily cleared.

Background:
When the stale annotation fix (OCPBUGS-84150) detects that the annotation points to a build for an old rendered config, it clears the annotation. This creates a brief window where the annotation is empty (between clearing stale and new build creation).

The test helper was checking: currentMOSB != mosbName When annotation is empty (""), this returns true, causing the helper to return "" (empty string) immediately. The test then tries to get a MOSB with name "" which fails with "resource name may not be empty".

Fix:
Wait for annotation to be non-empty AND different from the old MOSB:
return currentMOSB != "" && currentMOSB != mosbName

This allows the test to wait through the temporary empty state until the new MOSB is created and annotation is set.

Affected test: TestMissingImageIsRebuilt

- What I did

- How to verify it

- Description for the changelog

Summary by CodeRabbit

  • Tests
    • Improved robustness of machine OS configuration polling test to ensure annotations are both populated and updated before proceeding, preventing premature completion during temporary state changes.

…otation

The waitForMOSCToUpdateCurrentMOSB helper was failing when the
current-machine-os-build annotation was temporarily cleared.

Background:
When the stale annotation fix (OCPBUGS-84150) detects that the
annotation points to a build for an old rendered config, it clears
the annotation. This creates a brief window where the annotation is
empty (between clearing stale and new build creation).

The test helper was checking: currentMOSB != mosbName
When annotation is empty (""), this returns true, causing the helper
to return "" (empty string) immediately. The test then tries to get
a MOSB with name "" which fails with "resource name may not be empty".

Fix:
Wait for annotation to be non-empty AND different from the old MOSB:
  return currentMOSB != "" && currentMOSB != mosbName

This allows the test to wait through the temporary empty state until
the new MOSB is created and annotation is set.

Affected test: TestMissingImageIsRebuilt (and potentially others)
@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: LGTM mode

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 1, 2026

Walkthrough

This change modifies the polling logic in a test's wait function to add an additional check ensuring the MachineOSConfig annotation value is non-empty in addition to verifying it differs from the previous value, preventing premature completion when annotations are temporarily empty.

Changes

Cohort / File(s) Summary
Polling logic enhancement
test/e2e-ocl-1of2/onclusterlayering_test.go
Modified condition in waitForMOSCToUpdateCurrentMOSB to require annotation is non-empty and differs from previous MOSB name, ensuring proper synchronization before proceeding.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 10 | ❌ 2

❌ Failed checks (1 warning, 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 ❓ Inconclusive The specific test file test/e2e-ocl-1of2/onclusterlayering_test.go could not be located in the repository to evaluate test structure and quality requirements. Verify the correct branch/commit is checked out and provide access to the modified test file for assessment against quality criteria.
✅ Passed checks (10 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing a test helper to handle temporarily empty annotations, which matches the core issue and code modification described in the 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 This codebase does not use the Ginkgo test framework; it uses standard Go testing.T functions. The PR modifies only the waitForMOSCToUpdateCurrentMOSB helper function's polling logic without altering any test declarations.
Microshift Test Compatibility ✅ Passed This PR does not add any new Ginkgo e2e tests. It only modifies an existing test helper function to fix a polling condition. The check is specifically designed for new Ginkgo test additions and is therefore not applicable to this pull request.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This pull request does not add any new Ginkgo e2e tests, only modifies a helper function for existing tests.
Topology-Aware Scheduling Compatibility ✅ Passed Pull request only modifies a test helper function to improve polling robustness for handling temporarily empty annotations. No deployment manifests, operator code, controllers, or scheduling constraints are affected.
Ote Binary Stdout Contract ✅ Passed PR modifies only test helper polling logic with conditional check change; no process-level code or stdout writes involved.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The PR modifies only an existing test helper function with no new Ginkgo e2e tests added, no IPv4-specific hardcoded addresses, and no external connectivity requirements.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@openshift-ci openshift-ci Bot requested review from RishabhSaini and pablintino May 1, 2026 15:13
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 1, 2026
@dkhater-redhat dkhater-redhat changed the title Fix OCL test to handle temporarily empty current-machine-os-build ann… OCPBUGS-84867: Fix OCL test to handle temporarily empty current-machine-os-build annotation May 1, 2026
@openshift-ci-robot openshift-ci-robot added 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 May 1, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@dkhater-redhat: This pull request references Jira Issue OCPBUGS-84867, which is invalid:

  • expected the bug to target either version "5.0." or "openshift-5.0.", but it targets "4.23" 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:

…otation

The waitForMOSCToUpdateCurrentMOSB helper was failing when the current-machine-os-build annotation was temporarily cleared.

Background:
When the stale annotation fix (OCPBUGS-84150) detects that the annotation points to a build for an old rendered config, it clears the annotation. This creates a brief window where the annotation is empty (between clearing stale and new build creation).

The test helper was checking: currentMOSB != mosbName When annotation is empty (""), this returns true, causing the helper to return "" (empty string) immediately. The test then tries to get a MOSB with name "" which fails with "resource name may not be empty".

Fix:
Wait for annotation to be non-empty AND different from the old MOSB:
return currentMOSB != "" && currentMOSB != mosbName

This allows the test to wait through the temporary empty state until the new MOSB is created and annotation is set.

Affected test: TestMissingImageIsRebuilt (and potentially others)

- What I did

- How to verify it

- Description for the changelog

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.

@openshift-ci-robot openshift-ci-robot added the jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. label May 1, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@dkhater-redhat: This pull request references Jira Issue OCPBUGS-84867, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

The waitForMOSCToUpdateCurrentMOSB helper was failing when the current-machine-os-build annotation was temporarily cleared.

Background:
When the stale annotation fix (OCPBUGS-84150) detects that the annotation points to a build for an old rendered config, it clears the annotation. This creates a brief window where the annotation is empty (between clearing stale and new build creation).

The test helper was checking: currentMOSB != mosbName When annotation is empty (""), this returns true, causing the helper to return "" (empty string) immediately. The test then tries to get a MOSB with name "" which fails with "resource name may not be empty".

Fix:
Wait for annotation to be non-empty AND different from the old MOSB:
return currentMOSB != "" && currentMOSB != mosbName

This allows the test to wait through the temporary empty state until the new MOSB is created and annotation is set.

Affected test: TestMissingImageIsRebuilt

- What I did

- How to verify it

- Description for the changelog

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.

@openshift-ci-robot openshift-ci-robot removed the jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. label May 1, 2026
@openshift-ci-robot
Copy link
Copy Markdown
Contributor

@dkhater-redhat: This pull request references Jira Issue OCPBUGS-84867, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

The waitForMOSCToUpdateCurrentMOSB helper was failing when the current-machine-os-build annotation was temporarily cleared.

Background:
When the stale annotation fix (OCPBUGS-84150) detects that the annotation points to a build for an old rendered config, it clears the annotation. This creates a brief window where the annotation is empty (between clearing stale and new build creation).

The test helper was checking: currentMOSB != mosbName When annotation is empty (""), this returns true, causing the helper to return "" (empty string) immediately. The test then tries to get a MOSB with name "" which fails with "resource name may not be empty".

Fix:
Wait for annotation to be non-empty AND different from the old MOSB:
return currentMOSB != "" && currentMOSB != mosbName

This allows the test to wait through the temporary empty state until the new MOSB is created and annotation is set.

Affected test: TestMissingImageIsRebuilt

- What I did

- How to verify it

- Description for the changelog

Summary by CodeRabbit

  • Tests
  • Improved robustness of machine OS configuration polling test to ensure annotations are both populated and updated before proceeding, preventing premature completion during temporary state changes.

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.

Copy link
Copy Markdown
Member

@isabella-janssen isabella-janssen left a comment

Choose a reason for hiding this comment

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

/lgtm

@isabella-janssen
Copy link
Copy Markdown
Member

/test unit

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 1, 2026
@openshift-merge-bot
Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aws-ovn
/test e2e-aws-ovn-upgrade
/test e2e-gcp-op-part1
/test e2e-gcp-op-part2
/test e2e-gcp-op-single-node
/test e2e-hypershift

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 1, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dkhater-redhat, isabella-janssen

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [dkhater-redhat,isabella-janssen]

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

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

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants