mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 21:59:53 +05:00
When checking Cache in case of *internal DataDB consider only DataDB cache partitions
This commit is contained in:
@@ -436,13 +436,7 @@ func (cfg *CGRConfig) checkConfigSanity() error {
|
||||
// DataDB sanity checks
|
||||
if cfg.dataDbCfg.DataDbType == utils.INTERNAL {
|
||||
for key, config := range cfg.cacheCfg {
|
||||
if key == utils.CacheDiameterMessages || key == utils.CacheClosedSessions || key == utils.CacheRPCConnections {
|
||||
if config.Limit == 0 {
|
||||
return fmt.Errorf("<%s> %s needs to be != 0 when DataBD is *internal, found 0.", utils.CacheS, key)
|
||||
}
|
||||
continue
|
||||
}
|
||||
if config.Limit != 0 {
|
||||
if utils.CacheDataDBPartitions.Has(key) && config.Limit != 0 {
|
||||
return fmt.Errorf("<%s> %s needs to be 0 when DataBD is *internal, received : %d", utils.CacheS, key, config.Limit)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -578,36 +578,26 @@ func TestConfigSanityStorDB(t *testing.T) {
|
||||
func TestConfigSanityDataDB(t *testing.T) {
|
||||
cfg, _ = NewDefaultCGRConfig()
|
||||
cfg.dataDbCfg.DataDbType = utils.INTERNAL
|
||||
cfg.cacheCfg = CacheCfg{
|
||||
utils.CacheDiameterMessages: &CacheParamCfg{
|
||||
Limit: 0,
|
||||
},
|
||||
}
|
||||
expected := "<CacheS> *diameter_messages needs to be != 0 when DataBD is *internal, found 0."
|
||||
if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected {
|
||||
t.Errorf("Expecting: %+q received: %+q", expected, err)
|
||||
}
|
||||
|
||||
cfg.cacheCfg = CacheCfg{
|
||||
utils.CacheDiameterMessages: &CacheParamCfg{
|
||||
Limit: 1,
|
||||
},
|
||||
}
|
||||
if err := cfg.checkConfigSanity(); err != nil {
|
||||
t.Errorf("Expecting: nil received: %+q", err)
|
||||
}
|
||||
|
||||
cfg.cacheCfg = CacheCfg{
|
||||
"test": &CacheParamCfg{
|
||||
Limit: 1,
|
||||
},
|
||||
}
|
||||
expected = "<CacheS> test needs to be 0 when DataBD is *internal, received : 1"
|
||||
if err := cfg.checkConfigSanity(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
cfg.cacheCfg = CacheCfg{
|
||||
utils.CacheAccounts: &CacheParamCfg{
|
||||
Limit: 1,
|
||||
},
|
||||
}
|
||||
expected := "<CacheS> *accounts needs to be 0 when DataBD is *internal, received : 1"
|
||||
if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected {
|
||||
t.Errorf("Expecting: %+q received: %+q", expected, err)
|
||||
}
|
||||
cfg.cacheCfg["test"].Limit = 0
|
||||
|
||||
cfg.cacheCfg[utils.CacheAccounts].Limit = 0
|
||||
cfg.resourceSCfg.Enabled = true
|
||||
expected = "<ResourceS> StoreInterval needs to be -1 when DataBD is *internal, received : 0"
|
||||
if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected {
|
||||
|
||||
@@ -148,6 +148,15 @@ var (
|
||||
|
||||
// AccountableRequestTypes are the ones handled by Accounting subsystem
|
||||
AccountableRequestTypes = NewStringSet([]string{META_PREPAID, META_POSTPAID, META_PSEUDOPREPAID})
|
||||
|
||||
CacheDataDBPartitions = NewStringSet([]string{CacheDestinations, CacheReverseDestinations,
|
||||
CacheRatingPlans, CacheRatingProfiles, CacheActions,
|
||||
CacheActionPlans, CacheAccountActionPlans, CacheActionTriggers, CacheSharedGroups, CacheResourceProfiles, CacheResources,
|
||||
CacheTimings, CacheStatQueueProfiles, CacheStatQueues, CacheThresholdProfiles, CacheThresholds,
|
||||
CacheFilters, CacheSupplierProfiles, CacheAttributeProfiles, CacheChargerProfiles,
|
||||
CacheDispatcherProfiles, CacheDispatcherHosts, CacheResourceFilterIndexes, CacheStatFilterIndexes,
|
||||
CacheThresholdFilterIndexes, CacheSupplierFilterIndexes, CacheAttributeFilterIndexes,
|
||||
CacheChargerFilterIndexes, CacheDispatcherFilterIndexes, CacheLoadIDs, CacheAccounts})
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
Reference in New Issue
Block a user