* Removing some other fake apps

* More FakeApp removed

* Removing entirely FakeApp

* Fixing some tests

* Fixing get Cluster id from get plugin status

* Fixing failing tests

* Fixing tests

* Fixing test initialization for web

* Fixing InitServer for server tests

* Fixing InitServer for server tests

* Reverting go.sum and go.mod

* Removing unneded HTMLTemplates function in App layer

* Moving back some functions to its old place to easy the review

* Moving back some functions to its old place to easy the review

* Using the last struct2interface version

* Generating store layers

* Fixing merge problems

* Addressing PR comments

* Small fix

* Fixing app tests build

* Fixing tests

* fixing tests

* Fix tests

* Fixing tests

* Fixing tests

* Fixing tests

* Moving license to server struct

* Adding some fixes to the test compilation

* Fixing cluster and some jobs initialization

* Fixing some license tests compilation problems

* Fixing recursive cache invalidation

* Regenerating app layers

* Fix test compilation

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Jesús Espino
2020-06-12 13:43:50 +02:00
коммит произвёл GitHub
родитель f3ac33e6dc
Коммит f5eab1271b
88 изменённых файлов: 973 добавлений и 1177 удалений

Просмотреть файл

@@ -19,6 +19,7 @@ import (
"github.com/mattermost/mattermost-server/v5/api4"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/store/storetest/mocks"
"github.com/mattermost/mattermost-server/v5/testlib"
)
@@ -65,6 +66,12 @@ func SetupWithStoreMock(t testing.TB) *testHelper {
}
api4TestHelper := api4.SetupWithStoreMock(t)
systemStore := mocks.SystemStore{}
systemStore.On("Get").Return(make(model.StringMap), nil)
licenseStore := mocks.LicenseStore{}
licenseStore.On("Get", "").Return(&model.LicenseRecord{}, nil)
api4TestHelper.App.Srv().Store.(*mocks.Store).On("System").Return(&systemStore)
api4TestHelper.App.Srv().Store.(*mocks.Store).On("License").Return(&licenseStore)
testHelper := &testHelper{
TestHelper: api4TestHelper,

Просмотреть файл

@@ -145,7 +145,7 @@ func scheduleExportCmdF(command *cobra.Command, args []string) error {
func buildExportCmdF(format string) func(command *cobra.Command, args []string) error {
return func(command *cobra.Command, args []string) error {
a, err := InitDBCommandContextCobra(command)
license := a.License()
license := a.Srv().License()
if err != nil {
return err
}

Просмотреть файл

@@ -41,10 +41,10 @@ func InitDBCommandContext(configDSN string) (*app.App, error) {
return nil, err
}
a := s.FakeApp()
a := app.New(app.ServerConnector(s))
if model.BuildEnterpriseReady == "true" {
a.LoadLicense()
a.Srv().LoadLicense()
}
return a, nil

Просмотреть файл

@@ -41,7 +41,7 @@ func jobserverCmdF(command *cobra.Command, args []string) error {
}
defer a.Shutdown()
a.LoadLicense()
a.Srv().LoadLicense()
// Run jobs
mlog.Info("Starting Mattermost job server")

Просмотреть файл

@@ -45,7 +45,7 @@ func uploadLicenseCmdF(command *cobra.Command, args []string) error {
return err
}
if _, err := a.SaveLicense(fileBytes); err != nil {
if _, err := a.Srv().SaveLicense(fileBytes); err != nil {
return err
}

Просмотреть файл

@@ -100,7 +100,7 @@ func exportPermissionsCmdF(command *cobra.Command, args []string) error {
}
defer a.Shutdown()
if license := a.License(); license == nil {
if license := a.Srv().License(); license == nil {
return errors.New(utils.T("cli.license.critical"))
}
@@ -121,7 +121,7 @@ func importPermissionsCmdF(command *cobra.Command, args []string) error {
}
defer a.Shutdown()
if license := a.License(); license == nil {
if license := a.Srv().License(); license == nil {
return errors.New(utils.T("cli.license.critical"))
}

Просмотреть файл

@@ -73,7 +73,7 @@ func runServer(configStore config.Store, disableConfigWatch bool, usedPlatform b
}
api := api4.Init(server, server.AppOptions, server.Router)
wsapi.Init(server.FakeApp(), server.WebSocketRouter)
wsapi.Init(server)
web.New(server, server.AppOptions, server.Router)
api4.InitLocal(server, server.AppOptions, server.LocalRouter)

Просмотреть файл

@@ -59,7 +59,7 @@ func webClientTestsCmdF(command *cobra.Command, args []string) error {
}
api4.Init(a, a.Srv().AppOptions, a.Srv().Router)
wsapi.Init(a, a.Srv().WebSocketRouter)
wsapi.Init(a.Srv())
a.UpdateConfig(setupClientTests)
runWebClientTests()
@@ -80,7 +80,7 @@ func serverForWebClientTestsCmdF(command *cobra.Command, args []string) error {
}
api4.Init(a, a.Srv().AppOptions, a.Srv().Router)
wsapi.Init(a, a.Srv().WebSocketRouter)
wsapi.Init(a.Srv())
a.UpdateConfig(setupClientTests)
c := make(chan os.Signal, 1)