CNTRLPLANE-3576: add RestartDateAnnotation propagation tests#8733
CNTRLPLANE-3576: add RestartDateAnnotation propagation tests#8733mgencur wants to merge 1 commit into
Conversation
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
|
@mgencur: This pull request references CNTRLPLANE-3576 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 task to target the "5.0.0" version, but no target version was set. 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. |
📝 WalkthroughWalkthrough
Suggested Reviewers
🚥 Pre-merge checks | ✅ 10 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (10 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@support/controlplane-component/defaults_test.go`:
- Around line 526-528: In support/controlplane-component/defaults_test.go at
lines 526-528, replace each `_ = ...AddToScheme(scheme)` statement (for hyperv1,
corev1, and appsv1) by capturing the error return value and checking it
explicitly: if the error is not nil, call t.Fatalf with an appropriate failure
message. In
control-plane-operator/controllers/hostedcontrolplane/v2/cno/component_test.go
at line 83, apply the same fix to the appsv1.AddToScheme call by capturing its
error return value and checking it with t.Fatalf on failure. This ensures test
initialization errors in scheme registration are properly caught and reported
rather than silently ignored.
🪄 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: 340b6197-2c17-4dde-8101-7a1e8f3c4713
📒 Files selected for processing (3)
control-plane-operator/controllers/hostedcontrolplane/v2/cno/component.gocontrol-plane-operator/controllers/hostedcontrolplane/v2/cno/component_test.gosupport/controlplane-component/defaults_test.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8733 +/- ##
==========================================
+ Coverage 41.69% 41.84% +0.14%
==========================================
Files 758 759 +1
Lines 93945 94073 +128
==========================================
+ Hits 39175 39364 +189
+ Misses 52025 51954 -71
- Partials 2745 2755 +10 see 17 files with indirect coverage changes
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
fe42d7c to
8b1e0ae
Compare
8b1e0ae to
928c70f
Compare
jparrill
left a comment
There was a problem hiding this comment.
Dropped some comments. Thanks!
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: csrwng, mgencur The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold I will remove the test for SetRestartAnnotationAndPatch because it's being removed in #8751 |
…ests Verify that setDefaultOptions propagates RestartDateAnnotation from HCP to the pod template when set, and omits it when absent. This covers the mechanism that triggers rolling restarts via pod template annotation changes. Rolling out the new ReplicaSet is then Kubernetes' concern. The annotation propagation from HostedCluster to HostedControlPlane is already tested in TestReconcileHostedControlPlaneAnnotations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
928c70f to
686cc08
Compare
|
/unhold Removed the test for SetRestartAnnotationAndPatch and also the bug fix in that function, which also addresses both comments from @jparrill that were related to that part. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
support/controlplane-component/defaults_test.go (1)
677-679: Consider adding loop variable rebinding for consistency with defensive coding practices.Line 677-679 uses a range variable in a parallel subtest. While this is safe on Go 1.22+ (the minimum supported version), adding
test := testbefore thet.Runcall follows the pattern recommended in 100go.co for defensive clarity and consistency. However, this is optional refactoring—the file shows this pattern inconsistently applied (lines 618–625 have an identical pattern without rebinding), and the project's.golangci.ymldoes not enforce theloopvarlinter.Optional adjustment
for _, test := range annotationTests { + test := test t.Run(test.name, func(t *testing.T) { t.Parallel()🤖 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 `@support/controlplane-component/defaults_test.go` around lines 677 - 679, In the annotationTests loop (line 677), add a loop variable rebinding line `test := test` immediately after the for statement and before the `t.Run` call to create a local copy of the loop variable for the parallel subtest closure. This follows defensive coding practices for consistency, even though it is safe on Go 1.22+ and the project does not enforce the loopvar linter.Source: Coding guidelines
🤖 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 `@support/controlplane-component/defaults_test.go`:
- Around line 677-679: In the annotationTests loop (line 677), add a loop
variable rebinding line `test := test` immediately after the for statement and
before the `t.Run` call to create a local copy of the loop variable for the
parallel subtest closure. This follows defensive coding practices for
consistency, even though it is safe on Go 1.22+ and the project does not enforce
the loopvar linter.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: d75e2f71-8f9d-4239-8a4b-05f6d830e9ee
📒 Files selected for processing (1)
support/controlplane-component/defaults_test.go
|
/lgtm |
|
Scheduling tests matching the |
Test Resultse2e-aks
e2e-aws
|
|
/retest |
AI Test Failure AnalysisJob: Generated by hypershift-analyze-e2e-failure post-step using Claude claude-opus-4-6 |
|
/retest |
celebdor
left a comment
There was a problem hiding this comment.
/lgtm
/verified by "unit test covers the functionality it claims"
|
@celebdor: This PR has been marked as verified by 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. |
|
@mgencur: 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. |
Test Failure Analysis CompleteJob Information
Test Failure AnalysisErrorSummaryThe CI pod for this job was never scheduled onto a node in the Root CauseThe Prow CI pod could not be scheduled on any of the 98 nodes in the
This means only ~4 nodes were potentially eligible (the ones that failed on resource constraints), but all 4 were fully loaded at the time. Preemption was also not possible — no suitable victims were found. This is a transient CI infrastructure capacity issue — the Recommendations
Evidence
|
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes https://redhat.atlassian.net/browse/CNTRLPLANE-3576
Special notes for your reviewer:
Checklist:
Summary by CodeRabbit