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
Multi product architecture #3309
Multi product architecture #3309
Conversation
…s; remove logger service
…inAPI interfaces for all packages
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 a big change and I haven't look into each detail here, but looks good to me.
One tiny concern is we still have everything under the mattermost-plugin directory, so... plugin code, and product code are not clearly separated in that sense, but because the plugin code is expected to dissapear eventually, and even if that is not the case, I wouldn't add that changes to this PR, this PR is ready to merge (from my point of view).
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.
Terrific job! 🚀
} | ||
|
||
// Ensure the adapter implements ServicesAPI. | ||
var _ model.ServicesAPI = &serviceAPIAdapter{} |
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.
❤️
p.SetAPI(api) | ||
p.server = th.Server | ||
p.wsPluginAdapter = &FakePluginAdapter{} | ||
ctrl := gomock.NewController(t) |
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.
We're missing a ctrl.Finish()
here or the expectations will not get checked
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.
In the comments for NewController
it says that Finish
does not need to be called.
// NewController returns a new Controller. It is the preferred way to create a
// Controller.
//
// New in go1.14+, if you are passing a *testing.T into this function you no
// longer need to call ctrl.Finish() in your test methods.
tearDown := func() { | ||
os.Setenv("FOCALBOARD_UNIT_TESTING", origUnitTesting) | ||
} | ||
|
||
ctrl := gomock.NewController(t) | ||
defer ctrl.Finish() |
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.
Unrelated to this PR, but the ctrl.Finish()
should get executed as part of the teardown
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 moved it to the teardown, but I think it may be redundant.
"errors" | ||
"net/http" | ||
|
||
mm_model "github.com/mattermost/mattermost-server/v6/model" |
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.
Maybe not for this PR, but we're referring to the Mattermost Model as both mm_model
and mmModel
. We should pick one and standardize
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.
@@ -649,7 +649,8 @@ func TestNotifyPortalAdminsUpgradeRequest(t *testing.T) { | |||
defer tearDown() | |||
|
|||
t.Run("should send message", func(t *testing.T) { | |||
pluginAPI := &plugintest.API{} | |||
ctrl := gomock.NewController(t) |
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.
ctrl := gomock.NewController(t) | |
ctrl := gomock.NewController(t) | |
defer ctrl.Finish() |
@@ -691,17 +692,18 @@ func TestNotifyPortalAdminsUpgradeRequest(t *testing.T) { | |||
}) | |||
|
|||
t.Run("no sys admins found", func(t *testing.T) { | |||
pluginAPI := &plugintest.API{} | |||
ctrl := gomock.NewController(t) |
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.
ctrl := gomock.NewController(t) | |
ctrl := gomock.NewController(t) | |
defer ctrl.Finish() |
@@ -714,7 +716,8 @@ func TestNotifyPortalAdminsUpgradeRequest(t *testing.T) { | |||
}) | |||
|
|||
t.Run("iterate multiple pages", func(t *testing.T) { | |||
pluginAPI := &plugintest.API{} | |||
ctrl := gomock.NewController(t) |
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.
ctrl := gomock.NewController(t) | |
ctrl := gomock.NewController(t) | |
defer ctrl.Finish() |
type NotSupportedError struct { | ||
msg string | ||
} | ||
|
||
func (pe NotSupportedError) Error() string { | ||
return pe.msg | ||
} |
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 don't think this is being used right now, and duplicates the one on store.go
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.
Removed
Thanks for reviewing @mgdelacroix. I've addressed the issued your raised, except the mock controller |
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 applying the changes!! LGTM and merging right away!
As per the Finish()
comments, you're totally right, they're not needed on our current version of Go. We still need to fix the test helpers in which we're calling defer ctrl.Finish()
on the setup, but nothing concerning this PR. Will update the code debt card to add your findings
This reverts commit 605c007.
I merged the PR before the branch cut, so it's now reverted on |
Summary
This PR provides support for compiling Boards directly into the Mattermost suite server. This required a major refactoring of the
mattermost-plugin
package. Plugin builds and stand-alone continue to be supported.Notable changes:
ServicesAPI
interface replaces thePluginAPI
to allow for implementations coming from pluginAPI and suite server.product
package provides a place to register Boards as a suite product and handles life-cycle eventsboards
package replaces much of themattermost-plugin
logic, allowing this to be shared between plugin and productmake setup-go-work
or place ago.work
in the repo root containing:go.mod
should no longer usereplace
to import mattermost-server/v6Ticket Link
https://community.mattermost.com/boards/workspace/qgsck6cts3fwpqwyjiupjm5cde/b4ctmm917q3rzdfi451qtuxjzcw/150d1464-6d59-4c39-810f-ee201439dbaf/cfs87fp368fbwmc45wnuzcadaqe