Skip to content

OCPBUGS-85058: monitortests: allow etcd CO blips during TNF jobs on two-node upgrades#31138

Open
eggfoobar wants to merge 2 commits intoopenshift:mainfrom
eggfoobar:fix-tnf-monitor-tests
Open

OCPBUGS-85058: monitortests: allow etcd CO blips during TNF jobs on two-node upgrades#31138
eggfoobar wants to merge 2 commits intoopenshift:mainfrom
eggfoobar:fix-tnf-monitor-tests

Conversation

@eggfoobar
Copy link
Copy Markdown
Contributor

@eggfoobar eggfoobar commented May 6, 2026

Teach legacy CVO monitor tests to treat cluster-etcd-operator condition reasons shaped as tnf-*_JobRunning as expected on DualReplica and HighlyAvailableArbiter topologies: Available=False during upgrade, and Progressing=True while machine-config is progressing.

Add isTNFJobClusterOperatorReason helper and unit tests so we only match CEO job-running surfaces, not unrelated etcd failures.

Summary by CodeRabbit

  • Bug Fixes

    • Improved upgrade monitoring: better handling of patch-level upgrades and expanded exception handling for two-node (dual-replica/TNF) clusters, reducing false-positive operator alerts (including etcd and API server behaviors).
  • Tests

    • Added unit tests to validate detection of TNF JobRunning-related operator conditions.

Teach legacy CVO monitor tests to treat cluster-etcd-operator condition
reasons shaped as tnf-*_JobRunning as expected on DualReplica and
HighlyAvailableArbiter topologies: Available=False during upgrade, and
Progressing=True while machine-config is progressing.

Add isTNFJobClusterOperatorReason helper and unit tests so we only match
CEO job-running surfaces, not unrelated etcd failures.

Co-authored-by: Cursor Composer <noreply@cursor.com>
Signed-off-by: ehila <ehila@redhat.com>
@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-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. labels May 6, 2026
@openshift-ci-robot
Copy link
Copy Markdown

@eggfoobar: This pull request references Jira Issue OCPBUGS-85058, 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)

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

Details

In response to this:

Teach legacy CVO monitor tests to treat cluster-etcd-operator condition reasons shaped as tnf-*_JobRunning as expected on DualReplica and HighlyAvailableArbiter topologies: Available=False during upgrade, and Progressing=True while machine-config is progressing.

Add isTNFJobClusterOperatorReason helper and unit tests so we only match CEO job-running surfaces, not unrelated etcd failures.

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 6, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 5a53806f-defb-4f90-8854-21c52e0ad27b

📥 Commits

Reviewing files that changed from the base of the PR and between 1a05d22 and 1486616.

📒 Files selected for processing (1)
  • pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go

Walkthrough

The PR changes the upgrade test flow to call a topology-aware progressing-state transitions function (passing admin REST config and a patch-level flag), adds TNF JobRunning reason detection and two-node topology exceptions for operator conditions, and adds unit tests for the TNF-reason detector.

Changes

Upgrade Flow & Two-Node TNF Handling

Layer / File(s) Summary
Callsite / Wiring
pkg/monitortests/clusterversionoperator/legacycvomonitortests/monitortest.go
Replaces call to testUpgradeOperatorStateTransitions(finalIntervals, w.adminRESTConfig) with testUpgradeOperatorProgressingStateTransitions(finalIntervals, level == patchUpgradeLevel, w.adminRESTConfig).
API Signature
pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go
testUpgradeOperatorProgressingStateTransitions signature changed to accept isPatchLevelUpgrade bool and clientConfig *rest.Config.
Topology Detection
pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go
When clientConfig is non-nil, computes isTwoNode via getControlPlaneTopology to determine dual-replica/HighlyAvailableArbiter topology.
TNF Reason Detector
pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go
Adds isTNFJobClusterOperatorReason helper to match TNF-shaped Reason values (e.g., tnf-..._JobRunning).
Progressing-State Exceptions
pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go
Extends progressing-state logic: in two-node topology, treat etcd Progressing=True or Available=False with TNF JobRunning-shaped reasons as allowable; adds two-node-specific openshift-apiserver exception.
State-Transitions Exceptions
pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go
Adds two-node-specific exceptions in the non-progressing state-transitions path (etcd Available=False with TNF JobRunning reason; additional openshift-apiserver precondition exception).
Unit Tests
pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators_test.go
Adds TestIsTNFJobClusterOperatorReason table-driven unit test covering TNF and non-TNF reason strings.

🎯 4 (Complex) | ⏱️ ~45 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Stable And Deterministic Test Names ❌ Error TestIsTNFJobClusterOperatorReason test names contain dynamic identifiers: node names (master-0, master-1) and generated suffixes (64736551, abc12345, deadbeef). Replace dynamic test identifiers with stable, descriptive names. Example: "tnf-auth-job-master-0-64736551_JobRunning" → "tnf-auth-job-with-node-and-generated-suffix_JobRunning"
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (10 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 describes the main change: allowing etcd CO blips during TNF jobs on two-node upgrades, which is the core purpose of the PR as evidenced by the objective to treat CEO condition reasons as expected on DualReplica/HighlyAvailableArbiter topologies.
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.
Test Structure And Quality ✅ Passed PR adds a standard Go unit test, not Ginkgo tests. The custom check targets Ginkgo test code, making it not applicable. New test follows codebase patterns and is well-structured.
Microshift Test Compatibility ✅ Passed This PR adds only a standard Go unit test (TestIsTNFJobClusterOperatorReason), not new Ginkgo e2e tests. The custom check is specific to Ginkgo e2e tests. No new e2e tests are present in this PR.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo e2e tests are added in this PR. Changes are limited to monitor tests (pkg/monitortests/) with a new unit test using standard Go testing framework, not Ginkgo. The check does not apply.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies monitor test code, not deployment manifests. No scheduling constraints introduced. Code is topology-aware.
Ote Binary Stdout Contract ✅ Passed No OTE Binary Stdout Contract violations. Changes involve function modifications and test additions. No process-level stdout writes, fmt.Print calls, or uncontrolled klog output detected.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo e2e tests added. Only standard Go unit tests modified. Check does not apply.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@eggfoobar
Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-4.22-e2e-metal-ovn-two-node-fencing-upgrade periodic-ci-openshift-release-main-nightly-5.0-e2e-metal-ovn-two-node-fencing-upgrade

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 6, 2026

@eggfoobar: trigger 2 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-4.22-e2e-metal-ovn-two-node-fencing-upgrade
  • periodic-ci-openshift-release-main-nightly-5.0-e2e-metal-ovn-two-node-fencing-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/f7d036b0-4982-11f1-8f62-95a62a82cf83-0

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 6, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: eggfoobar
Once this PR has been reviewed and has the lgtm label, please assign petr-muller 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 openshift-ci Bot requested review from deads2k and sjenning May 6, 2026 19:37
@openshift-ci-robot
Copy link
Copy Markdown

@eggfoobar: This pull request references Jira Issue OCPBUGS-85058, 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:

Teach legacy CVO monitor tests to treat cluster-etcd-operator condition reasons shaped as tnf-*_JobRunning as expected on DualReplica and HighlyAvailableArbiter topologies: Available=False during upgrade, and Progressing=True while machine-config is progressing.

Add isTNFJobClusterOperatorReason helper and unit tests so we only match CEO job-running surfaces, not unrelated etcd failures.

Summary by CodeRabbit

  • Bug Fixes

  • Enhanced upgrade monitoring and error handling for two-node cluster topologies.

  • Improved detection of specific upgrade scenarios and conditions.

  • Tests

  • Added comprehensive test coverage for TNF JobRunning reason detection in cluster operators.

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

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
pkg/monitortests/clusterversionoperator/legacycvomonitortests/monitortest.go (1)

95-99: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don’t abort the whole monitor evaluation when upgrade-level lookup fails.

This new branch turns a transient ClusterVersion read failure into EvaluateTestsFromConstructedIntervals returning an error, which drops the JUnit cases already built above. Since this value only decides whether the progressing-state suite should be skipped for patch upgrades, please fall back to a conservative skip instead of failing the entire legacy monitor run.

Suggested change
-		level, err := getUpgradeLevel(w.adminRESTConfig)
-		if err != nil || level == unknownUpgradeLevel {
-			return nil, fmt.Errorf("failed to determine upgrade level: %w", err)
-		}
-		junits = append(junits, testUpgradeOperatorProgressingStateTransitions(finalIntervals, level == patchUpgradeLevel, w.adminRESTConfig)...)
+		isPatchLevelUpgrade := true // default to skipping this suite if the level cannot be determined
+		if level, err := getUpgradeLevel(w.adminRESTConfig); err == nil && level != unknownUpgradeLevel {
+			isPatchLevelUpgrade = level == patchUpgradeLevel
+		}
+		junits = append(junits, testUpgradeOperatorProgressingStateTransitions(finalIntervals, isPatchLevelUpgrade, w.adminRESTConfig)...)
🤖 Prompt for 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.

In `@pkg/monitortests/clusterversionoperator/legacycvomonitortests/monitortest.go`
around lines 95 - 99, The code currently returns an error when getUpgradeLevel
fails which aborts EvaluateTestsFromConstructedIntervals and drops previously
built JUnit cases; instead, swallow the transient failure and conservatively
skip the progressing-state suite: call getUpgradeLevel(w.adminRESTConfig), and
if it returns an error or unknownUpgradeLevel, do not return—set isPatch :=
false (or treat as non-patch); otherwise set isPatch := (level ==
patchUpgradeLevel); then call
testUpgradeOperatorProgressingStateTransitions(finalIntervals, isPatch,
w.adminRESTConfig) and append its results to junits; ensure no early return on
getUpgradeLevel failure so previously accumulated junits are preserved.
🤖 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.

Outside diff comments:
In
`@pkg/monitortests/clusterversionoperator/legacycvomonitortests/monitortest.go`:
- Around line 95-99: The code currently returns an error when getUpgradeLevel
fails which aborts EvaluateTestsFromConstructedIntervals and drops previously
built JUnit cases; instead, swallow the transient failure and conservatively
skip the progressing-state suite: call getUpgradeLevel(w.adminRESTConfig), and
if it returns an error or unknownUpgradeLevel, do not return—set isPatch :=
false (or treat as non-patch); otherwise set isPatch := (level ==
patchUpgradeLevel); then call
testUpgradeOperatorProgressingStateTransitions(finalIntervals, isPatch,
w.adminRESTConfig) and append its results to junits; ensure no early return on
getUpgradeLevel failure so previously accumulated junits are preserved.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: CHILL

Plan: Enterprise

Run ID: c4c2d66f-fa68-4d8c-ad75-24b48e3774e1

📥 Commits

Reviewing files that changed from the base of the PR and between 65324f7 and 1a05d22.

📒 Files selected for processing (3)
  • pkg/monitortests/clusterversionoperator/legacycvomonitortests/monitortest.go
  • pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators.go
  • pkg/monitortests/clusterversionoperator/legacycvomonitortests/operators_test.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 6, 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

@eggfoobar
Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-4.22-e2e-metal-ovn-two-node-fencing-upgrade periodic-ci-openshift-release-main-nightly-5.0-e2e-metal-ovn-two-node-fencing-upgrade

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 6, 2026

@eggfoobar: trigger 2 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-4.22-e2e-metal-ovn-two-node-fencing-upgrade
  • periodic-ci-openshift-release-main-nightly-5.0-e2e-metal-ovn-two-node-fencing-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/9a2372a0-49a2-11f1-8086-2c655c08170e-0

…low-ups

Allow etcd Progressing while MCO runs when CEO reports EtcdMembers_MembersNotStarted
(member still joining during fencing/replacement), in addition to existing tnf-*_JobRunning.

On dual-replica, tolerate openshift-apiserver Available blips for
APIServices_PreconditionNotReady during upgrade, and MCO-time Progressing for
OperatorConfig_NewGeneration (openshift-apiserver) and APIServerDeployment_NewGeneration
(authentication) as operators roll the control plane alongside machine-config.

Co-authored-by: Cursor Composer <noreply@cursor.com>
Signed-off-by: ehila <ehila@redhat.com>
@eggfoobar
Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-4.22-e2e-metal-ovn-two-node-fencing-upgrade periodic-ci-openshift-release-main-nightly-5.0-e2e-metal-ovn-two-node-fencing-upgrade

1 similar comment
@eggfoobar
Copy link
Copy Markdown
Contributor Author

/payload-job periodic-ci-openshift-release-main-nightly-4.22-e2e-metal-ovn-two-node-fencing-upgrade periodic-ci-openshift-release-main-nightly-5.0-e2e-metal-ovn-two-node-fencing-upgrade

@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 7, 2026

@eggfoobar: trigger 2 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-4.22-e2e-metal-ovn-two-node-fencing-upgrade
  • periodic-ci-openshift-release-main-nightly-5.0-e2e-metal-ovn-two-node-fencing-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/ccb215f0-49d9-11f1-8175-d81295c02a18-0

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 7, 2026

@eggfoobar: trigger 2 job(s) for the /payload-(with-prs|job|aggregate|job-with-prs|aggregate-with-prs) command

  • periodic-ci-openshift-release-main-nightly-4.22-e2e-metal-ovn-two-node-fencing-upgrade
  • periodic-ci-openshift-release-main-nightly-5.0-e2e-metal-ovn-two-node-fencing-upgrade

See details on https://pr-payload-tests.ci.openshift.org/runs/ci/84b75970-49db-11f1-8000-23a6f1e43003-0

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

Labels

jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. 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. 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