MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestServerConfigValidate

Function TestServerConfigValidate

rest/config_test.go:719–743  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

717}
718
719func 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
745func TestSetupAndValidateDatabases(t *testing.T) {
746 ctx := base.TestCtx(t)

Callers

nothing calls this directly

Calls 6

validateMethod · 0.95
SetUpTestLoggingFunction · 0.92
LenMethod · 0.65
ContainsMethod · 0.65
EqualMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected