Fixed DispatcherService ThresholdSv1 tests

This commit is contained in:
Trial97
2019-02-13 17:02:23 +02:00
committed by Dan Christian Bogos
parent f21cac4452
commit e02eda58e5
12 changed files with 34 additions and 37 deletions

View File

@@ -309,7 +309,7 @@ func testChargerSRemChargerProfile(t *testing.T) {
func testChargerSPing(t *testing.T) {
var resp string
if err := chargerRPC.Call(utils.ChargerSv1Ping, &utils.CGREvent{}, &resp); err != nil {
if err := chargerRPC.Call(utils.ChargerSv1Ping, new(utils.CGREvent), &resp); err != nil {
t.Error(err)
} else if resp != utils.Pong {
t.Error("Unexpected reply returned", resp)

View File

@@ -107,7 +107,7 @@ func TestSSv1ItRpcConn(t *testing.T) {
func TestSSv1ItPing(t *testing.T) {
var resp string
if err := sSv1BiRpc.Call(utils.SessionSv1Ping, &utils.CGREvent{}, &resp); err != nil {
if err := sSv1BiRpc.Call(utils.SessionSv1Ping, new(utils.CGREvent), &resp); err != nil {
t.Error(err)
} else if resp != utils.Pong {
t.Error("Unexpected reply returned", resp)

View File

@@ -421,7 +421,7 @@ func testV1STSRemoveStatQueueProfile(t *testing.T) {
func testV1STSStatsPing(t *testing.T) {
var resp string
if err := stsV1Rpc.Call(utils.StatSv1Ping, &utils.CGREvent{}, &resp); err != nil {
if err := stsV1Rpc.Call(utils.StatSv1Ping, new(utils.CGREvent), &resp); err != nil {
t.Error(err)
} else if resp != utils.Pong {
t.Error("Unexpected reply returned", resp)

View File

@@ -973,7 +973,7 @@ func testV1SplSRemSupplierProfiles(t *testing.T) {
func testV1SplSupplierPing(t *testing.T) {
var resp string
if err := splSv1Rpc.Call(utils.SupplierSv1Ping, &utils.CGREvent{}, &resp); err != nil {
if err := splSv1Rpc.Call(utils.SupplierSv1Ping, new(utils.CGREvent), &resp); err != nil {
t.Error(err)
} else if resp != utils.Pong {
t.Error("Unexpected reply returned", resp)

View File

@@ -146,13 +146,13 @@ func TestDspAttributeS(t *testing.T) {
func testDspAttrPingFailover(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.AttributeSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.AttributeSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
reply = ""
if err := allEngine2.RCP.Call(utils.AttributeSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine2.RCP.Call(utils.AttributeSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -275,7 +275,7 @@ func testDspAttrGetAttrFailover(t *testing.T) {
func testDspAttrPing(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.AttributeSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.AttributeSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)

View File

@@ -62,7 +62,7 @@ func TestDspChargerS(t *testing.T) {
func testDspCppPingFailover(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.ChargerSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.ChargerSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -138,7 +138,7 @@ func testDspCppGetChtgFailover(t *testing.T) {
func testDspCppPing(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.ChargerSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.ChargerSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)

View File

@@ -61,7 +61,7 @@ func TestDspResourceS(t *testing.T) {
func testDspResPingFailover(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.ResourceSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.ResourceSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -95,7 +95,7 @@ func testDspResPingFailover(t *testing.T) {
func testDspResPing(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.ResourceSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.ResourceSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)

View File

@@ -101,7 +101,7 @@ func testDspSessionAddBalacne(t *testing.T) {
func testDspSessionPing(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.SessionSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.SessionSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -122,7 +122,7 @@ func testDspSessionPing(t *testing.T) {
func testDspSessionPingFailover(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.SessionSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.SessionSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)

View File

@@ -62,7 +62,7 @@ func TestDspStatS(t *testing.T) {
func testDspStsPingFailover(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.StatSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.StatSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -150,7 +150,7 @@ func testDspStsGetStatFailover(t *testing.T) {
func testDspStsPing(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.StatSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.StatSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)

View File

@@ -62,7 +62,7 @@ func TestDspSupplierS(t *testing.T) {
func testDspSupPing(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.SupplierSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.SupplierSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -83,7 +83,7 @@ func testDspSupPing(t *testing.T) {
func testDspSupPingFailover(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.SupplierSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.SupplierSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)

View File

@@ -64,7 +64,7 @@ func TestDspThresholdS(t *testing.T) {
func testDspThPingFailover(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.ThresholdSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.ThresholdSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -131,7 +131,7 @@ func testDspThProcessEventFailover(t *testing.T) {
func testDspThPing(t *testing.T) {
var reply string
if err := allEngine.RCP.Call(utils.ThresholdSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := allEngine.RCP.Call(utils.ThresholdSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
@@ -223,13 +223,11 @@ func testDspThTestAuthKey2(t *testing.T) {
}
func testDspThTestAuthKey3(t *testing.T) {
var th *engine.Thresholds
eTh := &engine.Thresholds{
&engine.Threshold{
Tenant: "cgrates.org",
ID: "THD_ACNT_1002",
Hits: 1,
},
var th *engine.Threshold
eTh := &engine.Threshold{
Tenant: "cgrates.org",
ID: "THD_ACNT_1002",
Hits: 1,
}
if err := dispEngine.RCP.Call(utils.ThresholdSv1GetThreshold, &TntIDWithApiKey{
TenantID: utils.TenantID{
@@ -241,17 +239,16 @@ func testDspThTestAuthKey3(t *testing.T) {
},
}, &th); err != nil {
t.Error(err)
} else if !reflect.DeepEqual((*eTh)[0].Tenant, (*th)[0].Tenant) {
t.Errorf("expecting: %+v, received: %+v", (*eTh)[0].Tenant, (*th)[0].Tenant)
} else if !reflect.DeepEqual((*eTh)[0].ID, (*th)[0].ID) {
t.Errorf("expecting: %+v, received: %+v", (*eTh)[0].ID, (*th)[0].ID)
} else if !reflect.DeepEqual((*eTh)[0].Hits, (*th)[0].Hits) {
t.Errorf("expecting: %+v, received: %+v", (*eTh)[0].Hits, (*th)[0].Hits)
} else if !reflect.DeepEqual((*eTh).Tenant, (*th).Tenant) {
t.Errorf("expecting: %+v, received: %+v", (*eTh).Tenant, (*th).Tenant)
} else if !reflect.DeepEqual((*eTh).ID, (*th).ID) {
t.Errorf("expecting: %+v, received: %+v", (*eTh).ID, (*th).ID)
} else if !reflect.DeepEqual((*eTh).Hits, (*th).Hits) {
t.Errorf("expecting: %+v, received: %+v", (*eTh).Hits, (*th).Hits)
}
var ids []string
eIDs := []string{"THD_ACNT_1002", "THD_ACNT_1002"}
nowTime := time.Now()
eIDs := []string{"THD_ACNT_1002"}
if err := dispEngine.RCP.Call(utils.ThresholdSv1GetThresholdIDs, &TntWithApiKey{
TenantArg: utils.TenantArg{

View File

@@ -106,17 +106,17 @@ func testTLSRpcConn(t *testing.T) {
func testTLSPing(t *testing.T) {
var reply string
if err := tlsRpcClientJson.Call(utils.ThresholdSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := tlsRpcClientJson.Call(utils.ThresholdSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
if err := tlsRpcClientGob.Call(utils.ThresholdSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := tlsRpcClientGob.Call(utils.ThresholdSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)
}
if err := tlsHTTPJson.Call(utils.ThresholdSv1Ping, &utils.CGREvent{}, &reply); err != nil {
if err := tlsHTTPJson.Call(utils.ThresholdSv1Ping, new(utils.CGREvent), &reply); err != nil {
t.Error(err)
} else if reply != utils.Pong {
t.Errorf("Received: %s", reply)