Issue 4185#1
Conversation
Signed-off-by: Rizwana777 <rizwananaaz177@gmail.com>
Signed-off-by: Rizwana777 <rizwananaaz177@gmail.com>
|
/review |
PR Reviewer Guide 🔍(Review updated until commit 7a345e5)Here are some key observations to aid the review process:
|
|
Persistent review updated to latest commit 7a345e5 |
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
|
/describe |
|
PR Description updated to latest commit (7a345e5)
|
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a bug where the ArgoCD nodePlacement stanza was removed by default and adds tests to ensure correct handling of user-patched node placement.
- Update reconciliation logic to only remove
NodePlacementwhen explicitly intended - Add a unit test for patching
NodePlacementvia the GitopsService CR - Refactor test imports to use a consistent
v1alias
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| controllers/gitopsservice_controller.go | Fix and clarify ArgoCD NodePlacement reconciliation logic (+8/–2) |
| controllers/gitopsservice_controller_test.go | Add and refactor tests for ArgoCD NodePlacement handling (+59/–4) |
| controllers/argocd_metrics_controller_test.go | Refactor test to use consistent v1.ObjectMeta import (+1/–2) |
Comments suppressed due to low confidence (3)
controllers/gitopsservice_controller_test.go:95
- [nitpick] The test function name has inconsistent capitalization for 'NodePlacement'; consider renaming to 'TestReconcileDefaultForArgoCDNodePlacement' for clarity.
func TestReconcileDefaultForArgoCDNodeplacement(t *testing.T) {
controllers/gitopsservice_controller.go:481
- There’s no unit test covering the removal branch for NodePlacement; add a test where the CR clears NodeSelector to verify NodePlacement is removed from the ArgoCD spec.
} else if existingArgoCD.Spec.NodePlacement != nil {
controllers/gitopsservice_controller.go:475
- The reconciliation logic reads from defaultArgoCDInstance.Spec.NodePlacement, but should instead reconcile based on the GitopsService CR (e.g., instance.Spec.NodePlacement or instance.Spec.NodeSelector).
if defaultArgoCDInstance.Spec.NodePlacement != nil {
User description
What type of PR is this?
What does this PR do / why we need it:
Have you updated the necessary documentation?
Which issue(s) this PR fixes:
Fixes #?
Test acceptance criteria:
How to test changes / Special notes to the reviewer:
PR Type
Bug fix, Tests
Description
Fix bug where ArgoCD
nodePlacementstanza was removed unintentionallynodePlacementcorrectlyAdd unit test to verify correct handling of
nodePlacementMinor refactoring: unify metav1 import usage in tests
Changes walkthrough 📝
gitopsservice_controller.go
Fix and clarify ArgoCD nodePlacement reconciliation logiccontrollers/gitopsservice_controller.go
nodePlacementin ArgoCD specnodePlacementis only removed when intendedgitopsservice_controller_test.go
Add and refactor tests for ArgoCD nodePlacement handlingcontrollers/gitopsservice_controller_test.go
nodePlacementupdate via GitopsService CRv1.ObjectMeta)argocd_metrics_controller_test.go
Refactor test to use consistent metav1 importcontrollers/argocd_metrics_controller_test.go
v1.ObjectMeta)