OCPBUGS-85416: Enable actuators to set terminal failure on Exists and Update#1499
OCPBUGS-85416: Enable actuators to set terminal failure on Exists and Update#1499mdbooth wants to merge 1 commit into
Conversation
An actuator can already mutate its Machine argument to specificy an explicit Failed phase. However, because we don't also pass the error, updateStatus() cannot correctly set ErrorMessage and ErrorReason.
|
@mdbooth: This pull request references Jira Issue OCPBUGS-85416, which is invalid:
Comment The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this: 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. |
WalkthroughThe machine controller now propagates errors from failed actuator operations (Exists and Update) to the Machine status patch, enabling error messages to appear in the status. Test infrastructure and test cases are extended to inject actuator errors and validate error messaging. ChangesError Propagation and Failure Status Reporting
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 11 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (11 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.12.2)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions Comment |
|
Skipping CI for Draft Pull Request. |
|
/jira refresh |
|
@mdbooth: This pull request references Jira Issue OCPBUGS-85416, which is valid. The bug has been moved to the POST state. 3 validation(s) were run on this bug
DetailsIn response to this:
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. |
|
@mdbooth: This pull request references Jira Issue OCPBUGS-85416, which is valid. 3 validation(s) were run on this bug
DetailsIn response to this:
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. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pkg/controller/machine/controller_test.go (1)
647-653: ⚡ Quick winAdd a negative assertion for unexpected
status.errorMessage.Line 647 validates only positive cases. Add an
elsebranch to assertmachine.Status.ErrorMessagestays nil when no message is expected.Proposed test hardening
if tc.expected.errorMessage != nil { if machine.Status.ErrorMessage == nil { t.Errorf("Case %s. Expected errorMessage %q, got nil", tc.request.Name, *tc.expected.errorMessage) } else if *machine.Status.ErrorMessage != *tc.expected.errorMessage { t.Errorf("Case %s. Got errorMessage: %q, expected: %q", tc.request.Name, *machine.Status.ErrorMessage, *tc.expected.errorMessage) } + } else if machine.Status.ErrorMessage != nil { + t.Errorf("Case %s. Expected nil errorMessage, got %q", tc.request.Name, *machine.Status.ErrorMessage) }🤖 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/controller/machine/controller_test.go` around lines 647 - 653, The test currently only checks when tc.expected.errorMessage is non-nil; add an else branch after that check to assert that machine.Status.ErrorMessage is nil when no error message is expected (i.e., when tc.expected.errorMessage == nil), using the same test case context (tc.request.Name) and failing the test if machine.Status.ErrorMessage is non-nil to prevent unexpected error messages leaking into the status.
🤖 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.
Nitpick comments:
In `@pkg/controller/machine/controller_test.go`:
- Around line 647-653: The test currently only checks when
tc.expected.errorMessage is non-nil; add an else branch after that check to
assert that machine.Status.ErrorMessage is nil when no error message is expected
(i.e., when tc.expected.errorMessage == nil), using the same test case context
(tc.request.Name) and failing the test if machine.Status.ErrorMessage is non-nil
to prevent unexpected error messages leaking into the status.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 9bcf11d5-6d5c-4d6d-825d-33bb4b37040c
📒 Files selected for processing (3)
pkg/controller/machine/controller.gopkg/controller/machine/controller_test.gopkg/controller/machine/testactuator.go
|
/hold until we validate openshift/machine-api-provider-azure#193 |
|
@mdbooth: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |
An actuator can already mutate its Machine argument to specificy an explicit Failed phase. However, because we don't also pass the error, updateStatus() cannot correctly set ErrorMessage and ErrorReason.
Summary by CodeRabbit
Bug Fixes
Tests