-
Notifications
You must be signed in to change notification settings - Fork 6.5k
feat: Add tests for - argocd admin import command
#22780
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
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: yaten2302 <[email protected]>
❌ Preview Environment undeployed from BunnyshellAvailable commands (reply to this comment):
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #22780 +/- ##
=========================================
Coverage ? 60.87%
=========================================
Files ? 351
Lines ? 60548
Branches ? 0
=========================================
Hits ? 36858
Misses ? 20762
Partials ? 2928 ☔ View full report in Codecov by Sentry. |
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.
Is this PR ready for review? I only see one test case.
|
@nitishfy , added 5 test cases 👍 |
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.
You're required to add all the test cases that checks these scenarios:
- Resource should be pruned when --prune and missing from backup
- Resource should be created when missing from live
- Resource tracking annotation should not be updated when --ignore-tracking
- Application operation should removed when --stop-operation
- Update operation should retry on conflict when --override-on-conflict
- Resource should not be pruned if present in backup and backup resource matches --skip-resources-with-label
- Resource should not be pruned if missing from backup, but live matches --skip-resources-with-label
- Test application-namespace feature
- Test applicationset-namespace feature
- Dry run should not modify any resources
|
I'd suggest learning about these things one at a time. For eg. What is the use of import command, why do we use the prune flag, and what is the application namespace feature? Pick one test case at a time. Try to understand what this feature means, look at the code to see how it is written and then write a test case to validate it. You may be required to even put that logic in a new function and call that function in the test case to validate the scenario. |
Yes, sure, will add with the flags as well 👍 |
Yes, I've already read the entire input command code, and now I've a good understanding of the same. |
Signed-off-by: yaten2302 <[email protected]>
…flags Signed-off-by: yaten2302 <[email protected]>
Signed-off-by: yaten2302 <[email protected]>
Signed-off-by: yaten2302 <[email protected]>
Signed-off-by: yaten2302 <[email protected]>
|
Hey @nitishfy , could you kindly have a look at the tests for the |
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.
I like the structure of the tests, but reading a few different scenario names, I am not sure what it is actually testing. For instance, "It should update the live object according to the backup object if the backup object doesn't have the skip label". This test the happy path. where is the test that validates that it should not update the resource when it matches the label?
Similar comment for the following tests, they seem to all be testing the happy path, and not the conditional scenarios
- "Spec should be updated correctly in live object according to the backup object"
- "It should update the data of the live object according to the backup object"
- "It should update live object's spec according to the backup object"
|
Yes @agaudreault , actually I forgot to update the names of the test cases. Pushing the changes for the same 👍 |
Signed-off-by: yaten2302 <[email protected]>
…backup Signed-off-by: yaten2302 <[email protected]>
Signed-off-by: Yaten <[email protected]>
|
Hi @nitishfy @agaudreault , I've pushed a commit according to the suggestions. Since, I didn't have any reviews how to proceed, I tried to refactor the Run func and I broke it down into Kindly have a look at it, if I'm going in the correct direction? Thanks |
…s() helper funcs Signed-off-by: Yaten <[email protected]>
|
Hi @nitishfy @agaudreault , I've pushed a commit in which I've refactored the NewImportCommand() by adding the required Could you kindly have a look that is this the desired behaviour which you are expecting? I've asked for review multiple times on this. |
|
Can you fix the failing tests? |
|
Sure, I'll push the commits today to fix the tests👍 |
Signed-off-by: Yaten <[email protected]>
Signed-off-by: Yaten <[email protected]>
|
Hi @nitishfy , all checks are passing now. Previously there was 1 failing check, but when I pulled the latest changes, it's fixed 👍 Thanks :) |
|
Hi @nitishfy , could you kindly review this :) |
Fixes #21895
This PR adds unit test for

argocd admin importcommand.Checklist: