mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 21:29:52 +05:00
Added cache partitions check in checksanity
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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() != "<CacheS> partition <wrong_partition_name> not defined" {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
cfg.cacheCfg = map[string]*CacheParamCfg{utils.CacheLoadIDs: &CacheParamCfg{Limit: 9}}
|
||||
if err := cfg.checkConfigSanity(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,7 +723,7 @@ const (
|
||||
ThresholdsLow = "thresholds"
|
||||
DispatcherSLow = "dispatchers"
|
||||
AnalyzerSLow = "analyzers"
|
||||
SchedulerSLow = "scheduler"
|
||||
SchedulerSLow = "schedulers"
|
||||
LoaderSLow = "loaders"
|
||||
RALsLow = "rals"
|
||||
ReplicatorLow = "replicator"
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user