-
Notifications
You must be signed in to change notification settings - Fork 6.5k
test: add a unit test for argocd admin import command #22782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add a unit test for argocd admin import command #22782
Conversation
❌ Preview Environment deleted from BunnyshellAvailable commands (reply to this comment):
|
…#22711) Signed-off-by: Michael Crenshaw <[email protected]> Signed-off-by: Manish Kumar <[email protected]>
Signed-off-by: Manish Kumar <[email protected]>
e479a7d to
7d3ca71
Compare
… feature/add-unit-test-admin-cli
Signed-off-by: Manish Kumar <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #22782 +/- ##
==========================================
+ Coverage 56.02% 56.07% +0.04%
==========================================
Files 343 343
Lines 57551 57551
==========================================
+ Hits 32242 32269 +27
+ Misses 22653 22632 -21
+ Partials 2656 2650 -6 ☔ View full report in Codecov by Sentry. |
| }) | ||
| } | ||
| if kind != "" { | ||
| cm.Kind = kind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, but we create cm as a ConfigMap, how can we override the kind?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the updateLive function, we are checking different kinds, so I have added this override to include these lines in the code coverage.
|
Still, this looks off. Config map already has a fixed kind IIUC.
…On Sun, Apr 27, 2025 at 8:32 AM Manish Kumar ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In cmd/argocd/commands/admin/backup_test.go
<#22782 (comment)>:
> @@ -36,6 +37,10 @@ func newBackupObject(trackingValue string, trackingLabel bool, trackingAnnotatio
common.AnnotationKeyAppInstance: trackingValue,
})
}
+ if kind != "" {
+ cm.Kind = kind
In the updateLive function
<https://github.com/argoproj/argo-cd/blob/master/cmd/argocd/commands/admin/backup.go#L489>,
we are checking different kinds, so I have added this override to include
these lines in the code coverage.
Screenshot.2025-04-27.at.8.58.30.PM.png (view on web)
<https://github.com/user-attachments/assets/b87d9db1-6a2b-41e0-a807-6f2f34cc64a6>
—
Reply to this email directly, view it on GitHub
<#22782 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA2VCNUOB4C52NIDP3A5VYD23T2BNAVCNFSM6AAAAAB3Z5XJHKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDOOJXGY3TMMBUGM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
This is just a test function. We can remove the kind from it, or I can create a different test function for different types of kinds. |
|
FYI, this PR will need more test code to increase the code coverage for the Import/Export methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already an existing PR: #22780
Checklist: