Moving app from singular to being created for every request (#9889)

* Moving app from singular to being created for every request.

* Automatic refactor

* Adding license header

* Feedback fixes
Этот коммит содержится в:
Christopher Speller
2018-11-28 10:56:21 -08:00
коммит произвёл GitHub
родитель 1bcf08aa4b
Коммит da265fbaf7
68 изменённых файлов: 1272 добавлений и 1096 удалений

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

@@ -33,6 +33,7 @@ import (
type TestHelper struct {
App *app.App
Server *app.Server
tempConfigPath string
Client *model.Client4
@@ -99,13 +100,14 @@ func setupTestHelper(enterprise bool, updateConfig func(*model.Config)) *TestHel
options = append(options, app.StoreOverride(testStore))
}
a, err := app.New(options...)
s, err := app.NewServer(options...)
if err != nil {
panic(err)
}
th := &TestHelper{
App: a,
App: s.FakeApp(),
Server: s,
tempConfigPath: tempConfig.Name(),
}
@@ -127,8 +129,8 @@ func setupTestHelper(enterprise bool, updateConfig func(*model.Config)) *TestHel
}
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = prevListenAddress })
Init(th.App, th.App.Srv.Router)
web.NewWeb(th.App, th.App.Srv.Router)
Init(th.Server, th.Server.AppOptions, th.App.Srv.Router)
web.New(th.Server, th.Server.AppOptions, th.App.Srv.Router)
wsapi.Init(th.App, th.App.Srv.WebSocketRouter)
th.App.Srv.Store.MarkSystemRanUnitTests()
th.App.DoAdvancedPermissionsMigration()
@@ -181,7 +183,7 @@ func SetupConfig(updateConfig func(cfg *model.Config)) *TestHelper {
func (me *TestHelper) ShutdownApp() {
done := make(chan bool)
go func() {
me.App.Shutdown()
me.Server.Shutdown()
close(done)
}()