-
Notifications
You must be signed in to change notification settings - Fork 3
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 tests to improve code coverage for logging #244
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #244 +/- ##
==========================================
+ Coverage 36.51% 37.08% +0.56%
==========================================
Files 55 55
Lines 4017 4021 +4
==========================================
+ Hits 1467 1491 +24
+ Misses 2458 2440 -18
+ Partials 92 90 -2 ☔ View full report in Codecov by Sentry. |
650fcd3
to
9d0d626
Compare
9d0d626
to
5019253
Compare
Got the logger test working with all checks passed except for the Console API Tests / build (pull_request) (Won't work right for now) |
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.
Looking at this I think we've got some other issues at work here. Namely, the logging level doesn't seem to be working correctly. Looks to be an issue from the template we used. I know this is a code coverage task, but lets take a stab at using the interface provided in this issue: evrone/go-clean-template#148 . We shouldnt need to have if conditions in our code as that would sort of eliminate the job of what the logging library should do. Can we take a stab at copying and pasting that and updating the code to use it?
type loggerTest struct { | ||
name string | ||
logLevel string | ||
testFunction func(t *testing.T, log *Logger, buf *bytes.Buffer) |
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.
hey @emeeker2002 typically you'd want to have an expected result in your test struct. and then in each test case, you'd set the expected result. That way all assets can be handled in the for loop at the end.
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.
This would explain why the linter was wanting t.Helper in each function which was a bit odd to me.
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.
Update test struct and assert handling based on feedback in comment
closed in place of #249 due to @emeeker2002 on vacation. |
No description provided.