-
Notifications
You must be signed in to change notification settings - Fork 228
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
feat(service): Adds Mattermost service #516
Conversation
Hi @shivuslr41 , thanks so much for you patience and again this is a high quality PR. At first glance the usage of the http client is very nice and @nikoksr will be glad to see the |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #516 +/- ##
==========================================
- Coverage 75.17% 74.10% -1.07%
==========================================
Files 42 44 +2
Lines 1458 1572 +114
==========================================
+ Hits 1096 1165 +69
- Misses 268 307 +39
- Partials 94 100 +6
☔ 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.
Another excellent PR @shivuslr41 . I like how well commented the code is, and the code is mostly straight forward. I have a few concerns regarding some of the logging, and other nit-picks but we're nearly ready to move forward with this PR.
Hey @EthanEFung, Thank you very much for the time to review this! I will work on the suggestions this weekend and yes! go.mod and go.sum are untouched, switching to a generic HTTP service was easy than I thought. Great work guys! |
fix: Adds PreSend and PostSend capabilities to user docs: Updates doc.go and README.md
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.
Thanks for you patience @shivuslr41 . Work has picked up for me this past month and has been very busy. Anyways, as mentioned in the previous conversation, I think that adding the hooks to your message service to be a reasonable approach. That said, if the method is public in the mattermost service then we would like tests to be written for them. Let me know if you have any questions here and again, great work so far.
Adds presend and postsend tests for mattermost service
Hi @EthanEFung, Thank you for your time again! Added tests for PreSend and PostSend hooks now. The reason I left adding unit tests for these is they do not return anything. |
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 have added
mockClient.AssertExpectations(t)
along with callingservice.Send()
method.I'm assuming that you are suggesting checking if the httpClient (i.e.,
mockClient.
notservice.
) pre-send and post-send hooks are called before and after send method call respectively. Not sure if we can do this since generated mockClient doesn't call (is not aware) these hooks in the generated mockClient.Send().please suggest how this could be achieved if possible, that would be great for testing complete capabilities.
Ahh, I understand the predicament here. The mockClient doesn't call a pre or post hook so we can't make hook assertions based on calling .Send
.
My feedback regarding the hook tests is that we want to assert something about the hooks. The current hook tests assert that the New
function returns a service and calling service.Send
it doesn't result in an error. We've already made these assertions in the other tests.
I propose to make things easier for you. Instead of the current hook tests implementations, rewrite the hook tests to assert that the mockClient hooks are called when calling the service hooks.
I feel these would be appropriate tests because the service hook implementations rely on the httpService hooks to work. While it might be a stretch to assert that a .Send
call would result in the service hooks being called due to its dependency, it is realistic to expect that adding a service hook would create a httpClient hook.
Please let me know of any questions or comments before making code changes. You've already written so much, I want this PR to pass with flying colors and great quality.
Got it! I found that Let me know if any further suggestions/comments. |
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.
Looks good @shivuslr41
@nikoksr this PR is ready to merge
Hey @EthanEFung / @nikoksr, Hope you are doing well! Just checking out of curiosity if anything is being planned for this PR before getting merged. I see codecov failures but couldn't figure out why, my guess is due to reduced test coverage % but not sure. Let me know if I can be of help in any way. Again thank you for all the patience and review. |
Description
Adds a notifier service for Mattermost
Motivation and Context
This addresses the issue #422
Also PR -> #424
How Has This Been Tested?
I tested this in 2 steps:
Screenshots / Output (if appropriate):
Messages from admin and non-admin users.
Types of changes
Checklist: