small fix

This commit is contained in:
Edwardro22
2017-07-29 17:41:39 +03:00
parent fdd5cdfeb7
commit 33e7afffae
4 changed files with 21 additions and 7 deletions

View File

@@ -0,0 +1,6 @@
#Id,FilterType,FilterFieldName,FilterFieldValues,ActivationInterval,TTL,Limit,AllocationReply,Weight,ActionTriggers
ResGroup1,*string,Account,1001;1002,2014-07-29T15:00:00Z,1s,7,,20,
ResGroup1,*string_prefix,Destination,10;20,,,,,,
ResGroup1,*rsr_fields,,Subject(~^1.*1$);Destination(1002),,,,,,
ResGroup2,*destinations,Destination,DST_FS,2014-07-29T15:00:00Z,3600s,8,SPECIAL_1002,10,
ResGroup3,*cdr_stats,,CDRST1:*min_ASR:34;CDRST_1001:*min_ASR:20,,,,,,
1 #Id FilterType FilterFieldName FilterFieldValues ActivationInterval TTL Limit AllocationReply Weight ActionTriggers
2 ResGroup1 *string Account 1001;1002 2014-07-29T15:00:00Z 1s 7 20
3 ResGroup1 *string_prefix Destination 10;20
4 ResGroup1 *rsr_fields Subject(~^1.*1$);Destination(1002)
5 ResGroup2 *destinations Destination DST_FS 2014-07-29T15:00:00Z 3600s 8 SPECIAL_1002 10
6 ResGroup3 *cdr_stats CDRST1:*min_ASR:34;CDRST_1001:*min_ASR:20

View File

@@ -0,0 +1,2 @@
#Id,FilterType,FilterFieldName,FilterFieldValues,ActivationInterval,QueueLength,TTL,Metrics,Store,Thresholds,Weight
Stats1,*string,Account,1001;1002,2014-07-29T15:00:00Z,100,1s,*asr;*acd;*acc,true,THRESH1;THRESH2,20
1 #Id FilterType FilterFieldName FilterFieldValues ActivationInterval QueueLength TTL Metrics Store Thresholds Weight
2 Stats1 *string Account 1001;1002 2014-07-29T15:00:00Z 100 1s *asr;*acd;*acc true THRESH1;THRESH2 20

View File

@@ -156,7 +156,7 @@ func TestLoaderITLoadFromCSV(t *testing.T) {
if err = loader.LoadStats(); err != nil {
t.Error("Failed loading stats: ", err.Error())
}
if err := loader.WriteToDatabase(false, false, false); err != nil {
if err := loader.WriteToDatabase(true, false, false); err != nil {
t.Error("Could not write data into dataDb: ", err.Error())
}
}
@@ -310,8 +310,12 @@ func TestLoaderITWriteToDatabase(t *testing.T) {
if err != nil {
t.Error("Failed GetResourceLimit: ", err.Error())
}
if !reflect.DeepEqual(rl, rcv) {
t.Errorf("Expecting: %v, received: %v", rl, rcv)
rlT, err := APItoResourceLimit(rl, "UTC")
if err != nil {
t.Error(err)
}
if !reflect.DeepEqual(rlT, rcv) {
t.Errorf("Expecting: %v, received: %v", rlT, rcv)
}
}
@@ -320,8 +324,12 @@ func TestLoaderITWriteToDatabase(t *testing.T) {
if err != nil {
t.Error("Failed GetStatsQueue: ", err.Error())
}
if !reflect.DeepEqual(st, rcv) {
t.Errorf("Expecting: %v, received: %v", st, rcv)
sts, err := APItoTPStats(st, "UTC")
if err != nil {
t.Error(err)
}
if !reflect.DeepEqual(sts, rcv) {
t.Errorf("Expecting: %v, received: %v", sts, rcv)
}
}

View File

@@ -1610,7 +1610,6 @@ func (tpr *TpReader) LoadStatsFiltered(tag string) error {
if err != nil {
return err
}
fmt.Printf("\nstats :")
mapSTs := make(map[string]*utils.TPStats)
for _, st := range tps {
mapSTs[st.ID] = st
@@ -1933,7 +1932,6 @@ func (tpr *TpReader) WriteToDatabase(flush, verbose, disable_reverse bool) (err
if err != nil {
return err
}
fmt.Printf("stats: %+v", st.Filters[0])
if err = tpr.dataStorage.SetStatsQueue(st); err != nil {
return err
}