Skip to content

NO-JIRA: fix flaky TestReconcile/machine_with_node_likely_to_go_unhealthy#1483#1483

Merged
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
openshift-cloud-team:fix-flaky-mhc-requeue-test
Mar 19, 2026
Merged

NO-JIRA: fix flaky TestReconcile/machine_with_node_likely_to_go_unhealthy#1483#1483
openshift-merge-bot[bot] merged 1 commit intoopenshift:mainfrom
openshift-cloud-team:fix-flaky-mhc-requeue-test

Conversation

@RadekManak
Copy link
Contributor

The test set LastTransitionTime = time.Now() once at TestReconcile init, then ran four other test cases before the timing-sensitive one. If those cases took >2s total, durationUnhealthy exceeded the ±1s tolerance window and the test failed intermittently.

Fix by resetting LastTransitionTime immediately before buildRunTimeObjects is called for that specific test case, ensuring durationUnhealthy ≈ 0 at reconcile time.

…kely_to_go_unhealthy

The test set LastTransitionTime = time.Now() once at TestReconcile
init, then ran four other test cases before the timing-sensitive one.
If those cases took >2s total, durationUnhealthy exceeded the ±1s
tolerance window and the test failed intermittently.

Fix by resetting LastTransitionTime immediately before buildRunTimeObjects
is called for that specific test case, ensuring durationUnhealthy ≈ 0
at reconcile time.
@coderabbitai
Copy link

coderabbitai bot commented Mar 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fe28bbff-3115-4d98-84ef-ea8c9b9bb97b

📥 Commits

Reviewing files that changed from the base of the PR and between 4566a9a and b60e775.

📒 Files selected for processing (1)
  • pkg/controller/machinehealthcheck/machinehealthcheck_controller_test.go

Walkthrough

The test file for the machine health check controller has been extended with a per-test setup hook mechanism. A new optional setup function field was added to the testCase struct, with the test runner invoking this hook before reconciliation. One test case now uses this mechanism to update time-sensitive status fields.

Changes

Cohort / File(s) Summary
Machine Health Check Controller Tests
pkg/controller/machinehealthcheck/machinehealthcheck_controller_test.go
Added optional setup func() hook to testCase struct; updated TestReconcile runner to invoke setup before reconciliation; implemented setup in one test case to update nodeRecentlyUnhealthy.Status.Conditions[0].LastTransitionTime.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.3)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


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

Tip

CodeRabbit can use Trivy to scan for security misconfigurations and secrets in Infrastructure as Code files.

Add a .trivyignore file to your project to customize which findings Trivy reports.

@nrb
Copy link
Contributor

nrb commented Mar 19, 2026

/lgtm
/approve

@openshift-ci openshift-ci bot requested review from mdbooth and racheljpg March 19, 2026 13:52
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 19, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nrb

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 19, 2026
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Mar 19, 2026
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 19, 2026

@RadekManak: all tests passed!

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.

@nrb
Copy link
Contributor

nrb commented Mar 19, 2026

/retitle NO-JIRA: fix flaky TestReconcile/machine_with_node_likely_to_go_unhealthy#1483

@openshift-ci openshift-ci bot changed the title fix flaky TestReconcile/machine_with_node_likely_to_go_unhealthy NO-JIRA: fix flaky TestReconcile/machine_with_node_likely_to_go_unhealthy#1483 Mar 19, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 19, 2026
@openshift-ci-robot
Copy link
Contributor

@RadekManak: This pull request explicitly references no jira issue.

Details

In response to this:

The test set LastTransitionTime = time.Now() once at TestReconcile init, then ran four other test cases before the timing-sensitive one. If those cases took >2s total, durationUnhealthy exceeded the ±1s tolerance window and the test failed intermittently.

Fix by resetting LastTransitionTime immediately before buildRunTimeObjects is called for that specific test case, ensuring durationUnhealthy ≈ 0 at reconcile time.

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.

@nrb
Copy link
Contributor

nrb commented Mar 19, 2026

/verified by passing units in CI

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Mar 19, 2026
@openshift-ci-robot
Copy link
Contributor

@nrb: This PR has been marked as verified by passing units in CI.

Details

In response to this:

/verified by passing units in CI

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-merge-bot openshift-merge-bot bot merged commit 955112f into openshift:main Mar 19, 2026
15 checks passed
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. verified Signifies that the PR passed pre-merge verification criteria

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants