Fixing behavior of Replicas and SearchReplicas in canary environments (#14576)

* Fixing behavior of Replicas and SearchReplicas in canary environments

* Trying to fix tests

* Revert "Trying to fix tests"

This reverts commit 3531da961844f5cb8557efcd3b570b06f362c6df.

* Revert "Fixing behavior of Replicas and SearchReplicas in canary environments"

This reverts commit 0c05901c843e4ccd60c8320fb4e0123b1bacf430.

* Revert "Disable read/search db replicas in TE/E0 (#14400)"

This reverts commit ef5ac519d9.

* Making the store aware of the license

* Readding the unit tests

* Fixing sqlstor supplier tests

* Adding mutex to ensure license write consistency and fixing tests

* Fixing tests

* Fixing tests

* Shuting down server properly during tests

* Trying to fix tests

* Trying to fix the tests

* Skipping flaky tests

Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Jesús Espino
2020-05-27 15:42:48 +02:00
коммит произвёл GitHub
родитель 553af3a694
Коммит ae328153d5
10 изменённых файлов: 123 добавлений и 64 удалений

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

@@ -52,8 +52,8 @@ import (
var MaxNotificationsPerChannelDefault int64 = 1000000
type Server struct {
Store store.Store
sqlStore *sqlstore.SqlSupplier
Store store.Store
WebSocketRouter *WebSocketRouter
// RootRouter is the starting point for all HTTP requests to the server.
@@ -309,24 +309,6 @@ func NewServer(options ...Option) (*Server, error) {
license := s.License()
if license == nil && len(s.Config().SqlSettings.DataSourceReplicas) > 0 {
mlog.Warn("Read replicas functionality disabled by current license. Please contact your system administrator about upgrading your enterprise license.")
s.UpdateConfig(func(cfg *model.Config) {
cfg.SqlSettings.DataSourceReplicas = []string{}
})
s.Store.Close()
s.Store = s.newStore()
}
if license == nil && len(s.Config().SqlSettings.DataSourceSearchReplicas) > 0 {
mlog.Warn("Search replicas functionality disabled by current license. Please contact your system administrator about upgrading your enterprise license.")
s.UpdateConfig(func(cfg *model.Config) {
cfg.SqlSettings.DataSourceSearchReplicas = []string{}
})
s.Store.Close()
s.Store = s.newStore()
}
if license == nil {
s.UpdateConfig(func(cfg *model.Config) {
cfg.TeamSettings.MaxNotificationsPerChannel = &MaxNotificationsPerChannelDefault