Fixes for general tests

This commit is contained in:
Trial97
2018-11-06 16:58:48 +02:00
committed by Dan Christian Bogos
parent 6d200d8604
commit f8a21a541c
5 changed files with 1474 additions and 1472 deletions

View File

@@ -218,8 +218,8 @@ func TestA1itDataSession1(t *testing.T) {
t.Error(err)
}
cc = *ec.AsCallCost()
if len(cc.Timespans) != 3 {
t.Errorf("Unexpected number of timespans: %+v", len(cc.Timespans))
if len(cc.Timespans) != 1 {
t.Errorf("Unexpected number of timespans: %+v, for %+v\n from:%+v", len(cc.Timespans), utils.ToJSON(cc.Timespans), utils.ToJSON(ec))
}
if cc.RatedUsage != 2202800 {
t.Errorf("RatingUsage expected: %f received %f, callcost: %+v ", 2202800.0, cc.RatedUsage, cc)

View File

@@ -81,9 +81,9 @@ func testCDREInitCfg(t *testing.T) {
config.SetCgrConfig(cdreCfg)
switch cdreConfigDIR {
case "tutmongo":
cdreDelay = 4000
default:
cdreDelay = 2000
default:
cdreDelay = 1000
}
}
@@ -146,7 +146,7 @@ func testCDREProcessCdr(t *testing.T) {
ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}}
cdr.ComputeCGRID()
var reply string
if err := cdreRPC.Call("CdrsV1.ProcessCdr", cdr, &reply); err != nil {
if err := cdreRPC.Call(utils.CdrsV2ProcessCDR, cdr, &reply); err != nil {
t.Error("Unexpected error: ", err.Error())
} else if reply != utils.OK {
t.Error("Unexpected reply received: ", reply)

View File

@@ -276,7 +276,7 @@ func TestCDRsOnExpAMQPPosterFileFailover(t *testing.T) {
if readBytes, err := ioutil.ReadFile(filePath); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(failoverContent, readBytes) { // Checking just the prefix should do since some content is dynamic
t.Errorf("Expecting: %q, received: %q", string(failoverContent), string(readBytes))
t.Errorf("Expecting: %v, received: %v", utils.ToJSON(failoverContent), utils.ToJSON(readBytes))
}
if err := os.Remove(filePath); err != nil {
t.Error("Failed removing file: ", filePath)

File diff suppressed because it is too large Load Diff

View File

@@ -257,21 +257,22 @@ func TestTpExecuteActionCgrRpcAcc(t *testing.T) {
}
}
func TestTpExecuteActionCgrRpcCdrStats(t *testing.T) {
var reply string
if err := tpRPC.Call("ApierV2.ExecuteAction", utils.AttrExecuteAction{
ActionsId: "RPC_CDRSTATS",
}, &reply); err != nil {
t.Error("Got error on ApierV2.ExecuteAction: ", err.Error())
} else if reply != utils.OK {
t.Errorf("Calling ExecuteAction got reply: %s", reply)
}
var queue engine.CDRStatsQueue
time.Sleep(20 * time.Millisecond)
if err := tpRPC.Call("CDRStatsV1.GetQueue", "qtest", &queue); err != nil {
t.Error("Got error on CDRStatsV1.GetQueue: ", err.Error())
}
}
// Deprecated
// func TestTpExecuteActionCgrRpcCdrStats(t *testing.T) {
// var reply string
// if err := tpRPC.Call("ApierV2.ExecuteAction", utils.AttrExecuteAction{
// ActionsId: "RPC_CDRSTATS",
// }, &reply); err != nil {
// t.Error("Got error on ApierV2.ExecuteAction: ", err.Error())
// } else if reply != utils.OK {
// t.Errorf("Calling ExecuteAction got reply: %s", reply)
// }
// var queue engine.CDRStatsQueue
// time.Sleep(20 * time.Millisecond)
// if err := tpRPC.Call("CDRStatsV1.GetQueue", "qtest", &queue); err != nil {
// t.Error("Got error on CDRStatsV1.GetQueue: ", err.Error())
// }
// }
func TestTpCreateExecuteActionMatch(t *testing.T) {
var reply string