Update number or filter in cache and update checkConfigSanity

This commit is contained in:
TeoV
2017-10-27 20:37:11 +03:00
parent be8e696dc6
commit 0ba6944ebd
5 changed files with 18 additions and 4 deletions

View File

@@ -103,7 +103,7 @@ func TestSMGV1CacheStats(t *testing.T) {
expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 9,
Actions: 9, ActionPlans: 4, AccountActionPlans: 5, SharedGroups: 1, DerivedChargers: 1,
LcrProfiles: 5, CdrStats: 6, Users: 3, Aliases: 1, ReverseAliases: 2, ResourceProfiles: 3, Resources: 3, StatQueues: 0,
StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6, Filters: 13}
StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6, Filters: 14}
var args utils.AttrCacheStats
if err := smgV1Rpc.Call("ApierV1.GetCacheStats", args, &rcvStats); err != nil {
t.Error("Got error on ApierV1.GetCacheStats: ", err.Error())

View File

@@ -318,6 +318,11 @@ func (self *CGRConfig) checkConfigSanity() error {
return errors.New("User service not enabled but requested by RALs component.")
}
}
for _, connCfg := range self.RALsThresholdSConns {
if connCfg.Address == utils.MetaInternal && !self.UserServerEnabled {
return errors.New("ThresholdS not enabled but requested by RALs component.")
}
}
}
// CDRServer checks
if self.CDRSEnabled {
@@ -515,6 +520,15 @@ func (self *CGRConfig) checkConfigSanity() error {
}
}
}
// Stat checks
if self.statsCfg != nil && self.statsCfg.Enabled {
for _, connCfg := range self.statsCfg.ThresholdSConns {
if connCfg.Address == utils.MetaInternal && !self.thresholdSCfg.Enabled {
return errors.New("ThresholdS not enabled but requested by StatS component.")
}
}
}
return nil
}

View File

@@ -785,7 +785,7 @@ func TestNewCgrJsonCfgFromFile(t *testing.T) {
if gCfg, err := cgrJsonCfg.GeneralJsonCfg(); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(eCfg, gCfg) {
t.Errorf("Expecting: %+v, received: ", eCfg, gCfg)
t.Errorf("Expecting: %+v, received: %+v", eCfg, gCfg)
}
cdrFields := []*CdrFieldJsonCfg{
&CdrFieldJsonCfg{Field_id: utils.StringPointer(utils.TOR), Value: utils.StringPointer("~7:s/^(voice|data|sms|mms|generic)$/*$1/")},

View File

@@ -101,7 +101,7 @@ func TestTutSMGCacheStats(t *testing.T) {
expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 9,
Actions: 9, ActionPlans: 4, AccountActionPlans: 5, SharedGroups: 1, DerivedChargers: 1, LcrProfiles: 5,
CdrStats: 6, Users: 3, Aliases: 1, ReverseAliases: 2, ResourceProfiles: 3, Resources: 3, StatQueues: 0,
StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6, Filters: 13}
StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6, Filters: 14}
var args utils.AttrCacheStats
if err := tutSMGRpc.Call("ApierV2.GetCacheStats", args, &rcvStats); err != nil {
t.Error("Got error on ApierV2.GetCacheStats: ", err.Error())

View File

@@ -105,7 +105,7 @@ func TestTutITCacheStats(t *testing.T) {
expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 9,
Actions: 9, ActionPlans: 4, AccountActionPlans: 5, SharedGroups: 1, DerivedChargers: 1, LcrProfiles: 5,
CdrStats: 6, Users: 3, Aliases: 1, ReverseAliases: 2, ResourceProfiles: 3, Resources: 3, StatQueues: 0,
StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6, Filters: 13}
StatQueueProfiles: 0, Thresholds: 6, ThresholdProfiles: 6, Filters: 14}
var args utils.AttrCacheStats
if err := tutLocalRpc.Call("ApierV1.GetCacheStats", args, &rcvStats); err != nil {
t.Error("Got error on ApierV1.GetCacheStats: ", err.Error())