Updated apier integration tests

This commit is contained in:
Trial97
2019-11-25 15:34:23 +02:00
committed by Dan Christian Bogos
parent ff5b7d9b59
commit 8dd1d2652b
8 changed files with 33 additions and 6 deletions

View File

@@ -147,6 +147,9 @@ func testAPIerVerifyAttributesAfterLoad(t *testing.T) {
Weight: 20.0,
},
}
if *encoding == utils.MetaGOBrpc {
eAttrPrf.Attributes[0].FilterIDs = nil // in gob emtpty slice is encoded as nil
}
eAttrPrf.Compile()
var attrReply *engine.AttributeProfile
if err := apierRPC.Call(utils.AttributeSv1GetAttributeForEvent,

View File

@@ -1577,6 +1577,10 @@ func TestApierGetCallCostLog(t *testing.T) {
Rates: engine.ChargedRates{},
Timings: engine.ChargedTimings{},
}
if *encoding == utils.MetaGOBrpc {
expected.Usage = nil // 0 value are encoded as nil in gob
expected.Cost = nil
}
attrs.CgrId = "Cdr1"
attrs.RunId = ""
if err := rater.Call(utils.ApierV1GetEventCost, attrs, &cc); err != nil {

View File

@@ -159,6 +159,10 @@ func testDspDspv1GetProfileForEvent(t *testing.T) {
},
},
}
if *encoding == utils.MetaGOBrpc { // in gob emtpty slice is encoded as nil
expected.Hosts[0].FilterIDs = nil
expected.Hosts[1].FilterIDs = nil
}
expected.Hosts.Sort()
if err := dspRPC.Call(utils.DispatcherSv1GetProfileForEvent, &arg, &reply); err != nil {
t.Error(err)

View File

@@ -256,6 +256,9 @@ func testInternalRemoteITGetAttribute(t *testing.T) {
utils.TenantIDWithArgDispatcher{TenantID: &utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_1001_SIMPLEAUTH"}}, &reply); err != nil {
t.Fatal(err)
}
if *encoding == utils.MetaGOBrpc { // in gob emtpty slice is encoded as nil
alsPrf.AttributeProfile.Attributes[0].FilterIDs = nil
}
reply.Compile()
if !reflect.DeepEqual(alsPrf.AttributeProfile, reply) {
t.Errorf("Expecting : %+v, received: %+v", utils.ToJSON(alsPrf.AttributeProfile), utils.ToJSON(reply))
@@ -443,6 +446,10 @@ func testInternalRemoteITGetSupplier(t *testing.T) {
},
Weight: 20,
}
if *encoding == utils.MetaGOBrpc { // in gob emtpty slice is encoded as nil
splPrf.SortingParameters = nil
splPrf2.SortingParameters = nil
}
if err := internalRPC.Call(utils.ApierV1GetSupplierProfile,
&utils.TenantID{Tenant: "cgrates.org", ID: "SPL_ACNT_1001"}, &reply); err != nil {

View File

@@ -172,6 +172,7 @@ func testSchedVeifyAccount1001(t *testing.T) {
10, rply)
}
acnt = nil // in case of gob ( it doesn't update the empty fields)
attrs = &utils.AttrGetAccount{
Tenant: "cgrates.org",
Account: "1002",

View File

@@ -953,6 +953,9 @@ func testV1SplSGetSupplierForEvent(t *testing.T) {
},
Weight: 50,
}
if *encoding == utils.MetaGOBrpc { // in gob emtpty slice is encoded as nil
expected.SortingParameters = nil
}
var supProf []*engine.SupplierProfile
if err := splSv1Rpc.Call(utils.SupplierSv1GetSupplierProfilesForEvent,
ev, &supProf); err != nil {

View File

@@ -75,8 +75,13 @@
],
},
"stats": {
"enabled": false,
"store_interval": "-1",
}
"stats": {
"enabled": false,
"store_interval": "-1",
},
"scheduler": {
"enabled": true,
},
}

View File

@@ -2,10 +2,10 @@
go clean --cache
./test.sh
gen=$?
echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration'
echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -rpc=*gob'
go test github.com/cgrates/cgrates/apier/v1 -tags=integration -rpc=*gob
ap1=$?
echo 'go test github.com/cgrates/cgrates/apier/v2 -tags=integration'
echo 'go test github.com/cgrates/cgrates/apier/v2 -tags=integration -rpc=*gob'
go test github.com/cgrates/cgrates/apier/v2 -tags=integration -rpc=*gob
ap2=$?
# echo 'go test github.com/cgrates/cgrates/engine -tags=integration'