MM-13185: Fix Message Export config special case. (#9898)
It should only apply when setting through the System Console, to avoid messing up externally managed config files.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9afb1586cd
Коммит
c24c518a14
@@ -1886,14 +1886,6 @@ func (s *MessageExportSettings) SetDefaults() {
|
||||
s.ExportFromTimestamp = NewInt64(0)
|
||||
}
|
||||
|
||||
if s.EnableExport != nil && *s.EnableExport && *s.ExportFromTimestamp == int64(0) {
|
||||
// when the feature is enabled via the System Console, use the current timestamp as the start time for future exports
|
||||
s.ExportFromTimestamp = NewInt64(GetMillis())
|
||||
} else if s.EnableExport != nil && !*s.EnableExport {
|
||||
// when the feature is disabled, reset the timestamp so that the timestamp will be set if the feature is re-enabled
|
||||
s.ExportFromTimestamp = NewInt64(0)
|
||||
}
|
||||
|
||||
if s.BatchSize == nil {
|
||||
s.BatchSize = NewInt(10000)
|
||||
}
|
||||
|
||||
@@ -360,6 +360,7 @@ func TestMessageExportSetDefaults(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMessageExportSetDefaultsExportEnabledExportFromTimestampNil(t *testing.T) {
|
||||
// Test retained as protection against regression of MM-13185
|
||||
mes := &MessageExportSettings{
|
||||
EnableExport: NewBool(true),
|
||||
}
|
||||
@@ -367,12 +368,13 @@ func TestMessageExportSetDefaultsExportEnabledExportFromTimestampNil(t *testing.
|
||||
|
||||
require.True(t, *mes.EnableExport)
|
||||
require.Equal(t, "01:00", *mes.DailyRunTime)
|
||||
require.NotEqual(t, int64(0), *mes.ExportFromTimestamp)
|
||||
require.Equal(t, int64(0), *mes.ExportFromTimestamp)
|
||||
require.True(t, *mes.ExportFromTimestamp <= GetMillis())
|
||||
require.Equal(t, 10000, *mes.BatchSize)
|
||||
}
|
||||
|
||||
func TestMessageExportSetDefaultsExportEnabledExportFromTimestampZero(t *testing.T) {
|
||||
// Test retained as protection against regression of MM-13185
|
||||
mes := &MessageExportSettings{
|
||||
EnableExport: NewBool(true),
|
||||
ExportFromTimestamp: NewInt64(0),
|
||||
@@ -381,7 +383,7 @@ func TestMessageExportSetDefaultsExportEnabledExportFromTimestampZero(t *testing
|
||||
|
||||
require.True(t, *mes.EnableExport)
|
||||
require.Equal(t, "01:00", *mes.DailyRunTime)
|
||||
require.NotEqual(t, int64(0), *mes.ExportFromTimestamp)
|
||||
require.Equal(t, int64(0), *mes.ExportFromTimestamp)
|
||||
require.True(t, *mes.ExportFromTimestamp <= GetMillis())
|
||||
require.Equal(t, 10000, *mes.BatchSize)
|
||||
}
|
||||
@@ -425,6 +427,7 @@ func TestMessageExportSetDefaultsExportDisabledExportFromTimestampZero(t *testin
|
||||
}
|
||||
|
||||
func TestMessageExportSetDefaultsExportDisabledExportFromTimestampNonZero(t *testing.T) {
|
||||
// Test retained as protection against regression of MM-13185
|
||||
mes := &MessageExportSettings{
|
||||
EnableExport: NewBool(false),
|
||||
ExportFromTimestamp: NewInt64(12345),
|
||||
@@ -433,7 +436,7 @@ func TestMessageExportSetDefaultsExportDisabledExportFromTimestampNonZero(t *tes
|
||||
|
||||
require.False(t, *mes.EnableExport)
|
||||
require.Equal(t, "01:00", *mes.DailyRunTime)
|
||||
require.Equal(t, int64(0), *mes.ExportFromTimestamp)
|
||||
require.Equal(t, int64(12345), *mes.ExportFromTimestamp)
|
||||
require.Equal(t, 10000, *mes.BatchSize)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user