Updated integration tests

This commit is contained in:
Trial97
2021-01-27 12:14:01 +02:00
committed by Dan Christian Bogos
parent e696d688aa
commit a0c820031f
3 changed files with 14 additions and 8 deletions

View File

@@ -175,11 +175,11 @@ func testFlatstoreITHandleCdr1File(t *testing.T) {
t.Errorf("Files in ersInDir: %+v", filesInDir)
}
filesOutDir, _ := ioutil.ReadDir("/tmp/flatstoreErs/out")
ids := []string{}
for _, fD := range filesOutDir {
ids = append(ids, fD.Name())
}
if len(filesOutDir) != 6 {
if len(filesOutDir) != 5 {
ids := []string{}
for _, fD := range filesOutDir {
ids = append(ids, fD.Name())
}
t.Errorf("Unexpected number of files in output directory: %+v, %q", len(filesOutDir), ids)
}
ePartContent := "INVITE|2daec40c|548625ac|dd0c4c617a9919d29a6175cdff223a9p@0:0:0:0:0:0:0:0|200|OK|1436454408|*prepaid|1001|1002||3401:2069362475\n"

View File

@@ -265,6 +265,7 @@ func (rdr *PartialCSVFileER) processFile(fPath, fName string) (err error) {
rdrCfg: rdr.Config(),
}
evsPosted++
rdr.cache.Set(cgrID, nil, nil)
rdr.cache.Remove(cgrID)
} else {
// overwrite the cache value with merged NavigableMap
@@ -356,6 +357,9 @@ func (rdr *PartialCSVFileER) dumpToFile(itmID string, value interface{}) {
}
func (rdr *PartialCSVFileER) postCDR(itmID string, value interface{}) {
if value == nil {
return
}
tmz := utils.FirstNonEmpty(rdr.Config().Timezone,
rdr.cgrCfg.GeneralCfg().DefaultTimezone)
origCgrEvs := value.([]*utils.CGREvent)

View File

@@ -340,11 +340,13 @@ func testSessionSRplCheckAccount(t *testing.T) {
Account: "1005",
}
expectedBal := 5*time.Second - 40*time.Millisecond
if err := smgRplcSlvRPC.Call(utils.APIerSv2GetAccount, attrs, &acnt); err != nil {
t.Error(err)
// a tolerance of +/- 5ms is acceptable
} else if rply := acnt.BalanceMap[utils.MetaVoice].GetTotalValue(); rply < float64(5*time.Second-46*time.Millisecond) || rply > float64(5*time.Second-35*time.Millisecond) {
t.Errorf("Expecting: ~%v, received: %v", float64(5*time.Second-40*time.Millisecond), rply)
// a tolerance of +/- 10ms is acceptable
} else if rply := acnt.BalanceMap[utils.MetaVoice].GetTotalValue(); rply < float64(expectedBal-10*time.Millisecond) ||
rply > float64(expectedBal+10*time.Millisecond) {
t.Errorf("Expecting: ~%v, received: %v", expectedBal, time.Duration(rply))
}
}