Skip to content

AGENT-1517: refactored the logic to filter IRI related MachineConfigs#31179

Open
andfasano wants to merge 1 commit into
openshift:mainfrom
andfasano:iri-update-ownership-tests
Open

AGENT-1517: refactored the logic to filter IRI related MachineConfigs#31179
andfasano wants to merge 1 commit into
openshift:mainfrom
andfasano:iri-update-ownership-tests

Conversation

@andfasano
Copy link
Copy Markdown
Contributor

@andfasano andfasano commented May 14, 2026

This patch modifies the current ownership logic to reflect the changes introduced in openshift/machine-config-operator#6041.

Also, the helper class has been simplified and some duplication removed.

Summary by CodeRabbit

  • Tests
    • Updated InternalReleaseImage test infrastructure to improve MachineConfig validation reliability. Refactored test helper methods for better test maintainability.

Also, removed duplications and simplified a little bit the helper code
@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 the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 14, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 14, 2026

@andfasano: This pull request references AGENT-1517 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

This patch modifies the current ownership logic to reflect the changes introduced in openshift/machine-config-operator#6041.

Also, the helper class has been simplified and some duplication removed.

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 May 14, 2026

Walkthrough

The IRITestHelper shifts MachineConfig discovery from OwnerReferences matching to name-suffix filtering (-internalreleaseimage), updating the method signature from returning []string to []*v1.MachineConfig. Dependent e2e tests are refactored to use the new return type and validation patterns.

Changes

Helper and Test Refactoring for Name-Suffix–Based MachineConfig Discovery

Layer / File(s) Summary
Helper API and discovery logic
test/extended/internalreleaseimage/helper.go
Added v1.MachineConfig import. Introduced tryGetIRIMachineConfigs() helper that lists MachineConfigs and filters by name suffix. Replaced GetIRIMachineConfigs() to return []*v1.MachineConfig instead of []string and removed GetIRIMachineConfigsWithMetadata() entirely. Discovery now uses name-suffix matching instead of OwnerReferences.
e2e tests using new helper
test/extended/internalreleaseimage/internalreleaseimage.go
Added v1.MachineConfig import. Updated "should create MachineConfigs" test to verify non-empty list via the refactored helper. Refactored "restore deleted MachineConfigs" reconciliation test to capture initial configs as map[string]*v1.MachineConfig, poll with tryGetIRIMachineConfigs(), and compare recreated objects by UID and CreationTimestamp changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 11 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning Unresolved review comments highlight quality issues: suffix matching for ownership detection can match unrelated MachineConfigs; CreationTimestamp.After() introduces unreliable clock semantics. Address review comments: replace suffix matching with proper ownership checks; remove CreationTimestamp.After() and rely only on UID change for proving object recreation.
✅ Passed checks (11 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: refactoring the logic to filter IRI-related MachineConfigs by moving from OwnerReferences-based checking to name-suffix filtering.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 All 13 Ginkgo test titles verified. All use stable, deterministic static strings with no dynamic content, timestamps, UUIDs, pod names, or variable references.
Microshift Test Compatibility ✅ Passed All 5 tests use machineconfiguration.openshift.io API and have [apigroup:machineconfiguration.openshift.io] tags. MicroShift CI automatically skips tests with unavailable apigroup tags.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo tests added. Existing tests refactored. Tests don't assume multi-node: only API resource ops and single-pod execution, both SNO-compatible.
Topology-Aware Scheduling Compatibility ✅ Passed PR only modifies test files in test/extended/. No deployment manifests, operator code, or scheduling constraints introduced. Test helper utilities and e2e test logic only.
Ote Binary Stdout Contract ✅ Passed PR introduces no process-level stdout writes. All logging uses e2e.Logf or Ginkgo test-level calls. No fmt.Print/Println/Printf, klog, or problematic log imports detected.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed Tests are IPv6 and disconnected-network compatible. No hardcoded IPv4 addresses, IPv4-specific parsing, or external connectivity requirements detected. All networking is cluster-internal.

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

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

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

@openshift-ci openshift-ci Bot requested review from celebdor and zaneb May 14, 2026 17:31
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 14, 2026
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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/extended/internalreleaseimage/helper.go`:
- Around line 66-69: The code currently selects MachineConfigs by name suffix
only (mc.Name HasSuffix "-internalreleaseimage") which can match unrelated
resources; instead, require an ownership signal: when iterating mcList.Items,
add a check that the MachineConfig is owned/managed by the IRI controller (e.g.
inspect mc.OwnerReferences and require an OwnerReference with Controller==true
and the expected Kind/APIVersion or a specific IRI management label), and only
append mc.DeepCopy() to iriMCs if both the name suffix AND the ownership/label
check pass (or alternatively drop the suffix and rely solely on the
owner/label). Update the selection logic around iriMCs, mcList, and
mc.DeepCopy() accordingly.

In `@test/extended/internalreleaseimage/internalreleaseimage.go`:
- Around line 102-105: The test currently requires both mc.UID != oldMC.UID and
mc.CreationTimestamp.After(oldMC.CreationTimestamp.Time) to consider a
MachineConfig recreated, which can fail due to clock/timestamp semantics; change
the check to rely solely on UID (mc.UID != oldMC.UID) when deciding to delete
from oldMCs and log verification (references: mc, oldMC, oldMCs,
CreationTimestamp.After); remove the CreationTimestamp.After(...) condition so
UID alone determines recreation and the subsequent delete/log path runs.
🪄 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: c3ee8632-bddf-461d-85b0-a58c7201751b

📥 Commits

Reviewing files that changed from the base of the PR and between b4d5333 and 3632401.

📒 Files selected for processing (2)
  • test/extended/internalreleaseimage/helper.go
  • test/extended/internalreleaseimage/internalreleaseimage.go

Comment thread test/extended/internalreleaseimage/helper.go
Comment thread test/extended/internalreleaseimage/internalreleaseimage.go
Comment thread test/extended/internalreleaseimage/helper.go
@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 May 14, 2026
@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-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 14, 2026

@andfasano: 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-csi 3632401 link true /test e2e-gcp-csi
ci/prow/e2e-aws-ovn-serial-2of2 3632401 link true /test e2e-aws-ovn-serial-2of2
ci/prow/e2e-gcp-ovn 3632401 link true /test e2e-gcp-ovn
ci/prow/e2e-vsphere-ovn-upi 3632401 link true /test e2e-vsphere-ovn-upi
ci/prow/e2e-vsphere-ovn 3632401 link true /test e2e-vsphere-ovn
ci/prow/e2e-aws-ovn-fips 3632401 link true /test e2e-aws-ovn-fips

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.

@pawanpinjarkar
Copy link
Copy Markdown
Contributor

/lgtm

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

openshift-ci Bot commented May 14, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andfasano, pawanpinjarkar

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:

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-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. 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.

3 participants