| 717 | } |
| 718 | |
| 719 | func TestServerConfigValidate(t *testing.T) { |
| 720 | base.SetUpTestLogging(t, base.LevelInfo, base.KeyAll) |
| 721 | // unsupported.stats_log_freq_secs |
| 722 | statsLogFrequencySecs := uint(9) |
| 723 | unsupported := &UnsupportedServerConfigLegacy{StatsLogFrequencySecs: &statsLogFrequencySecs} |
| 724 | sc := &LegacyServerConfig{Unsupported: unsupported} |
| 725 | validationErrors := sc.validate() |
| 726 | require.NotNil(t, validationErrors) |
| 727 | multiError, ok := validationErrors.(*base.MultiError) |
| 728 | require.True(t, ok) |
| 729 | require.Equal(t, multiError.Len(), 1) |
| 730 | assert.Contains(t, multiError.Errors[0].Error(), "minimum value for unsupported.stats_log_freq_secs") |
| 731 | |
| 732 | // Valid configuration value for StatsLogFrequencySecs |
| 733 | statsLogFrequencySecs = uint(10) |
| 734 | unsupported = &UnsupportedServerConfigLegacy{StatsLogFrequencySecs: &statsLogFrequencySecs} |
| 735 | sc = &LegacyServerConfig{Unsupported: unsupported} |
| 736 | assert.Nil(t, sc.validate()) |
| 737 | |
| 738 | // Explicitly disabled |
| 739 | statsLogFrequencySecs = uint(0) |
| 740 | unsupported = &UnsupportedServerConfigLegacy{StatsLogFrequencySecs: &statsLogFrequencySecs} |
| 741 | sc = &LegacyServerConfig{Unsupported: unsupported} |
| 742 | assert.Nil(t, sc.validate()) |
| 743 | } |
| 744 | |
| 745 | func TestSetupAndValidateDatabases(t *testing.T) { |
| 746 | ctx := base.TestCtx(t) |