-
Notifications
You must be signed in to change notification settings - Fork 2k
Issue 4837: chore: main_test.go unit-tests #6314
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
* Added test for mustCreateConfigClient, mustValidateIngressClass, mustConfirmMinimumK8sVersionCriteria
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6314 +/- ##
==========================================
+ Coverage 52.98% 53.09% +0.11%
==========================================
Files 77 77
Lines 15900 15908 +8
==========================================
+ Hits 8424 8447 +23
+ Misses 7071 7048 -23
- Partials 405 413 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
The point of having functions with the prefix must
is to communicate that those functions do not return errors (see Go std lib). They either call panic or os.Exit (log.Fatal
). They prevent the NIC from starting in a state that would make it impossible to run.
There is no need to add additional error handling (or move call to os.Exit
from inside the func) as there is no error returned. The function either validate or set some values or terminate the program.
This PR is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
This PR is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
This PR was closed because it has been stalled for 10 days with no activity. |
This is the first of potentially a few to get testability for
main.go
:mustCreateConfigClient
,mustValidateIngressClass
,mustConfirmMinimumK8sVersionCriteria
main
branchNOTE:
At present there isn't any test formustCreateDynamicClient
as it doesn't seem testableProposed changes
The objective of this PR is to give test coverage for main.go as outlined in #4837.
This includes improving functions by:
returning the error instead of throwing a fatal error
Split functions to improve readability and testability
Checklist
Before creating a PR, run through this checklist and mark each as complete.