MM-30988 - Fix racy test ServerSystemdNotification (#16431)

* MM-30988 - Fix racy test ServerSystemdNotification

The translateFunc is a global variable which was unguarded.
So we convert that into an atomic variable to prevent against races.

https://mattermost.atlassian.net/browse/MM-30988

```release-note
NONE
```

* fix tests

* move call upwards

* use race

* after translations init

* guard with a sync.Once

* missed import

* revert race

* update timeout
Этот коммит содержится в:
Agniva De Sarker
2020-12-02 14:22:41 +05:30
коммит произвёл GitHub
родитель e22669c403
Коммит fc60a1e8dd
3 изменённых файлов: 8 добавлений и 5 удалений

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

@@ -269,6 +269,7 @@ func NewServer(options ...Option) (*Server, error) {
if err := utils.TranslationsPreInit(); err != nil {
return nil, errors.Wrapf(err, "unable to load Mattermost translation files")
}
model.AppErrorInit(utils.T)
searchEngine := searchengine.NewBroker(s.Config(), s.Jobs)
bleveEngine := bleveengine.NewBleveEngine(s.Config(), s.Jobs)
@@ -450,8 +451,6 @@ func NewServer(options ...Option) (*Server, error) {
mlog.Error("Problem with file storage settings", mlog.Err(appErr))
}
model.AppErrorInit(utils.T)
s.timezones = timezones.New()
// Start email batching because it's not like the other jobs
s.AddConfigListener(func(_, _ *model.Config) {