Skip to content
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

chore: adding test coverage for the notification_controller #13339

Merged
merged 10 commits into from
Apr 27, 2023

Conversation

zhaque44
Copy link
Contributor

@zhaque44 zhaque44 commented Apr 24, 2023

Adding tests for the notifications_controller | controller package:

  • Added two tests for the Init function.

This test helps ArgoCD users because:

  • The Init function initializes various informers that the Notification Controller relies on for its functionality. If the informers fail to initialize, then the NotificationController will not be able to properly function, which would be problematic for ArgoCD users.
  • It ensures that the Notification Controller is properly configured with the correct parameters, such as the Kubernetes client and informers, as well as the required labels and secrets/config maps. This is important because users of the package may be using it in different environments with different configurations, so it's important to ensure that the package is properly configured to function correctly in any environment.

Added test for getAppProj function.

  • This test verifies that getAppProj gracefully handles missing field and returns nil when that happens.

Note on DCO:

If the DCO action in the integration test fails, one or more of your commits are not signed off. Please click on the Details link next to the DCO action for instructions on how to resolve this.

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.

Please see Contribution FAQs if you have questions about your pull-request.

Signed-off-by: zhaque44 <haque.zubair@gmail.com>
…oller

Signed-off-by: zhaque44 <haque.zubair@gmail.com>
@codecov
Copy link

codecov bot commented Apr 24, 2023

Codecov Report

Patch coverage has no change and project coverage change: +0.04 🎉

Comparison is base (ceed653) 49.01% compared to head (c813ed3) 49.06%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #13339      +/-   ##
==========================================
+ Coverage   49.01%   49.06%   +0.04%     
==========================================
  Files         247      248       +1     
  Lines       42685    42810     +125     
==========================================
+ Hits        20924    21006      +82     
- Misses      19645    19684      +39     
- Partials     2116     2120       +4     

see 6 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: zhaque44 <haque.zubair@gmail.com>
Signed-off-by: zhaque44 <haque.zubair@gmail.com>
Signed-off-by: zhaque44 <haque.zubair@gmail.com>
Signed-off-by: zhaque44 <haque.zubair@gmail.com>
Signed-off-by: zhaque44 <haque.zubair@gmail.com>
…enarios

Signed-off-by: zhaque44 <haque.zubair@gmail.com>
…ct" field and returns nil

Signed-off-by: zhaque44 <haque.zubair@gmail.com>
Signed-off-by: zhaque44 <haque.zubair@gmail.com>
Copy link
Member

@jannfis jannfis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, appreciated!

LGTM.

@jannfis jannfis merged commit 03513eb into argoproj:master Apr 27, 2023
yyzxw pushed a commit to yyzxw/argo-cd that referenced this pull request Aug 9, 2023
…#13339)

* Adding unit tests for the Init function: for the notification controller

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

* Adding unit tests for getAppProj function: for the notification controller

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

* fixing linting errors for indexer.Add in build

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

* rm appProj test(s) to assess linting issue

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

* adding first test case for getAppProj

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

* add happy path for getAppProj func()

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

* updating test function to reduce duplication

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

* sanity test fot getAppProj: rm test struct pattern to test generic scenarios

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

* verifies that getAppProj gracefully handles input with missing "project" field and returns nil

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

* chore: isAppSyncStatusRefreshed test for improved coverage

Signed-off-by: zhaque44 <haque.zubair@gmail.com>

---------

Signed-off-by: zhaque44 <haque.zubair@gmail.com>
@zhaque44 zhaque44 deleted the notification-controller-tests branch August 23, 2023 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants