MM-34171: Fix racy test TestSentry (#17215)
* MM-34171: Fix racy test TestSentry The NewServer call sets the global mlog Info variable. But before that, if we call UpdateConfig with the functional options, then the store.Set method will call mlog.Info before it could be set. To fix that, we prepare the updated config and pass that directly to NewServer to avoid having to call UpdateConfig. https://mattermost.atlassian.net/browse/MM-34171 ```release-note NONE ``` * disable watcher * Trying yet again Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f60b7437da
Коммит
1578e25537
@@ -607,20 +607,19 @@ func TestSentry(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
SentryDSN = dsn.String()
|
||||
|
||||
s, err := NewServer(func(server *Server) error {
|
||||
configStore, _ := config.NewFileStore("config.json", true)
|
||||
store, _ := config.NewStoreFromBacking(configStore, nil, false)
|
||||
server.configStore = store
|
||||
server.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.ListenAddress = ":0"
|
||||
*cfg.LogSettings.EnableSentry = false
|
||||
*cfg.ServiceSettings.ConnectionSecurity = "TLS"
|
||||
*cfg.ServiceSettings.TLSKeyFile = path.Join(testDir, "tls_test_key.pem")
|
||||
*cfg.ServiceSettings.TLSCertFile = path.Join(testDir, "tls_test_cert.pem")
|
||||
*cfg.LogSettings.EnableDiagnostics = true
|
||||
})
|
||||
return nil
|
||||
})
|
||||
configStore, _ := config.NewMemoryStore()
|
||||
store, _ := config.NewStoreFromBacking(configStore, nil, false)
|
||||
cfg := store.Get()
|
||||
*cfg.ServiceSettings.ListenAddress = ":0"
|
||||
*cfg.LogSettings.EnableSentry = false
|
||||
*cfg.ServiceSettings.ConnectionSecurity = "TLS"
|
||||
*cfg.ServiceSettings.TLSKeyFile = path.Join(testDir, "tls_test_key.pem")
|
||||
*cfg.ServiceSettings.TLSCertFile = path.Join(testDir, "tls_test_cert.pem")
|
||||
*cfg.LogSettings.EnableDiagnostics = true
|
||||
|
||||
store.Set(cfg)
|
||||
|
||||
s, err := NewServer(ConfigStore(store))
|
||||
require.NoError(t, err)
|
||||
|
||||
// Route for just panicing
|
||||
@@ -658,20 +657,19 @@ func TestSentry(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
SentryDSN = dsn.String()
|
||||
|
||||
s, err := NewServer(func(server *Server) error {
|
||||
configStore, _ := config.NewFileStore("config.json", true)
|
||||
store, _ := config.NewStoreFromBacking(configStore, nil, false)
|
||||
server.configStore = store
|
||||
server.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.ListenAddress = ":0"
|
||||
*cfg.ServiceSettings.ConnectionSecurity = "TLS"
|
||||
*cfg.ServiceSettings.TLSKeyFile = path.Join(testDir, "tls_test_key.pem")
|
||||
*cfg.ServiceSettings.TLSCertFile = path.Join(testDir, "tls_test_cert.pem")
|
||||
*cfg.LogSettings.EnableSentry = true
|
||||
*cfg.LogSettings.EnableDiagnostics = true
|
||||
})
|
||||
return nil
|
||||
})
|
||||
configStore, _ := config.NewMemoryStore()
|
||||
store, _ := config.NewStoreFromBacking(configStore, nil, false)
|
||||
cfg := store.Get()
|
||||
*cfg.ServiceSettings.ListenAddress = ":0"
|
||||
*cfg.ServiceSettings.ConnectionSecurity = "TLS"
|
||||
*cfg.ServiceSettings.TLSKeyFile = path.Join(testDir, "tls_test_key.pem")
|
||||
*cfg.ServiceSettings.TLSCertFile = path.Join(testDir, "tls_test_cert.pem")
|
||||
*cfg.LogSettings.EnableSentry = true
|
||||
*cfg.LogSettings.EnableDiagnostics = true
|
||||
|
||||
store.Set(cfg)
|
||||
|
||||
s, err := NewServer(ConfigStore(store))
|
||||
require.NoError(t, err)
|
||||
|
||||
// Route for just panicing
|
||||
|
||||
Ссылка в новой задаче
Block a user