diff --git a/config/configsanity.go b/config/configsanity.go index af5dc658c..32b0be1aa 100644 --- a/config/configsanity.go +++ b/config/configsanity.go @@ -486,5 +486,12 @@ func (cfg *CGRConfig) checkConfigSanity() error { } } } + // Cache partitions check + for cacheID := range cfg.cacheCfg { + if _, has := utils.CachePartitions[cacheID]; !has { + return fmt.Errorf("<%s> partition <%s> not defined", utils.CacheS, cacheID) + } + } + return nil } diff --git a/config/configsanity_test.go b/config/configsanity_test.go index e02b06268..df1247745 100644 --- a/config/configsanity_test.go +++ b/config/configsanity_test.go @@ -580,8 +580,8 @@ func TestConfigSanityDataDB(t *testing.T) { cfg.dataDbCfg.DataDbType = utils.INTERNAL cfg.cacheCfg = CacheCfg{ - "test": &CacheParamCfg{ - Limit: 1, + utils.CacheTimings: &CacheParamCfg{ + Limit: 0, }, } if err := cfg.checkConfigSanity(); err != nil { @@ -641,3 +641,16 @@ func TestConfigSanityDataDB(t *testing.T) { } } +func TestConfigSanityCacheS(t *testing.T) { + cfg, _ = NewDefaultCGRConfig() + + cfg.cacheCfg = map[string]*CacheParamCfg{"wrong_partition_name": &CacheParamCfg{Limit: 10}} + if err := cfg.checkConfigSanity(); err == nil || err.Error() != " partition not defined" { + t.Error(err) + } + + cfg.cacheCfg = map[string]*CacheParamCfg{utils.CacheLoadIDs: &CacheParamCfg{Limit: 9}} + if err := cfg.checkConfigSanity(); err != nil { + t.Error(err) + } +} diff --git a/utils/consts.go b/utils/consts.go index 59dceae45..b274ddf22 100755 --- a/utils/consts.go +++ b/utils/consts.go @@ -723,7 +723,7 @@ const ( ThresholdsLow = "thresholds" DispatcherSLow = "dispatchers" AnalyzerSLow = "analyzers" - SchedulerSLow = "scheduler" + SchedulerSLow = "schedulers" LoaderSLow = "loaders" RALsLow = "rals" ReplicatorLow = "replicator" diff --git a/utils/dateseries.go b/utils/dateseries.go index 8030c780c..cb3bf2696 100644 --- a/utils/dateseries.go +++ b/utils/dateseries.go @@ -216,7 +216,7 @@ func (md MonthDays) Contains(monthDay int) (result bool) { // Parse MonthDay elements from string separated by sep. func (md *MonthDays) Parse(input, sep string) { switch input { - case "*any", "": + case META_ANY, EmptyString: *md = []int{} default: elements := strings.Split(input, sep)