Updated tests for dispatchers and registrarc

This commit is contained in:
Trial97
2021-12-22 16:56:13 +02:00
committed by Dan Christian Bogos
parent b9a97ba9d2
commit 5953eec22a
25 changed files with 158 additions and 183 deletions

View File

@@ -116,7 +116,7 @@ func (aS *ActionS) scheduleActions(ctx *context.Context, cgrEvs []*utils.CGREven
}
for _, sActs := range schedActSet {
if sActs.schedule == utils.MetaASAP {
go aS.asapExecuteActions(ctx, sActs)
go aS.asapExecuteActions(context.Background(), sActs)
continue
}
if _, err = crn.AddFunc(sActs.schedule, sActs.ScheduledExecute); err != nil {

View File

@@ -178,7 +178,6 @@ func TestCdrsCfgAsMapInterface(t *testing.T) {
"store_cdrs": true,
"session_cost_retries": 5,
"chargers_conns":["*internal:*chargers","*conn1"],
"rals_conns": ["*internal:*responder","*conn1"],
"attributes_conns": ["*internal:*attributes","*conn1"],
"thresholds_conns": ["*internal:*thresholds","*conn1"],
"stats_conns": ["*internal:*stats","*conn1"],

View File

@@ -1322,7 +1322,6 @@ func testApisLoadFromPath(t *testing.T) {
"prefix_indexed_fields":["*req.Destination"],
"stats_conns": ["*internal"],
"resources_conns": ["*internal"],
"rals_conns": ["*internal"]
},
@@ -1331,7 +1330,6 @@ func testApisLoadFromPath(t *testing.T) {
"routes_conns": ["*internal"],
"resources_conns": ["*internal"],
"attributes_conns": ["*internal"],
"rals_conns": ["*internal"],
"cdrs_conns": ["*internal"],
"chargers_conns": ["*internal"]
},

View File

@@ -148,7 +148,6 @@ func TestRouteSCfgAsMapInterface1(t *testing.T) {
"attributes_conns": ["*internal:*attributes", "conn1"],
"resources_conns": ["*internal:*resources", "conn1"],
"stats_conns": ["*internal:*stats", "conn1"],
"rals_conns": ["*internal:*responder", "conn1"],
"rates_conns": ["*internal:*rates", "conn1"],
"accounts_conns": ["*internal:*accounts", "conn1"],
"default_ratio":2,

View File

@@ -563,7 +563,6 @@ func TestSessionSCfgAsMapInterfaceCase2(t *testing.T) {
"enabled": true,
"listen_bijson": "127.0.0.1:2018",
"chargers_conns": ["*internal:*chargers", "*conn1"],
"rals_conns": ["*internal:*responder", "*conn1"],
"cdrs_conns": ["*internal:*cdrs", "*conn1"],
"resources_conns": ["*internal:*resources", "*conn1"],
"thresholds_conns": ["*internal:*thresholds", "*conn1"],

View File

@@ -60,7 +60,8 @@
"routes": {
"enabled": true,
"rals_conns": ["*internal"]
"rates_conns": ["*internal"],
"accounts_conns": ["*internal"],
},
"stats": {

View File

@@ -55,7 +55,8 @@
"routes": {
"enabled": true,
"rals_conns": ["*internal"],
"rates_conns": ["*internal"],
"accounts_conns": ["*internal"],
},
"stats": {

View File

@@ -59,7 +59,8 @@
"routes": {
"enabled": true,
"rals_conns": ["*internal"],
"rates_conns": ["*internal"],
"accounts_conns": ["*internal"],
},
"stats": {

View File

@@ -56,7 +56,8 @@
"routes": {
"enabled": true,
"rals_conns": ["*internal"],
"rates_conns": ["*internal"],
"accounts_conns": ["*internal"],
},
"stats": {

View File

@@ -63,7 +63,8 @@
"routes": {
"enabled": true,
"rals_conns": ["*internal"]
"rates_conns": ["*internal"],
"accounts_conns": ["*internal"],
},
"stats": {

View File

@@ -61,7 +61,8 @@
"routes": {
"enabled": true,
"rals_conns": ["*internal"],
"rates_conns": ["*internal"],
"accounts_conns": ["*internal"],
},
"stats": {

View File

@@ -46,4 +46,14 @@
"enabled": true,
},
"loaders": [
{
"id": "*default",
"enabled": true,
"tenant": "cgrates.org",
"lockfile_path": ".cgr.lck",
"tp_in_dir": "/usr/share/cgrates/tariffplans/testit",
"tp_out_dir": "",
},
],
}

View File

@@ -43,4 +43,15 @@
"enabled": true,
},
"loaders": [
{
"id": "*default",
"enabled": true,
"tenant": "cgrates.org",
"lockfile_path": ".cgr.lck",
"tp_in_dir": "/usr/share/cgrates/tariffplans/testit",
"tp_out_dir": "",
},
],
}

View File

@@ -1,10 +1,3 @@
#Id,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart
RT_10CNT,0.2,0.1,60s,60s,0s
RT_10CNT,0,0.05,60s,1s,60s
RT_20CNT,0.4,0.2,60s,60s,0s
RT_20CNT,0,0.1,60s,1s,60s
RT_40CNT,0.8,0.4,60s,30s,0s
RT_40CNT,0,0.2,60s,10s,60s
RT_1CNT,0,0.01,60s,60s,0s
RT_1CNT_PER_SEC,0,0.01,1s,1s,0s
RT_GENERIC_1,0,1,1,1,0
#Tenant,ID,FilterIDs,Weights,MinCost,MaxCost,MaxCostStrategy,RateID,RateFilterIDs,RateActivationStart,RateWeights,RateBlocker,RateIntervalStart,RateFixedFee,RateRecurrentFee,RateUnit,RateIncrement
cgrates.org,RP_SPECIAL_1002,,;0,0.1,0.6,*free,RT_WEEK,,"* * * * *",;0,false,0s,,0.12,1m,1m
cgrates.org,RP_RETAIL1,,;0,0.1,0.6,*free,RT_WEEK,,"* * * * *",;0,false,0s,,0.12,1m,1m
1 #Id #Tenant ConnectFee ID Rate FilterIDs Weights MinCost GroupIntervalStart MaxCost MaxCostStrategy RateID RateFilterIDs RateActivationStart RateWeights RateBlocker RateIntervalStart RateFixedFee RateRecurrentFee RateUnit RateIncrement
2 RT_10CNT cgrates.org 0.2 RP_SPECIAL_1002 0.1 ;0 0.1 0s 0.6 *free RT_WEEK * * * * * ;0 false 0s 0.12 60s 1m 60s 1m
3 RT_10CNT cgrates.org 0 RP_RETAIL1 0.05 ;0 0.1 60s 0.6 *free RT_WEEK * * * * * ;0 false 0s 0.12 60s 1m 1s 1m
RT_20CNT 0.4 0.2 0s 60s 60s
RT_20CNT 0 0.1 60s 60s 1s
RT_40CNT 0.8 0.4 0s 60s 30s
RT_40CNT 0 0.2 60s 60s 10s
RT_1CNT 0 0.01 0s 60s 60s
RT_1CNT_PER_SEC 0 0.01 0s 1s 1s
RT_GENERIC_1 0 1 0 1 1

View File

@@ -0,0 +1,10 @@
#Id,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart
RT_10CNT,0.2,0.1,60s,60s,0s
RT_10CNT,0,0.05,60s,1s,60s
RT_20CNT,0.4,0.2,60s,60s,0s
RT_20CNT,0,0.1,60s,1s,60s
RT_40CNT,0.8,0.4,60s,30s,0s
RT_40CNT,0,0.2,60s,10s,60s
RT_1CNT,0,0.01,60s,60s,0s
RT_1CNT_PER_SEC,0,0.01,1s,1s,0s
RT_GENERIC_1,0,1,1,1,0

View File

@@ -0,0 +1,3 @@
#Tenant,ID,FilterIDs,Weights,MinCost,MaxCost,MaxCostStrategy,RateID,RateFilterIDs,RateActivationStart,RateWeights,RateBlocker,RateIntervalStart,RateFixedFee,RateRecurrentFee,RateUnit,RateIncrement
cgrates.org,RP_1002_LOW,,;0,0.1,0.6,*free,RT_WEEK,,"* * * * *",;0,false,0s,,0.10,1m,1m
cgrates.org,RP_1002,,;0,0.1,0.6,*free,RT_WEEK,,"* * * * *",;0,false,0s,,0.12,1m,1m
1 #Tenant ID FilterIDs Weights MinCost MaxCost MaxCostStrategy RateID RateFilterIDs RateActivationStart RateWeights RateBlocker RateIntervalStart RateFixedFee RateRecurrentFee RateUnit RateIncrement
2 cgrates.org RP_1002_LOW ;0 0.1 0.6 *free RT_WEEK * * * * * ;0 false 0s 0.10 1m 1m
3 cgrates.org RP_1002 ;0 0.1 0.6 *free RT_WEEK * * * * * ;0 false 0s 0.12 1m 1m

View File

@@ -146,6 +146,11 @@ func testDspChcLoadAfterFolder(t *testing.T) {
expStats[utils.CacheAttributeFilterIndexes].Groups = 2
expStats[utils.CacheReverseFilterIndexes].Items = 8
expStats[utils.CacheReverseFilterIndexes].Groups = 6
expStats[utils.CacheRateProfiles].Items = 2
expStats[utils.CacheRateProfilesFilterIndexes].Items = 1
expStats[utils.CacheRateProfilesFilterIndexes].Groups = 1
expStats[utils.CacheRateFilterIndexes].Items = 2
expStats[utils.CacheRateFilterIndexes].Groups = 2
if err := dispEngine.RPC.Call(utils.CacheSv1GetCacheStats, &args, &rcvStats); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(expStats, rcvStats) {
@@ -197,6 +202,8 @@ func testDspChcPrecacheStatus(t *testing.T) {
utils.CacheActionProfilesFilterIndexes: utils.MetaReady,
utils.CacheAccountsFilterIndexes: utils.MetaReady,
utils.CacheAccounts: utils.MetaReady,
utils.MetaAPIBan: utils.MetaReady,
utils.CacheReplicationHosts: utils.MetaReady,
}
if err := dispEngine.RPC.Call(utils.CacheSv1PrecacheStatus, utils.AttrCacheIDsWithAPIOpts{

View File

@@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package dispatchers
import (
"reflect"
"testing"
"time"
@@ -123,10 +122,17 @@ func testDspRPrfCostForEvent(t *testing.T) {
CostIntervals: []*utils.RateSIntervalCost{{
Increments: []*utils.RateSIncrementCost{{
Usage: utils.NewDecimal(int64(time.Minute), 0),
RateID: "ec268a8",
CompressFactor: 1,
}},
CompressFactor: 1,
}},
Rates: map[string]*utils.IntervalRate{"ec268a8": {
IntervalStart: utils.NewDecimal(0, 0),
RecurrentFee: utils.NewDecimalFromFloat64(0.12),
Unit: utils.NewDecimal(60000000000, 0),
Increment: utils.NewDecimal(60000000000, 0),
}},
}
var rpCost *utils.RateProfileCost
@@ -141,7 +147,7 @@ func testDspRPrfCostForEvent(t *testing.T) {
utils.OptsAPIKey: "rPrf12345",
}}, &rpCost); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(rpCost, exp) {
} else if !rpCost.Equals(exp) {
t.Errorf("Expected %+v, received %+v", utils.ToJSON(exp), utils.ToJSON(rpCost))
}
}
@@ -187,10 +193,17 @@ func testDspRPrfCostForEventWithoutFilters(t *testing.T) {
CostIntervals: []*utils.RateSIntervalCost{{
Increments: []*utils.RateSIncrementCost{{
Usage: utils.NewDecimal(int64(time.Minute), 0),
RateID: "ec268a8",
CompressFactor: 60,
}},
CompressFactor: 1,
}},
Rates: map[string]*utils.IntervalRate{"ec268a8": {
IntervalStart: utils.NewDecimal(0, 0),
RecurrentFee: utils.NewDecimalFromFloat64(0.25),
Unit: utils.NewDecimal(60000000000, 0),
Increment: utils.NewDecimal(1000000000, 0),
}},
}
var rpCost *utils.RateProfileCost
@@ -204,7 +217,7 @@ func testDspRPrfCostForEventWithoutFilters(t *testing.T) {
utils.OptsAPIKey: "rPrf12345",
}}, &rpCost); err != nil {
t.Error(err)
} else if !reflect.DeepEqual(rpCost, exp) {
} else if !rpCost.Equals(exp) {
t.Errorf("Expected %+v \n, received %+v", utils.ToJSON(exp), utils.ToJSON(rpCost))
}
}

View File

@@ -228,7 +228,7 @@ func testDspResTestAuthKey3(t *testing.T) {
"Destination": "1002"},
APIOpts: map[string]interface{}{
utils.OptsAPIKey: "res12345",
utils.OptsResourcesUsageID: "651a8db2-4f67-4cf8-b622-169e8a482e55",
utils.OptsResourcesUsageID: "651a8db2-4f67-4cf8-b622-169e8a482e51",
},
}
if err := dispEngine.RPC.Call(utils.ResourceSv1ReleaseResources,
@@ -274,16 +274,12 @@ func testDspResTestAuthKey3(t *testing.T) {
t.Errorf("Resources: %+v", utils.ToJSON(rs))
}
if rs == nil {
t.Errorf("Expecting rs to not be nil")
// rs shoud not be nil so exit function
// to avoid nil segmentation fault;
// if this happens try to run this test manualy
return
t.Fatal("Expecting rs to not be nil")
}
// make sure Resource1 have no more active resources
for _, r := range *rs {
if r.ID == "ResGroup1" &&
(len(r.Usages) != 1 || len(r.TTLIdx) != 0) {
(len(r.Usages) != 0 || len(r.TTLIdx) != 0) {
t.Errorf("Unexpected resource: %+v", utils.ToJSON(r))
}
}
@@ -299,7 +295,7 @@ func testDspResTestAuthKey3(t *testing.T) {
}
// make sure Resource1 have no more active resources
if r.ID == "ResGroup1" &&
(len(r.Usages) != 1 || len(r.TTLIdx) != 0) {
(len(r.Usages) != 0 || len(r.TTLIdx) != 0) {
t.Errorf("Unexpected resource: %+v", utils.ToJSON(r))
}

View File

@@ -146,7 +146,7 @@ func testDspSupGetSupFailover(t *testing.T) {
RouteID: "route1",
RouteParameters: "",
SortingData: map[string]interface{}{
utils.Cost: 0.3166,
utils.Cost: 0.1,
utils.RatingPlanID: "RP_1002_LOW",
utils.Weight: 10.0,
},
@@ -155,7 +155,7 @@ func testDspSupGetSupFailover(t *testing.T) {
RouteID: "route2",
RouteParameters: "",
SortingData: map[string]interface{}{
utils.Cost: 0.6334,
utils.Cost: 0.12,
utils.RatingPlanID: "RP_1002",
utils.Weight: 20.0,
},
@@ -226,7 +226,7 @@ func testDspSupTestAuthKey2(t *testing.T) {
RouteID: "route1",
RouteParameters: "",
SortingData: map[string]interface{}{
utils.Cost: 0.3166,
utils.Cost: 0.1,
utils.RatingPlanID: "RP_1002_LOW",
utils.Weight: 10.0,
},
@@ -235,7 +235,7 @@ func testDspSupTestAuthKey2(t *testing.T) {
RouteID: "route2",
RouteParameters: "",
SortingData: map[string]interface{}{
utils.Cost: 0.6334,
utils.Cost: 0.12,
utils.RatingPlanID: "RP_1002",
utils.Weight: 20.0,
},
@@ -288,7 +288,7 @@ func testDspSupGetSupRoundRobin(t *testing.T) {
RouteID: "route1",
RouteParameters: "",
SortingData: map[string]interface{}{
utils.Cost: 0.3166,
utils.Cost: 0.1,
utils.RatingPlanID: "RP_1002_LOW",
utils.Weight: 10.0,
},
@@ -297,7 +297,7 @@ func testDspSupGetSupRoundRobin(t *testing.T) {
RouteID: "route2",
RouteParameters: "",
SortingData: map[string]interface{}{
utils.Cost: 0.6334,
utils.Cost: 0.12,
utils.RatingPlanID: "RP_1002",
utils.Weight: 20.0,
},
@@ -353,7 +353,7 @@ func testDspSupGetSupplierForEvent(t *testing.T) {
expected := engine.RouteProfile{
Tenant: "cgrates.org",
ID: "ROUTE_ACNT_1002",
FilterIDs: []string{"FLTR_ACNT_1002", "*ai:~*req.AnswerTime:2017-11-27T00:00:00Z"},
FilterIDs: []string{"FLTR_ACNT_1002"},
Sorting: utils.MetaLC,
SortingParameters: []string{},
Routes: []*engine.Route{

File diff suppressed because one or more lines are too long

View File

@@ -20,21 +20,21 @@ results+=($?)
echo "go test github.com/cgrates/cgrates/loaders -tags=integration $@"
go test github.com/cgrates/cgrates/loaders -tags=integration $@
results+=($?)
# echo "go test github.com/cgrates/cgrates/general_tests -tags=integration $@"
# go test github.com/cgrates/cgrates/general_tests -tags=integration $@
# results+=($?)
echo "go test github.com/cgrates/cgrates/general_tests -tags=integration $@"
go test github.com/cgrates/cgrates/general_tests -tags=integration $@
results+=($?)
# echo "go test github.com/cgrates/cgrates/agents -tags=integration $@"
# go test github.com/cgrates/cgrates/agents -tags=integration $@
# results+=($?)
# echo "go test github.com/cgrates/cgrates/sessions -tags=integration $@"
# go test github.com/cgrates/cgrates/sessions -tags=integration $@
# results+=($?)
# echo "go test github.com/cgrates/cgrates/dispatchers -tags=integration $@"
# go test github.com/cgrates/cgrates/dispatchers -tags=integration $@
# results+=($?)
# echo "go test github.com/cgrates/cgrates/registrarc -tags=integration $@"
# go test github.com/cgrates/cgrates/registrarc -tags=integration $@
# results+=($?)
echo "go test github.com/cgrates/cgrates/dispatchers -tags=integration $@"
go test github.com/cgrates/cgrates/dispatchers -tags=integration $@
results+=($?)
echo "go test github.com/cgrates/cgrates/registrarc -tags=integration $@"
go test github.com/cgrates/cgrates/registrarc -tags=integration $@
results+=($?)
echo "go test github.com/cgrates/cgrates/cmd/cgr-loader -tags=integration $@"
go test github.com/cgrates/cgrates/cmd/cgr-loader -tags=integration $@
results+=($?)
@@ -169,12 +169,12 @@ results+=($?)
echo 'go test github.com/cgrates/cgrates/cores -tags=integration'
go test github.com/cgrates/cgrates/cores -tags=integration
results+=($?)
echo 'go test github.com/cgrates/cgrates/migrator -tags=integration'
go test github.com/cgrates/cgrates/migrator -tags=integration
results+=($?)
echo 'go test github.com/cgrates/cgrates/services -tags=integration'
go test github.com/cgrates/cgrates/services -tags=integration
results+=($?)
# echo 'go test github.com/cgrates/cgrates/migrator -tags=integration'
# go test github.com/cgrates/cgrates/migrator -tags=integration
# results+=($?)
# echo 'go test github.com/cgrates/cgrates/services -tags=integration'
# go test github.com/cgrates/cgrates/services -tags=integration
# results+=($?)
pass=1

View File

@@ -20,9 +20,9 @@ package registrarc
import (
"errors"
"flag"
"net/rpc"
"net/rpc/jsonrpc"
"github.com/cgrates/birpc"
"github.com/cgrates/birpc/jsonrpc"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/utils"
)
@@ -34,12 +34,12 @@ var (
dbType = flag.String("dbtype", utils.MetaInternal, "The type of DataBase (Internal/Mongo/mySql)")
)
func newRPCClient(cfg *config.ListenCfg) (c *rpc.Client, err error) {
func newRPCClient(cfg *config.ListenCfg) (c *birpc.Client, err error) {
switch *encoding {
case utils.MetaJSON:
return jsonrpc.Dial(utils.TCP, cfg.RPCJSONListen)
case utils.MetaGOB:
return rpc.Dial(utils.TCP, cfg.RPCGOBListen)
return birpc.Dial(utils.TCP, cfg.RPCGOBListen)
default:
return nil, errors.New("UNSUPPORTED_RPC")
}

View File

@@ -23,12 +23,12 @@ package registrarc
import (
"bytes"
"net/rpc"
"os/exec"
"path"
"testing"
"time"
"github.com/cgrates/birpc"
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
@@ -40,7 +40,7 @@ var (
dspCfgPath string
dspCfg *config.CGRConfig
dspCmd *exec.Cmd
dspRPC *rpc.Client
dspRPC *birpc.Client
allDir string
allCfgPath string
@@ -129,7 +129,7 @@ func testDsphLoadData(t *testing.T) {
func testDsphGetNodeID() (id string, err error) {
var status map[string]interface{}
if err = dspRPC.Call(utils.CoreSv1Status, utils.TenantWithAPIOpts{
if err = dspRPC.Call(context.Background(), utils.CoreSv1Status, utils.TenantWithAPIOpts{
Tenant: "cgrates.org",
APIOpts: map[string]interface{}{},
}, &status); err != nil {

View File

@@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
package registrarc
import (
"net/rpc"
"os/exec"
"path"
"reflect"
@@ -31,9 +30,11 @@ import (
"testing"
"time"
"github.com/cgrates/birpc"
"github.com/cgrates/birpc/context"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
"github.com/cgrates/cgrates/loaders"
"github.com/cgrates/cgrates/utils"
"github.com/cgrates/rpcclient"
)
@@ -46,7 +47,7 @@ var (
rpcsDir string
rpcsCfgPath string
rpcsCfg *config.CGRConfig
rpcsRPC *rpc.Client
rpcsRPC *birpc.Client
rpchTest = []func(t *testing.T){
testRPCInitCfg,
@@ -111,9 +112,12 @@ func testRPCStartEngine(t *testing.T) {
func testRPCLoadData(t *testing.T) {
var reply string
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testit")}
if err := rpcsRPC.Call(utils.APIerSv1LoadTariffPlanFromFolder, attrs, &reply); err != nil {
if err := rpcsRPC.Call(context.Background(), utils.LoaderSv1Run, &loaders.ArgsProcessFolder{
APIOpts: map[string]interface{}{utils.MetaCache: utils.MetaReload},
}, &reply); err != nil {
t.Error(err)
} else if reply != utils.OK {
t.Error("Unexpected reply returned", reply)
}
time.Sleep(100 * time.Millisecond)
}
@@ -128,7 +132,7 @@ func testRPCChargerSNoAttr(t *testing.T) {
}
expErr := utils.NewErrServerError(rpcclient.ErrDisconnected).Error()
var rply []*engine.ChrgSProcessEventReply
if err := rpcsRPC.Call(utils.ChargerSv1ProcessEvent, cgrEv, &rply); err == nil || err.Error() != expErr {
if err := rpcsRPC.Call(context.Background(), utils.ChargerSv1ProcessEvent, cgrEv, &rply); err == nil || err.Error() != expErr {
t.Errorf("Expected error: %s,received: %v", expErr, err)
}
}
@@ -153,54 +157,58 @@ func testRPCChargerSWithAttr(t *testing.T) {
processedEv := []*engine.ChrgSProcessEventReply{
{
ChargerSProfile: "CustomerCharges",
AlteredFields: []string{"*req.RunID"},
AlteredFields: []string{"*opts.*runID"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
Event: map[string]interface{}{
"Account": "1010",
"RunID": "CustomerCharges",
},
APIOpts: map[string]interface{}{
"*processRuns": 1.,
"*subsys": "*chargers",
"*attrProcessRuns": 1.,
"*subsys": "*chargers",
"*runID": "CustomerCharges",
},
},
}, {
ChargerSProfile: "Raw",
AttributeSProfiles: []string{"*constant:*req.RequestType:*none"},
AlteredFields: []string{"*req.RunID", "*req.RequestType"},
AlteredFields: []string{"*opts.*runID", "*req.RequestType"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
Event: map[string]interface{}{
"Account": "1010",
"RequestType": "*none",
"RunID": "raw",
},
APIOpts: map[string]interface{}{
"*processRuns": 1.,
"*subsys": "*chargers",
"*attrProcessRuns": 1.,
"*subsys": "*chargers",
"*runID": "raw",
"*attrProfileIDs": []interface{}{"*constant:*req.RequestType:*none"},
"*context": "*chargers",
},
},
}, {
ChargerSProfile: "SupplierCharges",
AttributeSProfiles: []string{"cgrates.org:ATTR_SUPPLIER1"},
AlteredFields: []string{"*req.RunID", "*req.Subject"},
AlteredFields: []string{"*opts.*runID", "*req.Subject"},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
Event: map[string]interface{}{
"Account": "1010",
"RunID": "SupplierCharges",
"Subject": "SUPPLIER1",
},
APIOpts: map[string]interface{}{
"*processRuns": 1.,
"*subsys": "*chargers",
"*attrProcessRuns": 1.,
"*subsys": "*chargers",
"*runID": "SupplierCharges",
"*attrProfileIDs": []interface{}{"ATTR_SUPPLIER1"},
"*context": "*chargers",
},
},
},
}
var rply []*engine.ChrgSProcessEventReply
if err := rpcsRPC.Call(utils.ChargerSv1ProcessEvent, cgrEv, &rply); err != nil {
if err := rpcsRPC.Call(context.Background(), utils.ChargerSv1ProcessEvent, cgrEv, &rply); err != nil {
t.Fatal(err)
}
sort.Slice(rply, func(i, j int) bool {