mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 15:18:44 +05:00
Repair it tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
51362f35e7
commit
74700402f2
@@ -262,7 +262,7 @@ func testDspAttrGetAttrFailover(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
var attrReply *engine.AttributeProfile
|
||||
var attrReply engine.AttributeProfile
|
||||
var rplyEv engine.AttrSProcessEventReply
|
||||
if err := dispEngine.RPC.Call(utils.AttributeSv1GetAttributeForEvent,
|
||||
ev, &attrReply); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
@@ -272,9 +272,9 @@ func testDspAttrGetAttrFailover(t *testing.T) {
|
||||
if err := dispEngine.RPC.Call(utils.AttributeSv1ProcessEvent,
|
||||
ev, &rplyEv); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
} else if reflect.DeepEqual(eRply, &rplyEv) {
|
||||
} else if reflect.DeepEqual(*eRply, &rplyEv) {
|
||||
t.Errorf("Expecting: %s, received: %s",
|
||||
utils.ToJSON(eRply), utils.ToJSON(rplyEv))
|
||||
utils.ToJSON(*eRply), utils.ToJSON(rplyEv))
|
||||
}
|
||||
|
||||
allEngine2.stopEngine(t)
|
||||
@@ -283,10 +283,11 @@ func testDspAttrGetAttrFailover(t *testing.T) {
|
||||
ev, &attrReply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
attrReply.Compile()
|
||||
sort.Strings(eAttrPrf.FilterIDs)
|
||||
sort.Strings(attrReply.FilterIDs)
|
||||
if !reflect.DeepEqual(eAttrPrf, attrReply) {
|
||||
t.Errorf("Expecting: %s, received: %s", utils.ToJSON(eAttrPrf), utils.ToJSON(attrReply))
|
||||
if !reflect.DeepEqual(*eAttrPrf, attrReply) {
|
||||
t.Errorf("Expecting: %s, received: %s", utils.ToJSON(*eAttrPrf), utils.ToJSON(attrReply))
|
||||
}
|
||||
|
||||
if err := dispEngine.RPC.Call(utils.AttributeSv1ProcessEvent,
|
||||
@@ -426,15 +427,16 @@ func testDspAttrTestAuthKey2(t *testing.T) {
|
||||
if *encoding == utils.MetaGOB {
|
||||
eAttrPrf.Attributes[0].FilterIDs = nil // empty slice are nil in gob
|
||||
}
|
||||
var attrReply *engine.AttributeProfile
|
||||
var attrReply engine.AttributeProfile
|
||||
if err := dispEngine.RPC.Call(utils.AttributeSv1GetAttributeForEvent,
|
||||
ev, &attrReply); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
attrReply.Compile()
|
||||
sort.Strings(eAttrPrf.FilterIDs)
|
||||
sort.Strings(attrReply.FilterIDs)
|
||||
if !reflect.DeepEqual(eAttrPrf, attrReply) {
|
||||
t.Errorf("Expecting: %s, received: %s", utils.ToJSON(eAttrPrf), utils.ToJSON(attrReply))
|
||||
if !reflect.DeepEqual(*eAttrPrf, attrReply) {
|
||||
t.Errorf("Expecting: %s, received: %s", utils.ToJSON(*eAttrPrf), utils.ToJSON(attrReply))
|
||||
}
|
||||
|
||||
eRply := &engine.AttrSProcessEventReply{
|
||||
@@ -536,7 +538,7 @@ func testDspAttrGetAttrRoundRobin(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
var attrReply *engine.AttributeProfile
|
||||
var attrReply engine.AttributeProfile
|
||||
var rplyEv engine.AttrSProcessEventReply
|
||||
// To ALL2
|
||||
if err := dispEngine.RPC.Call(utils.AttributeSv1GetAttributeForEvent,
|
||||
@@ -550,10 +552,11 @@ func testDspAttrGetAttrRoundRobin(t *testing.T) {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
attrReply.Compile()
|
||||
sort.Strings(eAttrPrf.FilterIDs)
|
||||
sort.Strings(attrReply.FilterIDs)
|
||||
if !reflect.DeepEqual(eAttrPrf, attrReply) {
|
||||
t.Errorf("Expecting: %s, received: %s", utils.ToJSON(eAttrPrf), utils.ToJSON(attrReply))
|
||||
if !reflect.DeepEqual(*eAttrPrf, attrReply) {
|
||||
t.Errorf("Expecting: %s, received: %s", utils.ToJSON(*eAttrPrf), utils.ToJSON(attrReply))
|
||||
}
|
||||
|
||||
// To ALL2
|
||||
|
||||
@@ -208,13 +208,14 @@ func testAttributeSProcessEventWithAccount(t *testing.T) {
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
var replyAttr *engine.AttributeProfile
|
||||
var replyAttr engine.AttributeProfile
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfile,
|
||||
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_ACCOUNT"}}, &replyAttr); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
|
||||
replyAttr.Compile()
|
||||
if !reflect.DeepEqual(*alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", *alsPrf.AttributeProfile, replyAttr)
|
||||
}
|
||||
|
||||
ev := &utils.CGREvent{
|
||||
@@ -279,13 +280,14 @@ func testAttributeSProcessEventWithAccountFull(t *testing.T) {
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
var replyAttr *engine.AttributeProfile
|
||||
var replyAttr engine.AttributeProfile
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfile,
|
||||
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_ACCOUNT2"}}, &replyAttr); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
|
||||
replyAttr.Compile()
|
||||
if !reflect.DeepEqual(*alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", *alsPrf.AttributeProfile, replyAttr)
|
||||
}
|
||||
|
||||
ev := &utils.CGREvent{
|
||||
@@ -391,13 +393,14 @@ func testAttributeSProcessEventWithStat(t *testing.T) {
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
var replyAttr *engine.AttributeProfile
|
||||
var replyAttr engine.AttributeProfile
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfile,
|
||||
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_STATS"}}, &replyAttr); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
|
||||
replyAttr.Compile()
|
||||
if !reflect.DeepEqual(*alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", *alsPrf.AttributeProfile, replyAttr)
|
||||
}
|
||||
|
||||
ev := &utils.CGREvent{
|
||||
@@ -463,13 +466,14 @@ func testAttributeSProcessEventWithStatFull(t *testing.T) {
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
var replyAttr *engine.AttributeProfile
|
||||
var replyAttr engine.AttributeProfile
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfile,
|
||||
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_STATS2"}}, &replyAttr); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
|
||||
replyAttr.Compile()
|
||||
if !reflect.DeepEqual(*alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", *alsPrf.AttributeProfile, replyAttr)
|
||||
}
|
||||
|
||||
ev := &utils.CGREvent{
|
||||
@@ -598,13 +602,14 @@ func testAttributeSProcessEventWithResource(t *testing.T) {
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
var replyAttr *engine.AttributeProfile
|
||||
var replyAttr engine.AttributeProfile
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfile,
|
||||
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_RESOURCE"}}, &replyAttr); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
|
||||
replyAttr.Compile()
|
||||
if !reflect.DeepEqual(*alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", *alsPrf.AttributeProfile, replyAttr)
|
||||
}
|
||||
|
||||
ev := &utils.CGREvent{
|
||||
@@ -674,13 +679,14 @@ func testAttributeSProcessEventWithResourceFull(t *testing.T) {
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
var replyAttr *engine.AttributeProfile
|
||||
var replyAttr engine.AttributeProfile
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfile,
|
||||
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_RESOURCE2"}}, &replyAttr); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
|
||||
replyAttr.Compile()
|
||||
if !reflect.DeepEqual(*alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", *alsPrf.AttributeProfile, replyAttr)
|
||||
}
|
||||
|
||||
ev := &utils.CGREvent{
|
||||
@@ -758,13 +764,14 @@ func testAttributeSProcessEventWithLibPhoneNumber(t *testing.T) {
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
var replyAttr *engine.AttributeProfile
|
||||
var replyAttr engine.AttributeProfile
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfile,
|
||||
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_LIBPHONENUMBER2"}}, &replyAttr); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
|
||||
replyAttr.Compile()
|
||||
if !reflect.DeepEqual(*alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", *alsPrf.AttributeProfile, replyAttr)
|
||||
}
|
||||
|
||||
ev := &utils.CGREvent{
|
||||
@@ -846,13 +853,14 @@ func testAttributeSProcessEventWithLibPhoneNumberComposed(t *testing.T) {
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
var replyAttr *engine.AttributeProfile
|
||||
var replyAttr engine.AttributeProfile
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfile,
|
||||
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_LIBPHONENUMBER_COMPOSED"}}, &replyAttr); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
|
||||
replyAttr.Compile()
|
||||
if !reflect.DeepEqual(*alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", *alsPrf.AttributeProfile, replyAttr)
|
||||
}
|
||||
|
||||
ev := &utils.CGREvent{
|
||||
@@ -924,13 +932,14 @@ func testAttributeSProcessEventWithLibPhoneNumberFull(t *testing.T) {
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
var replyAttr *engine.AttributeProfile
|
||||
var replyAttr engine.AttributeProfile
|
||||
if err := attrRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfile,
|
||||
utils.TenantIDWithAPIOpts{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_LIBPHONENUMBER"}}, &replyAttr); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", alsPrf.AttributeProfile, replyAttr)
|
||||
replyAttr.Compile()
|
||||
if !reflect.DeepEqual(*alsPrf.AttributeProfile, replyAttr) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", *alsPrf.AttributeProfile, replyAttr)
|
||||
}
|
||||
|
||||
ev := &utils.CGREvent{
|
||||
|
||||
@@ -128,7 +128,7 @@ func testLoadersIDBIdxItLoad(t *testing.T) {
|
||||
}
|
||||
|
||||
func testLoadersIDBIdxCheckAttributes(t *testing.T) {
|
||||
exp := &engine.AttributeProfile{
|
||||
exp := engine.AttributeProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ATTR_1001_SIMPLEAUTH",
|
||||
FilterIDs: []string{"*string:~*opts.*context:simpleauth", "*string:~*req.Account:1001"},
|
||||
@@ -144,7 +144,7 @@ func testLoadersIDBIdxCheckAttributes(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
var reply *engine.AttributeProfile
|
||||
var reply engine.AttributeProfile
|
||||
if err := loadersIDBIdxRPC.Call(context.Background(), utils.AdminSv1GetAttributeProfile,
|
||||
&utils.TenantIDWithAPIOpts{
|
||||
TenantID: &utils.TenantID{
|
||||
@@ -153,8 +153,11 @@ func testLoadersIDBIdxCheckAttributes(t *testing.T) {
|
||||
},
|
||||
}, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(exp, reply) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(exp), utils.ToJSON(reply))
|
||||
} else {
|
||||
reply.Compile()
|
||||
if !reflect.DeepEqual(exp, reply) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(exp), utils.ToJSON(reply))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -193,11 +193,6 @@ func testV1RtsCaseGetRoutesAfterLoading(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
Weights: utils.DynamicWeights{
|
||||
{
|
||||
Weight: 0,
|
||||
},
|
||||
},
|
||||
}
|
||||
var reply *engine.RouteProfile
|
||||
if err := rtsCaseSv1BiRpc.Call(context.Background(), utils.AdminSv1GetRouteProfile,
|
||||
|
||||
Reference in New Issue
Block a user