[MM-35470] Disable config watching logic (#17913)
* Disable config watching logic * Fix tests
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b01f8ab0c8
Коммит
186475db3b
@@ -150,7 +150,7 @@ func (h *testHelper) execArgs(t *testing.T, args []string) []string {
|
||||
ret = append(ret, "-test.coverprofile", filepath.Join(dir, strings.Join(baseParts, ".")))
|
||||
}
|
||||
|
||||
ret = append(ret, "--", "--disableconfigwatch")
|
||||
ret = append(ret, "--")
|
||||
|
||||
// Unless the test passes a `--config` of its own, create a temporary one from the default
|
||||
// configuration with the current test database applied.
|
||||
|
||||
@@ -147,7 +147,7 @@ func getConfigStore(command *cobra.Command) (*config.Store, error) {
|
||||
return nil, errors.Wrap(err, "failed to initialize i18n")
|
||||
}
|
||||
|
||||
configStore, err := config.NewStoreFromDSN(getConfigDSN(command, config.GetEnvironment()), false, false, nil)
|
||||
configStore, err := config.NewStoreFromDSN(getConfigDSN(command, config.GetEnvironment()), false, nil)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to initialize config store")
|
||||
}
|
||||
|
||||
@@ -564,9 +564,9 @@ func TestConfigMigrate(t *testing.T) {
|
||||
sqlDSN := getDsn(*sqlSettings.DriverName, *sqlSettings.DataSource)
|
||||
fileDSN := "config.json"
|
||||
|
||||
ds, err := config.NewStoreFromDSN(sqlDSN, false, false, nil)
|
||||
ds, err := config.NewStoreFromDSN(sqlDSN, false, nil)
|
||||
require.NoError(t, err)
|
||||
fs, err := config.NewStoreFromDSN(fileDSN, false, false, nil)
|
||||
fs, err := config.NewStoreFromDSN(fileDSN, false, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
defer ds.Close()
|
||||
|
||||
@@ -57,7 +57,7 @@ func initDbCmdF(command *cobra.Command, _ []string) error {
|
||||
return errors.Wrap(err, "error loading custom configuration defaults")
|
||||
}
|
||||
|
||||
configStore, err := config.NewStoreFromDSN(getConfigDSN(command, config.GetEnvironment()), false, false, customDefaults)
|
||||
configStore, err := config.NewStoreFromDSN(getConfigDSN(command, config.GetEnvironment()), false, customDefaults)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to load configuration")
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ func initDBCommandContext(configDSN string, readOnlyConfigStore bool) (*app.App,
|
||||
model.AppErrorInit(i18n.T)
|
||||
|
||||
s, err := app.NewServer(
|
||||
app.Config(configDSN, false, readOnlyConfigStore, nil),
|
||||
app.Config(configDSN, readOnlyConfigStore, nil),
|
||||
app.StartSearchEngine,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
@@ -36,7 +36,7 @@ func TestPlugin(t *testing.T) {
|
||||
output = th.CheckCommand(t, "plugin", "enable", "testplugin")
|
||||
assert.Contains(t, output, "Enabled plugin: testplugin")
|
||||
|
||||
fs, err := config.NewFileStore(th.ConfigPath(), false)
|
||||
fs, err := config.NewFileStore(th.ConfigPath())
|
||||
require.NoError(t, err)
|
||||
cfsStore, err := config.NewStoreFromBacking(fs, nil, false)
|
||||
require.NoError(t, err)
|
||||
@@ -46,7 +46,7 @@ func TestPlugin(t *testing.T) {
|
||||
|
||||
output = th.CheckCommand(t, "plugin", "disable", "testplugin")
|
||||
assert.Contains(t, output, "Disabled plugin: testplugin")
|
||||
fs, err = config.NewFileStore(th.ConfigPath(), false)
|
||||
fs, err = config.NewFileStore(th.ConfigPath())
|
||||
require.NoError(t, err)
|
||||
cfsStore, err = config.NewStoreFromBacking(fs, nil, false)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -22,5 +22,4 @@ var RootCmd = &cobra.Command{
|
||||
|
||||
func init() {
|
||||
RootCmd.PersistentFlags().StringP("config", "c", "", "Configuration file to use.")
|
||||
RootCmd.PersistentFlags().Bool("disableconfigwatch", false, "When set config.json will not be loaded from disk when the file is changed.")
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ func init() {
|
||||
}
|
||||
|
||||
func serverCmdF(command *cobra.Command, args []string) error {
|
||||
disableConfigWatch, _ := command.Flags().GetBool("disableconfigwatch")
|
||||
interruptChan := make(chan os.Signal, 1)
|
||||
|
||||
if err := utils.TranslationsPreInit(); err != nil {
|
||||
@@ -50,7 +49,7 @@ func serverCmdF(command *cobra.Command, args []string) error {
|
||||
mlog.Warn("Error loading custom configuration defaults: " + err.Error())
|
||||
}
|
||||
|
||||
configStore, err := config.NewStoreFromDSN(getConfigDSN(command, config.GetEnvironment()), !disableConfigWatch, false, customDefaults)
|
||||
configStore, err := config.NewStoreFromDSN(getConfigDSN(command, config.GetEnvironment()), false, customDefaults)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to load configuration")
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user