MM-28859 Add feature flag managment system using split.io and remove viper. (#15954)
* Add feature flag managment system using split.io and remove viper. * Fixing tests. * Attempt to fix postgres tests. * Fix watch filepath for advanced logging. * Review fixes. * Some error wrapping. * Remove unessisary store interface. * Desanitize SplitKey * Simplify. * Review feedback. * Rename split mlog adatper to split logger. * fsInner * Style. * Restore oldcfg test. * Downgrading non-actionable feature flag errors to warnings. Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8bb772638c
Коммит
1aadd36644
@@ -65,7 +65,8 @@ func TestReadReplicaDisabledBasedOnLicense(t *testing.T) {
|
||||
|
||||
t.Run("Read Replicas with no License", func(t *testing.T) {
|
||||
s, err := NewServer(func(server *Server) error {
|
||||
configStore, _ := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{InitialConfig: cfg.Clone()})
|
||||
configStore := config.NewTestMemoryStore()
|
||||
configStore.Set(&cfg)
|
||||
server.configStore = configStore
|
||||
return nil
|
||||
})
|
||||
@@ -77,8 +78,8 @@ func TestReadReplicaDisabledBasedOnLicense(t *testing.T) {
|
||||
|
||||
t.Run("Read Replicas With License", func(t *testing.T) {
|
||||
s, err := NewServer(func(server *Server) error {
|
||||
configStore, _ := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{InitialConfig: cfg.Clone()})
|
||||
server.configStore = configStore
|
||||
configStore := config.NewTestMemoryStore()
|
||||
configStore.Set(&cfg)
|
||||
server.licenseValue.Store(model.NewTestLicense())
|
||||
return nil
|
||||
})
|
||||
@@ -90,7 +91,8 @@ func TestReadReplicaDisabledBasedOnLicense(t *testing.T) {
|
||||
|
||||
t.Run("Search Replicas with no License", func(t *testing.T) {
|
||||
s, err := NewServer(func(server *Server) error {
|
||||
configStore, _ := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{InitialConfig: cfg.Clone()})
|
||||
configStore := config.NewTestMemoryStore()
|
||||
configStore.Set(&cfg)
|
||||
server.configStore = configStore
|
||||
return nil
|
||||
})
|
||||
@@ -102,7 +104,8 @@ func TestReadReplicaDisabledBasedOnLicense(t *testing.T) {
|
||||
|
||||
t.Run("Search Replicas With License", func(t *testing.T) {
|
||||
s, err := NewServer(func(server *Server) error {
|
||||
configStore, _ := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{InitialConfig: cfg.Clone()})
|
||||
configStore := config.NewTestMemoryStore()
|
||||
configStore.Set(&cfg)
|
||||
server.configStore = configStore
|
||||
server.licenseValue.Store(model.NewTestLicense())
|
||||
return nil
|
||||
@@ -114,27 +117,6 @@ func TestReadReplicaDisabledBasedOnLicense(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func TestStartServerRateLimiterCriticalError(t *testing.T) {
|
||||
// Attempt to use Rate Limiter with an invalid config
|
||||
ms, err := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{
|
||||
SkipValidation: true,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
config := ms.Get()
|
||||
*config.RateLimitSettings.Enable = true
|
||||
*config.RateLimitSettings.MaxBurst = -100
|
||||
_, err = ms.Set(config)
|
||||
require.NoError(t, err)
|
||||
|
||||
s, err := NewServer(ConfigStore(ms))
|
||||
require.NoError(t, err)
|
||||
|
||||
serverErr := s.Start()
|
||||
s.Shutdown()
|
||||
require.Error(t, serverErr)
|
||||
}
|
||||
|
||||
func TestStartServerPortUnavailable(t *testing.T) {
|
||||
s, err := NewServer()
|
||||
require.NoError(t, err)
|
||||
@@ -398,7 +380,8 @@ func TestSentry(t *testing.T) {
|
||||
testDir, _ := fileutils.FindDir("tests")
|
||||
s, err := NewServer(func(server *Server) error {
|
||||
configStore, _ := config.NewFileStore("config.json", true)
|
||||
server.configStore = configStore
|
||||
store, _ := config.NewStoreFromBacking(configStore)
|
||||
server.configStore = store
|
||||
server.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.ListenAddress = ":0"
|
||||
*cfg.LogSettings.EnableSentry = false
|
||||
@@ -441,7 +424,8 @@ func TestSentry(t *testing.T) {
|
||||
SENTRY_DSN = fmt.Sprintf("http://test:test@localhost:%s/123", port)
|
||||
s2, err := NewServer(func(server *Server) error {
|
||||
configStore, _ := config.NewFileStore("config.json", true)
|
||||
server.configStore = configStore
|
||||
store, _ := config.NewStoreFromBacking(configStore)
|
||||
server.configStore = store
|
||||
server.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.ListenAddress = ":0"
|
||||
*cfg.ServiceSettings.ConnectionSecurity = "TLS"
|
||||
|
||||
Ссылка в новой задаче
Block a user