-
Notifications
You must be signed in to change notification settings - Fork 68
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
Mattermost support #791
Mattermost support #791
Conversation
a6a4d6c
to
1af232c
Compare
import "github.com/mattermost/mattermost-server/v6/model" | ||
|
||
// Client is wrapper over model.Client4. | ||
type Client interface { |
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.
lose interface naming :(
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.
why single file?
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.
lose interface naming :(
Read it with package name - mattermost.Client
, sounds good
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.
why single file?
I think it is ok to separate types by files, because mattermost.go is about Sender impl. Maybe rename mattermost.go to sender.go 🤔 Think it would be better
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.
interfaces in go ended on "er"
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.
It is not necessary. The most popular interface in Go is error
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.
Renamed file, I think it is better 8f19954
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.
- Why separate file?
and about naming Interface names
senders/mattermost/mattermost.go
Outdated
} | ||
sender.client.SetToken(token) | ||
|
||
sender.frontURI = senderSettings["front_uri"] |
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.
if uri will empty?
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.
Then trigger URI will be incorrect. I will fix it, thanks
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.
may better validate all struct
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.
Fixed acd04f9
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.
may better validate all struct
Now it is ok
1af232c
to
59ad19f
Compare
Codecov Report
@@ Coverage Diff @@
## master #791 +/- ##
==========================================
+ Coverage 70.96% 71.18% +0.21%
==========================================
Files 178 179 +1
Lines 9237 9341 +104
==========================================
+ Hits 6555 6649 +94
- Misses 2305 2311 +6
- Partials 377 381 +4
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
601bc34
to
416a8c7
Compare
senders/mattermost/sender_test.go
Outdated
}) | ||
} | ||
|
||
//TestSender is integration test, run it manually with your Url, Token and Channel ID. |
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.
? :)
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.
It is small integration test, you should run it manually. I comment it because it works only with right credentials (your Url, Token and Channel ID). You can run https://hub.docker.com/r/mattermost/mattermost-preview locally, create bot, uncomment test and run it.
we have new interface, but haven't got any new mock, why? :) |
@kissken I created stubs manually without gomock. Do you think that it is better to use gomock? Now we have 93bba9a#diff-8dd560d964d10bfee0e300f244193cc7a80a8c1dc267f3cba2f393c1051e4c28R26 and 93bba9a#diff-8dd560d964d10bfee0e300f244193cc7a80a8c1dc267f3cba2f393c1051e4c28R43-R49 With gomock
|
52affd0
to
8bf1203
Compare
4634bd6
to
7bc3f99
Compare
@kissken Would you please merge it. I suggest to merge without squash, because some commits have important description |
Mattermost is an Open Source chat. Need to add Mattermost as delivery channel for Moira. Added new package for Sender that use mattermost-server dependency to send messages to Moira users via Bot.
There were warnings: ``` #..\go\pkg\mod\github.com\golang\[email protected]\mockgen\mockgen.go:41:2: missing go.sum entry for module providing package golang.org/x/mod/modfile (imported by github.com/golang/mock/mockgen); to add: # go get github.com/golang/mock/[email protected] #..\go\pkg\mod\github.com\golang\[email protected]\mockgen\mockgen.go:42:2: missing go.sum entry for module providing package golang.org/x/tools/imports (imported by github.com/golang/mock/mockgen); to add: # go get github.com/golang/mock/[email protected] ``` Use version for mockgen, it is recommended way to install mockgen. Remove `go get -u` because it has no sense, `github.com/golang/mock` is in go.mod.
Use generated mocks instead of manually created.
There is a case when developer want to check integration with Mattermost locally. Added test for this case. There is build tag "manual" because this test need to run manually (not on common run, not on CI). Nice post about build tags - https://mickey.dev/posts/go-build-tags-testing/
Secure connection is important for production env, but is not for dev env.
7bc3f99
to
d352db3
Compare
Lets try again :) |
Mattermost is an Open Source chat. Need to add Mattermost as delivery channel for Moira.