mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Refactoring of IT Tests
This commit is contained in:
@@ -53,7 +53,6 @@ var dmtClient *DiameterClient
|
||||
var rplyTimeout time.Duration
|
||||
|
||||
func TestDmtAgentInitCfg(t *testing.T) {
|
||||
|
||||
daCfgPath = path.Join(*dataDir, "conf", "samples", "dmtagent")
|
||||
// Init config first
|
||||
var err error
|
||||
@@ -68,7 +67,6 @@ func TestDmtAgentInitCfg(t *testing.T) {
|
||||
|
||||
// Remove data in both rating and accounting db
|
||||
func TestDmtAgentResetDataDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitDataDb(daCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -76,7 +74,6 @@ func TestDmtAgentResetDataDb(t *testing.T) {
|
||||
|
||||
// Wipe out the cdr database
|
||||
func TestDmtAgentResetStorDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitStorDb(daCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -84,14 +81,12 @@ func TestDmtAgentResetStorDb(t *testing.T) {
|
||||
|
||||
// Start CGR Engine
|
||||
func TestDmtAgentStartEngine(t *testing.T) {
|
||||
|
||||
if _, err := engine.StopStartEngine(daCfgPath, 4000); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDmtAgentCCRAsSMGenericEvent(t *testing.T) {
|
||||
|
||||
cfgDefaults, _ := config.NewDefaultCGRConfig()
|
||||
loadDictionaries(cfgDefaults.DiameterAgentCfg().DictionariesDir, "UNIT_TEST")
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond)
|
||||
@@ -151,7 +146,6 @@ func TestDmtAgentCCRAsSMGenericEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDmtAgentPopulateCCTotalOctets(t *testing.T) {
|
||||
|
||||
daRP := &config.DARequestProcessor{CCAFields: []*config.CfgCdrField{
|
||||
&config.CfgCdrField{Tag: "GrantedUnit", FieldFilter: utils.ParseRSRFieldsMustCompile("CGRError(^$)", utils.INFIELD_SEP),
|
||||
FieldId: "Multiple-Services-Credit-Control>Granted-Service-Unit>CC-Time", Type: utils.META_COMPOSED, Value: utils.ParseRSRFieldsMustCompile("CGRMaxUsage", utils.INFIELD_SEP), Mandatory: true},
|
||||
@@ -182,7 +176,6 @@ func TestDmtAgentPopulateCCTotalOctets(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestDmtAgentApierRpcConn(t *testing.T) {
|
||||
|
||||
var err error
|
||||
apierRpc, err = jsonrpc.Dial("tcp", daCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -192,7 +185,6 @@ func TestDmtAgentApierRpcConn(t *testing.T) {
|
||||
|
||||
// Load the tariff plan, creating accounts and their balances
|
||||
func TestDmtAgentTPFromFolder(t *testing.T) {
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")}
|
||||
var loadInst utils.LoadInstance
|
||||
if err := apierRpc.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &loadInst); err != nil {
|
||||
@@ -202,7 +194,6 @@ func TestDmtAgentTPFromFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConnectDiameterClient(t *testing.T) {
|
||||
|
||||
dmtClient, err = NewDiameterClient(daCfg.DiameterAgentCfg().Listen, "UNIT_TEST", daCfg.DiameterAgentCfg().OriginRealm,
|
||||
daCfg.DiameterAgentCfg().VendorId, daCfg.DiameterAgentCfg().ProductName, utils.DIAMETER_FIRMWARE_REVISION, daCfg.DiameterAgentCfg().DictionariesDir)
|
||||
if err != nil {
|
||||
@@ -212,7 +203,6 @@ func TestConnectDiameterClient(t *testing.T) {
|
||||
|
||||
// cgr-console 'cost Category="call" Tenant="cgrates.org" Subject="1001" Destination="1004" TimeStart="2015-11-07T08:42:26Z" TimeEnd="2015-11-07T08:47:26Z"'
|
||||
func TestDmtAgentSendCCRInit(t *testing.T) {
|
||||
|
||||
cdr := &engine.CDR{CGRID: utils.Sha1("testccr1", time.Date(2015, 11, 7, 8, 42, 20, 0, time.UTC).String()), OrderID: 123, ToR: utils.VOICE,
|
||||
OriginID: "testccr1", OriginHost: "192.168.1.1", Source: utils.UNIT_TEST, RequestType: utils.META_RATED, Direction: "*out",
|
||||
Tenant: "cgrates.org", Category: "call", Account: "1001", Subject: "1001", Destination: "1004", Supplier: "SUPPL1",
|
||||
@@ -254,7 +244,6 @@ func TestDmtAgentSendCCRInit(t *testing.T) {
|
||||
|
||||
// cgr-console 'cost Category="call" Tenant="cgrates.org" Subject="1001" Destination="1004" TimeStart="2015-11-07T08:42:26Z" TimeEnd="2015-11-07T08:52:26Z"'
|
||||
func TestDmtAgentSendCCRUpdate(t *testing.T) {
|
||||
|
||||
cdr := &engine.CDR{CGRID: utils.Sha1("testccr1", time.Date(2015, 11, 7, 8, 42, 20, 0, time.UTC).String()), OrderID: 123, ToR: utils.VOICE,
|
||||
OriginID: "testccr1", OriginHost: "192.168.1.1", Source: utils.UNIT_TEST, RequestType: utils.META_RATED, Direction: "*out",
|
||||
Tenant: "cgrates.org", Category: "call", Account: "1001", Subject: "1001", Destination: "1004", Supplier: "SUPPL1",
|
||||
@@ -291,7 +280,6 @@ func TestDmtAgentSendCCRUpdate(t *testing.T) {
|
||||
|
||||
// cgr-console 'cost Category="call" Tenant="cgrates.org" Subject="1001" Destination="1004" TimeStart="2015-11-07T08:42:26Z" TimeEnd="2015-11-07T08:57:26Z"'
|
||||
func TestDmtAgentSendCCRUpdate2(t *testing.T) {
|
||||
|
||||
cdr := &engine.CDR{CGRID: utils.Sha1("testccr1", time.Date(2015, 11, 7, 8, 42, 20, 0, time.UTC).String()), OrderID: 123, ToR: utils.VOICE,
|
||||
OriginID: "testccr1", OriginHost: "192.168.1.1", Source: utils.UNIT_TEST, RequestType: utils.META_RATED, Direction: "*out",
|
||||
Tenant: "cgrates.org", Category: "call", Account: "1001", Subject: "1001", Destination: "1004", Supplier: "SUPPL1",
|
||||
@@ -327,7 +315,6 @@ func TestDmtAgentSendCCRUpdate2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDmtAgentSendCCRTerminate(t *testing.T) {
|
||||
|
||||
cdr := &engine.CDR{CGRID: utils.Sha1("testccr1", time.Date(2015, 11, 7, 8, 42, 20, 0, time.UTC).String()), OrderID: 123, ToR: utils.VOICE,
|
||||
OriginID: "testccr1", OriginHost: "192.168.1.1", Source: utils.UNIT_TEST, RequestType: utils.META_RATED, Direction: "*out",
|
||||
Tenant: "cgrates.org", Category: "call", Account: "1001", Subject: "1001", Destination: "1004", Supplier: "SUPPL1",
|
||||
@@ -366,7 +353,6 @@ func TestDmtAgentSendCCRTerminate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDmtAgentSendCCRSMS(t *testing.T) {
|
||||
|
||||
ccr := diam.NewRequest(diam.CreditControl, 4, nil)
|
||||
ccr.NewAVP(avp.SessionID, avp.Mbit, 0, datatype.UTF8String("testccr2"))
|
||||
ccr.NewAVP(avp.OriginHost, avp.Mbit, 0, datatype.DiameterIdentity("CGR-DA"))
|
||||
@@ -457,7 +443,6 @@ func TestDmtAgentSendCCRSMS(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDmtAgentSendCCRSMSWrongAccount(t *testing.T) {
|
||||
|
||||
ccr := diam.NewRequest(diam.CreditControl, 4, nil)
|
||||
ccr.NewAVP(avp.SessionID, avp.Mbit, 0, datatype.UTF8String("testccr3"))
|
||||
ccr.NewAVP(avp.OriginHost, avp.Mbit, 0, datatype.DiameterIdentity("CGR-DA"))
|
||||
@@ -524,7 +509,6 @@ func TestDmtAgentSendCCRSMSWrongAccount(t *testing.T) {
|
||||
|
||||
// cgr-console 'cost Category="call" Tenant="cgrates.org" Subject="1001" Destination="1004" TimeStart="2015-11-07T08:42:26Z" TimeEnd="2015-11-07T08:47:26Z"'
|
||||
func TestDmtAgentSendCCRInitWrongAccount(t *testing.T) {
|
||||
|
||||
cdr := &engine.CDR{CGRID: utils.Sha1("testccr4", time.Date(2015, 11, 7, 8, 42, 20, 0, time.UTC).String()), OrderID: 123, ToR: utils.VOICE,
|
||||
OriginID: "testccr4", OriginHost: "192.168.1.1", Source: utils.UNIT_TEST, RequestType: utils.META_RATED, Direction: "*out",
|
||||
Tenant: "cgrates.org", Category: "call", Account: "non_existent", Subject: "non_existent", Destination: "1004", Supplier: "SUPPL1",
|
||||
@@ -555,7 +539,6 @@ func TestDmtAgentSendCCRInitWrongAccount(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDmtAgentSendCCRSimpaEvent(t *testing.T) {
|
||||
|
||||
ccr := diam.NewRequest(diam.CreditControl, 4, nil)
|
||||
ccr.NewAVP(avp.SessionID, avp.Mbit, 0, datatype.UTF8String("testccr5"))
|
||||
ccr.NewAVP(avp.OriginHost, avp.Mbit, 0, datatype.DiameterIdentity("CGR-DA"))
|
||||
@@ -628,7 +611,6 @@ func TestDmtAgentSendCCRSimpaEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDmtAgentCdrs(t *testing.T) {
|
||||
|
||||
var cdrs []*engine.ExternalCDR
|
||||
req := utils.RPCCDRsFilter{RunIDs: []string{utils.META_DEFAULT}, ToRs: []string{utils.VOICE}}
|
||||
if err := apierRpc.Call("ApierV2.GetCdrs", req, &cdrs); err != nil {
|
||||
@@ -646,7 +628,6 @@ func TestDmtAgentCdrs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDmtAgentSendDataGrpInit(t *testing.T) {
|
||||
|
||||
ccr := diam.NewRequest(diam.CreditControl, 4, nil)
|
||||
ccr.NewAVP(avp.SessionID, avp.Mbit, 0, datatype.UTF8String("testdatagrp"))
|
||||
ccr.NewAVP(avp.OriginHost, avp.Mbit, 0, datatype.DiameterIdentity("CGR-DA"))
|
||||
@@ -712,7 +693,6 @@ func TestDmtAgentSendDataGrpInit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDmtAgentSendDataGrpUpdate(t *testing.T) {
|
||||
|
||||
ccr := diam.NewRequest(diam.CreditControl, 4, nil)
|
||||
ccr.NewAVP(avp.SessionID, avp.Mbit, 0, datatype.UTF8String("testdatagrp"))
|
||||
ccr.NewAVP(avp.OriginHost, avp.Mbit, 0, datatype.DiameterIdentity("CGR-DA"))
|
||||
@@ -804,7 +784,6 @@ func TestDmtAgentSendDataGrpUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDmtAgentSendDataGrpTerminate(t *testing.T) {
|
||||
|
||||
ccr := diam.NewRequest(diam.CreditControl, 4, nil)
|
||||
ccr.NewAVP(avp.SessionID, avp.Mbit, 0, datatype.UTF8String("testdatagrp"))
|
||||
ccr.NewAVP(avp.OriginHost, avp.Mbit, 0, datatype.DiameterIdentity("CGR-DA"))
|
||||
@@ -882,7 +861,6 @@ func TestDmtAgentSendDataGrpTerminate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDmtAgentSendDataGrpCDRs(t *testing.T) {
|
||||
|
||||
var cdrs []*engine.ExternalCDR
|
||||
req := utils.RPCCDRsFilter{CGRIDs: []string{utils.Sha1("testdatagrp")}}
|
||||
if err := apierRpc.Call("ApierV2.GetCdrs", req, &cdrs); err != nil {
|
||||
@@ -894,7 +872,6 @@ func TestDmtAgentSendDataGrpCDRs(t *testing.T) {
|
||||
|
||||
/*
|
||||
func TestDmtAgentDryRun1(t *testing.T) {
|
||||
|
||||
ccr := diam.NewRequest(diam.CreditControl, 4, nil)
|
||||
ccr.NewAVP(avp.SessionID, avp.Mbit, 0, datatype.UTF8String("cgrates;1451911932;00082"))
|
||||
ccr.NewAVP(avp.OriginHost, avp.Mbit, 0, datatype.DiameterIdentity("CGR-DA"))
|
||||
@@ -926,7 +903,6 @@ func TestDmtAgentDryRun1(t *testing.T) {
|
||||
*/
|
||||
|
||||
func TestDmtAgentDryRun1(t *testing.T) {
|
||||
|
||||
ccr := diam.NewRequest(diam.CreditControl, 4, nil)
|
||||
ccr.NewAVP(avp.SessionID, avp.Mbit, 0, datatype.UTF8String("cgrates;1451911932;00082"))
|
||||
ccr.NewAVP(avp.OriginHost, avp.Mbit, 0, datatype.DiameterIdentity("CGR-DA"))
|
||||
@@ -1002,7 +978,6 @@ func TestDmtAgentDryRun1(t *testing.T) {
|
||||
|
||||
/*
|
||||
func TestDmtAgentLoadCER(t *testing.T) {
|
||||
|
||||
m := diam.NewRequest(diam.CapabilitiesExchange, 4, dict.Default)
|
||||
m.NewAVP(avp.OriginHost, avp.Mbit, 0, datatype.DiameterIdentity("CGR-DA"))
|
||||
m.NewAVP(avp.OriginRealm, avp.Mbit, 0, datatype.DiameterIdentity("cgrates.org"))
|
||||
@@ -1024,7 +999,6 @@ func TestDmtAgentLoadCER(t *testing.T) {
|
||||
*/
|
||||
|
||||
func TestDmtAgentStopEngine(t *testing.T) {
|
||||
|
||||
if err := engine.KillEngine(*waitRater); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import (
|
||||
var cgrRater1Cmd, cgrSmg1Cmd *exec.Cmd
|
||||
|
||||
func TestHaPoolInitCfg(t *testing.T) {
|
||||
|
||||
daCfgPath = path.Join(*dataDir, "conf", "samples", "hapool", "cgrrater1")
|
||||
// Init config first
|
||||
var err error
|
||||
@@ -57,7 +56,6 @@ func TestHaPoolResetStorDb(t *testing.T) {
|
||||
|
||||
// Start CGR Engine
|
||||
func TestHaPoolStartEngine(t *testing.T) {
|
||||
|
||||
engine.KillEngine(*waitRater) // just to make sure
|
||||
var err error
|
||||
cgrRater1 := path.Join(*dataDir, "conf", "samples", "hapool", "cgrrater1")
|
||||
|
||||
@@ -65,7 +65,6 @@ var storDbType = flag.String("stordb_type", "mysql", "The type of the storDb dat
|
||||
var waitRater = flag.Int("wait_rater", 500, "Number of miliseconds to wait for rater to start and cache")
|
||||
|
||||
func TestApierLoadConfig(t *testing.T) {
|
||||
|
||||
var err error
|
||||
cfgPath = path.Join(*dataDir, "conf", "samples", "apier")
|
||||
if cfg, err = config.NewCGRConfigFromFolder(cfgPath); err != nil {
|
||||
@@ -74,7 +73,6 @@ func TestApierLoadConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierCreateDirs(t *testing.T) {
|
||||
|
||||
for _, pathDir := range []string{cfg.CdreProfiles[utils.META_DEFAULT].ExportDirectory, "/var/log/cgrates/cdrc/in", "/var/log/cgrates/cdrc/out", cfg.HistoryDir} {
|
||||
|
||||
if err := os.RemoveAll(pathDir); err != nil {
|
||||
@@ -87,7 +85,6 @@ func TestApierCreateDirs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierInitDataDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitDataDb(cfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -95,7 +92,6 @@ func TestApierInitDataDb(t *testing.T) {
|
||||
|
||||
// Empty tables before using them
|
||||
func TestApierInitStorDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitStorDb(cfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -103,7 +99,6 @@ func TestApierInitStorDb(t *testing.T) {
|
||||
|
||||
// Finds cgr-engine executable and starts it with default configuration
|
||||
func TestApierStartEngine(t *testing.T) {
|
||||
|
||||
enginePath, err := exec.LookPath("cgr-engine")
|
||||
if err != nil {
|
||||
t.Fatal("Cannot find cgr-engine executable")
|
||||
@@ -130,7 +125,6 @@ func TestApierRpcConn(t *testing.T) {
|
||||
|
||||
// Test here TPTiming APIs
|
||||
func TestApierTPTiming(t *testing.T) {
|
||||
|
||||
// ALWAYS,*any,*any,*any,*any,00:00:00
|
||||
tmAlways := &utils.ApierTPTiming{TPid: utils.TEST_SQL,
|
||||
TimingId: "ALWAYS",
|
||||
@@ -196,7 +190,6 @@ func TestApierTPTiming(t *testing.T) {
|
||||
|
||||
// Test here TPTiming APIs
|
||||
func TestApierTPDestination(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
dstDe := &utils.V1TPDestination{TPid: utils.TEST_SQL, DestinationId: "GERMANY", Prefixes: []string{"+49"}}
|
||||
dstDeMobile := &utils.V1TPDestination{TPid: utils.TEST_SQL, DestinationId: "GERMANY_MOBILE", Prefixes: []string{"+4915", "+4916", "+4917"}}
|
||||
@@ -248,7 +241,6 @@ func TestApierTPDestination(t *testing.T) {
|
||||
|
||||
// Test here TPRate APIs
|
||||
func TestApierTPRate(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
rt := &utils.TPRate{TPid: utils.TEST_SQL, RateId: "RT_FS_USERS", RateSlots: []*utils.RateSlot{
|
||||
&utils.RateSlot{ConnectFee: 0, Rate: 0, RateUnit: "60s", RateIncrement: "60s", GroupIntervalStart: "0s"},
|
||||
@@ -300,7 +292,6 @@ func TestApierTPRate(t *testing.T) {
|
||||
|
||||
// Test here TPDestinationRate APIs
|
||||
func TestApierTPDestinationRate(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
dr := &utils.TPDestinationRate{TPid: utils.TEST_SQL, DestinationRateId: "DR_FREESWITCH_USERS", DestinationRates: []*utils.DestinationRate{
|
||||
&utils.DestinationRate{DestinationId: "FS_USERS", RateId: "RT_FS_USERS", RoundingMethod: "*up", RoundingDecimals: 2},
|
||||
@@ -355,7 +346,6 @@ func TestApierTPDestinationRate(t *testing.T) {
|
||||
|
||||
// Test here TPRatingPlan APIs
|
||||
func TestApierTPRatingPlan(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
rp := &utils.TPRatingPlan{TPid: utils.TEST_SQL, RatingPlanId: "RETAIL1", RatingPlanBindings: []*utils.TPRatingPlanBinding{
|
||||
&utils.TPRatingPlanBinding{DestinationRatesId: "DR_FREESWITCH_USERS", TimingId: "ALWAYS", Weight: 10},
|
||||
@@ -407,7 +397,6 @@ func TestApierTPRatingPlan(t *testing.T) {
|
||||
|
||||
// Test here TPRatingPlan APIs
|
||||
func TestApierTPRatingProfile(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
rpf := &utils.TPRatingProfile{TPid: utils.TEST_SQL, LoadId: utils.TEST_SQL, Tenant: "cgrates.org", Category: "call", Direction: "*out", Subject: "*any",
|
||||
RatingPlanActivations: []*utils.TPRatingActivation{
|
||||
@@ -459,7 +448,6 @@ func TestApierTPRatingProfile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierTPActions(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
act := &utils.TPActions{TPid: utils.TEST_SQL, ActionsId: "PREPAID_10", Actions: []*utils.TPAction{
|
||||
&utils.TPAction{Identifier: "*topup_reset", BalanceType: "*monetary", Directions: "*out", Units: "10", ExpiryTime: "*unlimited",
|
||||
@@ -517,7 +505,6 @@ func TestApierTPActions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierTPActionPlan(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
at := &utils.TPActionPlan{TPid: utils.TEST_SQL, ActionPlanId: "PREPAID_10", ActionPlan: []*utils.TPActionTiming{
|
||||
&utils.TPActionTiming{ActionsId: "PREPAID_10", TimingId: "ASAP", Weight: 10},
|
||||
@@ -568,7 +555,6 @@ func TestApierTPActionPlan(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierTPActionTriggers(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
at := &utils.TPActionTriggers{TPid: utils.TEST_SQL, ActionTriggersId: "STANDARD_TRIGGERS", ActionTriggers: []*utils.TPActionTrigger{
|
||||
&utils.TPActionTrigger{Id: "STANDARD_TRIGGERS", UniqueID: "MYFIRSTTRIGGER", BalanceType: "*monetary", BalanceDirections: "*out", ThresholdType: "*min_balance", ThresholdValue: 2, ActionsId: "LOG_BALANCE", Weight: 10},
|
||||
@@ -621,7 +607,6 @@ func TestApierTPActionTriggers(t *testing.T) {
|
||||
|
||||
// Test here TPAccountActions APIs
|
||||
func TestApierTPAccountActions(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
aa1 := &utils.TPAccountActions{TPid: utils.TEST_SQL, LoadId: utils.TEST_SQL, Tenant: "cgrates.org",
|
||||
Account: "1001", ActionPlanId: "PREPAID_10", ActionTriggersId: "STANDARD_TRIGGERS"}
|
||||
@@ -680,7 +665,6 @@ func TestApierTPAccountActions(t *testing.T) {
|
||||
|
||||
// Test here LoadRatingPlan
|
||||
func TestApierLoadRatingPlan(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
if err := rater.Call("ApierV1.LoadRatingPlan", AttrLoadRatingPlan{TPid: utils.TEST_SQL, RatingPlanId: "RETAIL1"}, &reply); err != nil {
|
||||
t.Error("Got error on ApierV1.LoadRatingPlan: ", err.Error())
|
||||
@@ -691,7 +675,6 @@ func TestApierLoadRatingPlan(t *testing.T) {
|
||||
|
||||
// Test here SetRatingProfile
|
||||
func TestApierSetRatingProfile(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
rpa := &utils.TPRatingActivation{ActivationTime: "2012-01-01T00:00:00Z", RatingPlanId: "RETAIL1", FallbackSubjects: "dan2"}
|
||||
rpf := &AttrSetRatingProfile{Tenant: "cgrates.org", Category: "call", Direction: "*out", Subject: "dan", RatingPlanActivations: []*utils.TPRatingActivation{rpa}}
|
||||
@@ -730,7 +713,6 @@ func TestApierSetRatingProfile(t *testing.T) {
|
||||
|
||||
// Test here LoadRatingProfile
|
||||
func TestApierLoadRatingProfile(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
rpf := &utils.TPRatingProfile{TPid: utils.TEST_SQL, LoadId: utils.TEST_SQL, Tenant: "cgrates.org", Category: "call", Direction: "*out", Subject: "*any"}
|
||||
if err := rater.Call("ApierV1.LoadRatingProfile", rpf, &reply); err != nil {
|
||||
@@ -742,7 +724,6 @@ func TestApierLoadRatingProfile(t *testing.T) {
|
||||
|
||||
// Test here LoadAccountActions
|
||||
func TestApierLoadAccountActions(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
aa1 := &utils.TPAccountActions{TPid: utils.TEST_SQL, LoadId: utils.TEST_SQL, Tenant: "cgrates.org", Account: "1001"}
|
||||
if err := rater.Call("ApierV1.LoadAccountActions", aa1, &reply); err != nil {
|
||||
@@ -754,7 +735,6 @@ func TestApierLoadAccountActions(t *testing.T) {
|
||||
|
||||
// Test here ReloadScheduler
|
||||
func TestApierReloadScheduler(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
// Simple test that command is executed without errors
|
||||
if err := rater.Call("ApierV1.ReloadScheduler", reply, &reply); err != nil {
|
||||
@@ -766,7 +746,6 @@ func TestApierReloadScheduler(t *testing.T) {
|
||||
|
||||
// Test here ReloadCache
|
||||
func TestApierReloadCache(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
arc := new(utils.AttrReloadCache)
|
||||
// Simple test that command is executed without errors
|
||||
@@ -778,7 +757,6 @@ func TestApierReloadCache(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierGetCacheStats(t *testing.T) {
|
||||
|
||||
var rcvStats *utils.CacheStats
|
||||
var args utils.AttrCacheStats
|
||||
err := rater.Call("ApierV1.GetCacheStats", args, &rcvStats)
|
||||
@@ -792,7 +770,6 @@ func TestApierGetCacheStats(t *testing.T) {
|
||||
|
||||
// Test here GetDestination
|
||||
func TestApierGetDestination(t *testing.T) {
|
||||
|
||||
reply := new(engine.Destination)
|
||||
dstId := "GERMANY_MOBILE"
|
||||
expectedReply := &engine.Destination{Id: dstId, Prefixes: []string{"+4915", "+4916", "+4917"}}
|
||||
@@ -805,7 +782,6 @@ func TestApierGetDestination(t *testing.T) {
|
||||
|
||||
// Test here GetRatingPlan
|
||||
func TestApierGetRatingPlan(t *testing.T) {
|
||||
|
||||
reply := new(engine.RatingPlan)
|
||||
rplnId := "RETAIL1"
|
||||
if err := rater.Call("ApierV1.GetRatingPlan", rplnId, reply); err != nil {
|
||||
@@ -832,7 +808,6 @@ func TestApierGetRatingPlan(t *testing.T) {
|
||||
|
||||
// Test here AddBalance
|
||||
func TestApierAddBalance(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
attrs := &AttrAddBalance{Tenant: "cgrates.org", Account: "1001", BalanceType: "*monetary", Value: 1.5}
|
||||
if err := rater.Call("ApierV1.AddBalance", attrs, &reply); err != nil {
|
||||
@@ -881,7 +856,6 @@ func TestApierAddBalance(t *testing.T) {
|
||||
|
||||
// Test here ExecuteAction
|
||||
func TestApierExecuteAction(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
// Add balance to a previously known account
|
||||
attrs := utils.AttrExecuteAction{Tenant: "cgrates.org", Account: "dan2", ActionsId: "PREPAID_10"}
|
||||
@@ -899,7 +873,6 @@ func TestApierExecuteAction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierSetActions(t *testing.T) {
|
||||
|
||||
act1 := &V1TPAction{Identifier: engine.TOPUP_RESET, BalanceType: utils.MONETARY, Directions: utils.OUT, Units: 75.0, ExpiryTime: engine.UNLIMITED, Weight: 20.0}
|
||||
attrs1 := &V1AttrSetActions{ActionsId: "ACTS_1", Actions: []*V1TPAction{act1}}
|
||||
reply1 := ""
|
||||
@@ -915,7 +888,6 @@ func TestApierSetActions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierGetActions(t *testing.T) {
|
||||
|
||||
expectActs := []*utils.TPAction{
|
||||
&utils.TPAction{Identifier: engine.TOPUP_RESET, BalanceType: utils.MONETARY, Directions: utils.OUT, Units: "75", BalanceWeight: "0", BalanceBlocker: "false", BalanceDisabled: "false", ExpiryTime: engine.UNLIMITED, Weight: 20.0}}
|
||||
|
||||
@@ -928,7 +900,6 @@ func TestApierGetActions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierSetActionPlan(t *testing.T) {
|
||||
|
||||
atm1 := &AttrActionPlan{ActionsId: "ACTS_1", MonthDays: "1", Time: "00:00:00", Weight: 20.0}
|
||||
atms1 := &AttrSetActionPlan{Id: "ATMS_1", ActionPlan: []*AttrActionPlan{atm1}}
|
||||
reply1 := ""
|
||||
@@ -945,7 +916,6 @@ func TestApierSetActionPlan(t *testing.T) {
|
||||
|
||||
// Test here AddTriggeredAction
|
||||
func TestApierAddTriggeredAction(t *testing.T) {
|
||||
|
||||
var reply string
|
||||
attrs := &AttrAddBalance{Tenant: "cgrates.org", Account: "dan32", BalanceType: "*monetary", Value: 1.5}
|
||||
if err := rater.Call("ApierV1.AddBalance", attrs, &reply); err != nil {
|
||||
@@ -973,7 +943,6 @@ func TestApierAddTriggeredAction(t *testing.T) {
|
||||
|
||||
// Test here GetAccountActionTriggers
|
||||
func TestApierGetAccountActionTriggers(t *testing.T) {
|
||||
|
||||
var reply engine.ActionTriggers
|
||||
req := AttrAcntAction{Tenant: "cgrates.org", Account: "dan32"}
|
||||
if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil {
|
||||
@@ -984,7 +953,6 @@ func TestApierGetAccountActionTriggers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierAddTriggeredAction2(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
// Add balance to a previously known account
|
||||
attrs := &AttrAddAccountActionTriggers{ActionTriggerIDs: &[]string{"STANDARD_TRIGGERS"}, Tenant: "cgrates.org", Account: "dan2"}
|
||||
@@ -1005,7 +973,6 @@ func TestApierAddTriggeredAction2(t *testing.T) {
|
||||
|
||||
// Test here GetAccountActionTriggers
|
||||
func TestApierGetAccountActionTriggers2(t *testing.T) {
|
||||
|
||||
var reply engine.ActionTriggers
|
||||
req := AttrAcntAction{Tenant: "cgrates.org", Account: "dan2"}
|
||||
if err := rater.Call("ApierV1.GetAccountActionTriggers", req, &reply); err != nil {
|
||||
@@ -1017,7 +984,6 @@ func TestApierGetAccountActionTriggers2(t *testing.T) {
|
||||
|
||||
// Test here SetAccountActionTriggers
|
||||
func TestApierSetAccountActionTriggers(t *testing.T) {
|
||||
|
||||
// Test first get so we can steal the id which we need to remove
|
||||
var reply engine.ActionTriggers
|
||||
req := AttrAcntAction{Tenant: "cgrates.org", Account: "dan2"}
|
||||
@@ -1050,7 +1016,6 @@ func TestApierSetAccountActionTriggers(t *testing.T) {
|
||||
|
||||
// Test here RemAccountActionTriggers
|
||||
func TestApierRemAccountActionTriggers(t *testing.T) {
|
||||
|
||||
// Test first get so we can steal the id which we need to remove
|
||||
var reply engine.ActionTriggers
|
||||
req := AttrAcntAction{Tenant: "cgrates.org", Account: "dan2"}
|
||||
@@ -1083,7 +1048,6 @@ func TestApierRemAccountActionTriggers(t *testing.T) {
|
||||
|
||||
// Test here SetAccount
|
||||
func TestApierSetAccount(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
attrs := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "dan7", ActionPlanId: "ATMS_1", ReloadScheduler: true}
|
||||
if err := rater.Call("ApierV1.SetAccount", attrs, &reply); err != nil {
|
||||
@@ -1103,7 +1067,6 @@ func TestApierSetAccount(t *testing.T) {
|
||||
|
||||
// Test here GetAccountActionTimings
|
||||
func TestApierGetAccountActionPlan(t *testing.T) {
|
||||
|
||||
var reply []*AccountActionTiming
|
||||
req := AttrAcntAction{Tenant: "cgrates.org", Account: "dan7"}
|
||||
if err := rater.Call("ApierV1.GetAccountActionPlan", req, &reply); err != nil {
|
||||
@@ -1119,7 +1082,6 @@ func TestApierGetAccountActionPlan(t *testing.T) {
|
||||
|
||||
// Test here RemoveActionTiming
|
||||
func TestApierRemUniqueIDActionTiming(t *testing.T) {
|
||||
|
||||
var rmReply string
|
||||
rmReq := AttrRemActionTiming{ActionPlanId: "ATMS_1", Tenant: "cgrates.org", Account: "dan4"}
|
||||
if err := rater.Call("ApierV1.RemActionTiming", rmReq, &rmReply); err != nil {
|
||||
@@ -1138,7 +1100,6 @@ func TestApierRemUniqueIDActionTiming(t *testing.T) {
|
||||
|
||||
// Test here GetAccount
|
||||
func TestApierGetAccount(t *testing.T) {
|
||||
|
||||
var reply *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
if err := rater.Call("ApierV2.GetAccount", attrs, &reply); err != nil {
|
||||
@@ -1175,7 +1136,6 @@ func TestApierGetAccount(t *testing.T) {
|
||||
|
||||
// Start with initial balance, top-up to test max_balance
|
||||
func TestApierTriggersExecute(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
attrs := &utils.AttrSetAccount{Tenant: "cgrates.org", Account: "dan8", ReloadScheduler: true}
|
||||
if err := rater.Call("ApierV1.SetAccount", attrs, &reply); err != nil {
|
||||
@@ -1193,7 +1153,6 @@ func TestApierTriggersExecute(t *testing.T) {
|
||||
|
||||
// Start fresh before loading from folder
|
||||
func TestApierResetDataBeforeLoadFromFolder(t *testing.T) {
|
||||
|
||||
TestApierInitDataDb(t)
|
||||
reply := ""
|
||||
arc := new(utils.AttrReloadCache)
|
||||
@@ -1216,7 +1175,6 @@ func TestApierResetDataBeforeLoadFromFolder(t *testing.T) {
|
||||
|
||||
// Test here LoadTariffPlanFromFolder
|
||||
func TestApierLoadTariffPlanFromFolder(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: ""}
|
||||
if err := rater.Call("ApierV1.LoadTariffPlanFromFolder", attrs, &reply); err == nil || !strings.HasPrefix(err.Error(), utils.ErrMandatoryIeMissing.Error()) {
|
||||
@@ -1237,7 +1195,6 @@ func TestApierLoadTariffPlanFromFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierResetDataAfterLoadFromFolder(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
arc := new(utils.AttrReloadCache)
|
||||
// Simple test that command is executed without errors
|
||||
@@ -1264,7 +1221,6 @@ func TestApierResetDataAfterLoadFromFolder(t *testing.T) {
|
||||
// Make sure balance was topped-up
|
||||
// Bug reported by DigiDaz over IRC
|
||||
func TestApierGetAccountAfterLoad(t *testing.T) {
|
||||
|
||||
var reply *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
if err := rater.Call("ApierV2.GetAccount", attrs, &reply); err != nil {
|
||||
@@ -1276,7 +1232,6 @@ func TestApierGetAccountAfterLoad(t *testing.T) {
|
||||
|
||||
// Test here ResponderGetCost
|
||||
func TestApierResponderGetCost(t *testing.T) {
|
||||
|
||||
tStart, _ := utils.ParseDate("2013-08-07T17:30:00Z")
|
||||
tEnd, _ := utils.ParseDate("2013-08-07T17:31:30Z")
|
||||
cd := engine.CallDescriptor{
|
||||
@@ -1301,7 +1256,6 @@ func TestApierResponderGetCost(t *testing.T) {
|
||||
|
||||
// Test here ResponderGetCost
|
||||
func TestApierGetCallCostLog(t *testing.T) {
|
||||
|
||||
var cc engine.CallCost
|
||||
var attrs utils.AttrGetCallCost
|
||||
// Simple test that command is executed without errors
|
||||
@@ -1338,7 +1292,6 @@ func TestApierMaxDebitInexistentAcnt(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierCdrServer(t *testing.T) {
|
||||
|
||||
httpClient := new(http.Client)
|
||||
cdrForm1 := url.Values{utils.ACCID: []string{"dsafdsaf"}, utils.CDRHOST: []string{"192.168.1.1"}, utils.REQTYPE: []string{utils.META_RATED}, utils.DIRECTION: []string{"*out"},
|
||||
utils.TENANT: []string{"cgrates.org"}, utils.CATEGORY: []string{"call"}, utils.ACCOUNT: []string{"1001"}, utils.SUBJECT: []string{"1001"}, utils.DESTINATION: []string{"1002"},
|
||||
@@ -1359,7 +1312,6 @@ func TestApierCdrServer(t *testing.T) {
|
||||
|
||||
/*
|
||||
func TestApierExportCdrsToFile(t *testing.T) {
|
||||
|
||||
var reply *utils.ExportedFileCdrs
|
||||
req := utils.AttrExpFileCdrs{}
|
||||
//if err := rater.Call("ApierV1.ExportCdrsToFile", req, &reply); err == nil || !strings.HasPrefix(err.Error(), utils.ERR_MANDATORY_IE_MISSING) {
|
||||
@@ -1394,7 +1346,6 @@ func TestApierExportCdrsToFile(t *testing.T) {
|
||||
*/
|
||||
|
||||
func TestApierITGetCdrs(t *testing.T) {
|
||||
|
||||
var reply []*engine.ExternalCDR
|
||||
req := utils.AttrGetCdrs{MediationRunIds: []string{utils.MetaRaw}}
|
||||
if err := rater.Call("ApierV1.GetCdrs", req, &reply); err != nil {
|
||||
@@ -1405,7 +1356,6 @@ func TestApierITGetCdrs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITProcessCdr(t *testing.T) {
|
||||
|
||||
var reply string
|
||||
cdr := engine.CDR{CGRID: utils.Sha1("dsafdsaf", time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC).String()), OrderID: 123, ToR: utils.VOICE, OriginID: "dsafdsaf",
|
||||
OriginHost: "192.168.1.1", Source: "test", RequestType: utils.META_RATED, Direction: "*out", Tenant: "cgrates.org", Category: "call", Account: "1001", Subject: "1001",
|
||||
@@ -1428,7 +1378,6 @@ func TestApierITProcessCdr(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITSetDC(t *testing.T) {
|
||||
|
||||
dcs1 := []*utils.DerivedCharger{
|
||||
&utils.DerivedCharger{RunID: "extra1", RequestTypeField: "^prepaid", DirectionField: "*default", TenantField: "*default", CategoryField: "*default",
|
||||
AccountField: "rif", SubjectField: "rif", DestinationField: "*default", SetupTimeField: "*default", AnswerTimeField: "*default", UsageField: "*default"},
|
||||
@@ -1445,7 +1394,6 @@ func TestApierITSetDC(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITGetDC(t *testing.T) {
|
||||
|
||||
attrs := utils.AttrDerivedChargers{Tenant: "cgrates.org", Category: "call", Direction: "*out", Account: "dan", Subject: "dan"}
|
||||
eDcs := utils.DerivedChargers{DestinationIDs: utils.NewStringMap(),
|
||||
Chargers: []*utils.DerivedCharger{
|
||||
@@ -1463,7 +1411,6 @@ func TestApierITGetDC(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITRemDC(t *testing.T) {
|
||||
|
||||
attrs := utils.AttrDerivedChargers{Tenant: "cgrates.org", Category: "call", Direction: "*out", Account: "dan", Subject: "dan"}
|
||||
var reply string
|
||||
if err := rater.Call("ApierV1.RemDerivedChargers", attrs, &reply); err != nil {
|
||||
@@ -1474,7 +1421,6 @@ func TestApierITRemDC(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITSetDestination(t *testing.T) {
|
||||
|
||||
attrs := utils.AttrSetDestination{Id: "TEST_SET_DESTINATION", Prefixes: []string{"+4986517174963", "+4986517174960"}}
|
||||
var reply string
|
||||
if err := rater.Call("ApierV1.SetDestination", attrs, &reply); err != nil {
|
||||
@@ -1501,7 +1447,6 @@ func TestApierITSetDestination(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITGetAliases(t *testing.T) {
|
||||
|
||||
var alias engine.Alias
|
||||
//al.Direction, al.Tenant, al.Category, al.Account, al.Subject, al.Group
|
||||
if err := rater.Call("AliasesV1.GetAlias", engine.Alias{Context: utils.ALIAS_CONTEXT_RATING, Direction: "*out", Tenant: "cgrates.org", Category: "call", Account: "2001", Subject: "2001"}, &alias); err == nil {
|
||||
@@ -1517,7 +1462,6 @@ func TestApierITGetAliases(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITAddRatingSubjectAliases(t *testing.T) {
|
||||
|
||||
addRtSubjAliases := &AttrAddRatingSubjectAliases{Tenant: "cgrates.org", Category: "call", Subject: "1001", Aliases: []string{"2001", "2002", "2003"}}
|
||||
var rply string
|
||||
if err := rater.Call("ApierV1.AddRatingSubjectAliases", addRtSubjAliases, &rply); err != nil {
|
||||
@@ -1535,7 +1479,6 @@ func TestApierITAddRatingSubjectAliases(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITRemRatingSubjectAliases(t *testing.T) {
|
||||
|
||||
tenantRatingSubj := engine.TenantRatingSubject{Tenant: "cgrates.org", Subject: "1001"}
|
||||
var rply string
|
||||
if err := rater.Call("ApierV1.RemRatingSubjectAliases", tenantRatingSubj, &rply); err != nil {
|
||||
@@ -1551,7 +1494,6 @@ func TestApierITRemRatingSubjectAliases(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITAddAccountAliases(t *testing.T) {
|
||||
|
||||
addAcntAliases := &AttrAddAccountAliases{Tenant: "cgrates.org", Category: "call", Account: "1001", Aliases: []string{"2001", "2002", "2003"}}
|
||||
var rply string
|
||||
if err := rater.Call("ApierV1.AddAccountAliases", addAcntAliases, &rply); err != nil {
|
||||
@@ -1569,7 +1511,6 @@ func TestApierITAddAccountAliases(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITRemAccountAliases(t *testing.T) {
|
||||
|
||||
tenantAcnt := engine.TenantAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
var rply string
|
||||
if err := rater.Call("ApierV1.RemAccountAliases", tenantAcnt, &rply); err != nil {
|
||||
@@ -1585,7 +1526,6 @@ func TestApierITRemAccountAliases(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITGetScheduledActions(t *testing.T) {
|
||||
|
||||
var rply []*ScheduledActions
|
||||
if err := rater.Call("ApierV1.GetScheduledActions", AttrsGetScheduledActions{}, &rply); err != nil {
|
||||
t.Error("Unexpected error: ", err)
|
||||
@@ -1593,7 +1533,6 @@ func TestApierITGetScheduledActions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierITGetDataCost(t *testing.T) {
|
||||
|
||||
attrs := AttrGetDataCost{Direction: "*out", Category: "data", Tenant: "cgrates.org", Account: "1001", Subject: "1001", StartTime: time.Now(), Usage: 640113}
|
||||
var rply *engine.DataCost
|
||||
if err := rater.Call("ApierV1.GetDataCost", attrs, &rply); err != nil {
|
||||
@@ -1605,21 +1544,18 @@ func TestApierITGetDataCost(t *testing.T) {
|
||||
|
||||
// Test LoadTPFromStorDb
|
||||
func TestApierInitDataDb2(t *testing.T) {
|
||||
|
||||
if err := engine.InitDataDb(cfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApierInitStorDb2(t *testing.T) {
|
||||
|
||||
if err := engine.InitStorDb(cfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApierReloadCache2(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
arc := new(utils.AttrReloadCache)
|
||||
// Simple test that command is executed without errors
|
||||
@@ -1631,7 +1567,6 @@ func TestApierReloadCache2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierReloadScheduler2(t *testing.T) {
|
||||
|
||||
reply := ""
|
||||
// Simple test that command is executed without errors
|
||||
if err := rater.Call("ApierV1.ReloadScheduler", reply, &reply); err != nil {
|
||||
@@ -1642,7 +1577,6 @@ func TestApierReloadScheduler2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierImportTPFromFolderPath(t *testing.T) {
|
||||
|
||||
var reply string
|
||||
if err := rater.Call("ApierV1.ImportTariffPlanFromFolder", utils.AttrImportTPFromFolder{TPid: "TEST_TPID2", FolderPath: "/usr/share/cgrates/tariffplans/tutorial"}, &reply); err != nil {
|
||||
t.Error("Got error on ApierV1.ImportTarrifPlanFromFolder: ", err.Error())
|
||||
@@ -1652,7 +1586,6 @@ func TestApierImportTPFromFolderPath(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierLoadTariffPlanFromStorDbDryRun(t *testing.T) {
|
||||
|
||||
var reply string
|
||||
if err := rater.Call("ApierV1.LoadTariffPlanFromStorDb", AttrLoadTpFromStorDb{TPid: "TEST_TPID2", DryRun: true}, &reply); err != nil {
|
||||
t.Error("Got error on ApierV1.LoadTariffPlanFromStorDb: ", err.Error())
|
||||
@@ -1662,7 +1595,6 @@ func TestApierLoadTariffPlanFromStorDbDryRun(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierGetCacheStats2(t *testing.T) {
|
||||
|
||||
var rcvStats *utils.CacheStats
|
||||
var args utils.AttrCacheStats
|
||||
err := rater.Call("ApierV1.GetCacheStats", args, &rcvStats)
|
||||
@@ -1675,7 +1607,6 @@ func TestApierGetCacheStats2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestApierLoadTariffPlanFromStorDb(t *testing.T) {
|
||||
|
||||
var reply string
|
||||
if err := rater.Call("ApierV1.LoadTariffPlanFromStorDb", AttrLoadTpFromStorDb{TPid: "TEST_TPID2"}, &reply); err != nil {
|
||||
t.Error("Got error on ApierV1.LoadTariffPlanFromStorDb: ", err.Error())
|
||||
@@ -1686,7 +1617,6 @@ func TestApierLoadTariffPlanFromStorDb(t *testing.T) {
|
||||
|
||||
/*
|
||||
func TestApierGetCacheStats3(t *testing.T) {
|
||||
|
||||
var rcvStats *utils.CacheStats
|
||||
expectedStats := &utils.CacheStats{Destinations: 4, RatingPlans: 3, RatingProfiles: 8, Actions: 7, SharedGroups: 1, RatingAliases: 1, AccountAliases: 1, DerivedChargers: 1}
|
||||
var args utils.AttrCacheStats
|
||||
@@ -1699,6 +1629,5 @@ func TestApierGetCacheStats3(t *testing.T) {
|
||||
|
||||
// Simply kill the engine after we are done with tests within this file
|
||||
func TestApierStopEngine(t *testing.T) {
|
||||
|
||||
exec.Command("pkill", "cgr-engine").Run()
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@ func TestCDRStatsitLoadConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCDRStatsitInitDataDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitDataDb(cdrstCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -79,7 +78,6 @@ func TestCDRStatsitLoadTariffPlanFromFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCDRStatsitGetQueueIds2(t *testing.T) {
|
||||
|
||||
var queueIds []string
|
||||
eQueueIds := []string{"CDRST3", "CDRST4"}
|
||||
if err := cdrstRpc.Call("CDRStatsV1.GetQueueIds", "", &queueIds); err != nil {
|
||||
@@ -97,7 +95,6 @@ func TestCDRStatsitGetQueueIds2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCDRStatsitPostCdrs(t *testing.T) {
|
||||
|
||||
storedCdrs := []*engine.CDR{
|
||||
&engine.CDR{CGRID: utils.Sha1("dsafdsafa", time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC).String()), OrderID: 123, ToR: utils.VOICE, OriginID: "dsafdsafa",
|
||||
OriginHost: "192.168.1.1", Source: "test",
|
||||
@@ -138,7 +135,6 @@ func TestCDRStatsitPostCdrs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCDRStatsitGetMetrics1(t *testing.T) {
|
||||
|
||||
var rcvMetrics2 map[string]float64
|
||||
expectedMetrics2 := map[string]float64{"ASR": 75, "ACD": 15}
|
||||
if err := cdrstRpc.Call("CDRStatsV1.GetMetrics", AttrGetMetrics{StatsQueueId: "CDRST4"}, &rcvMetrics2); err != nil {
|
||||
@@ -150,7 +146,6 @@ func TestCDRStatsitGetMetrics1(t *testing.T) {
|
||||
|
||||
// Test stats persistence
|
||||
func TestCDRStatsitStatsPersistence(t *testing.T) {
|
||||
|
||||
time.Sleep(time.Duration(2) * time.Second) // Allow stats to be updated in dataDb
|
||||
if _, err := engine.StopStartEngine(cdrstCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -170,7 +165,6 @@ func TestCDRStatsitStatsPersistence(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCDRStatsitResetMetrics(t *testing.T) {
|
||||
|
||||
var reply string
|
||||
if err := cdrstRpc.Call("CDRStatsV1.ResetQueues", utils.AttrCDRStatsReloadQueues{StatsQueueIds: []string{"CDRST4"}}, &reply); err != nil {
|
||||
t.Error("Calling CDRStatsV1.ResetQueues, got error: ", err.Error())
|
||||
@@ -188,7 +182,6 @@ func TestCDRStatsitResetMetrics(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCDRStatsitKillEngine(t *testing.T) {
|
||||
|
||||
if err := engine.KillEngine(*waitRater); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ var smgV1Rpc *rpc.Client
|
||||
var smgV1LoadInst utils.LoadInstance // Share load information between tests
|
||||
|
||||
func TestSMGV1InitCfg(t *testing.T) {
|
||||
|
||||
smgV1CfgPath = path.Join(*dataDir, "conf", "samples", "smgeneric")
|
||||
// Init config first
|
||||
var err error
|
||||
@@ -54,7 +53,6 @@ func TestSMGV1InitCfg(t *testing.T) {
|
||||
|
||||
// Remove data in both rating and accounting db
|
||||
func TestSMGV1ResetDataDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitDataDb(smgV1Cfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -62,7 +60,6 @@ func TestSMGV1ResetDataDb(t *testing.T) {
|
||||
|
||||
// Wipe out the cdr database
|
||||
func TestSMGV1ResetStorDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitStorDb(smgV1Cfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -70,7 +67,6 @@ func TestSMGV1ResetStorDb(t *testing.T) {
|
||||
|
||||
// Start CGR Engine
|
||||
func TestSMGV1StartEngine(t *testing.T) {
|
||||
|
||||
if _, err := engine.StopStartEngine(smgV1CfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -78,7 +74,6 @@ func TestSMGV1StartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestSMGV1RpcConn(t *testing.T) {
|
||||
|
||||
var err error
|
||||
smgV1Rpc, err = jsonrpc.Dial("tcp", smgV1Cfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -88,7 +83,6 @@ func TestSMGV1RpcConn(t *testing.T) {
|
||||
|
||||
// Load the tariff plan, creating accounts and their balances
|
||||
func TestSMGV1LoadTariffPlanFromFolder(t *testing.T) {
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")}
|
||||
if err := smgV1Rpc.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &smgV1LoadInst); err != nil {
|
||||
t.Error(err)
|
||||
@@ -100,9 +94,7 @@ func TestSMGV1LoadTariffPlanFromFolder(t *testing.T) {
|
||||
|
||||
// Check loaded stats
|
||||
func TestSMGV1CacheStats(t *testing.T) {
|
||||
|
||||
var rcvStats *utils.CacheStats
|
||||
|
||||
expectedStats := &utils.CacheStats{Destinations: 0, RatingPlans: 4, RatingProfiles: 0, Actions: 7, ActionPlans: 4, SharedGroups: 0, Aliases: 0, ResourceLimits: 0,
|
||||
DerivedChargers: 0, LcrProfiles: 0, CdrStats: 6, Users: 3}
|
||||
var args utils.AttrCacheStats
|
||||
@@ -115,7 +107,6 @@ func TestSMGV1CacheStats(t *testing.T) {
|
||||
|
||||
// Make sure account was debited properly
|
||||
func TestSMGV1AccountsBefore(t *testing.T) {
|
||||
|
||||
var reply *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
if err := smgV1Rpc.Call("ApierV2.GetAccount", attrs, &reply); err != nil {
|
||||
@@ -128,7 +119,6 @@ func TestSMGV1AccountsBefore(t *testing.T) {
|
||||
|
||||
// Make sure account was debited properly
|
||||
func TestSMGV1GetMaxUsage(t *testing.T) {
|
||||
|
||||
setupReq := &sessionmanager.SMGenericEvent{utils.REQTYPE: utils.META_PREPAID, utils.TENANT: "cgrates.org",
|
||||
utils.ACCOUNT: "1003", utils.DESTINATION: "1002", utils.SETUP_TIME: "2015-11-10T15:20:00Z"}
|
||||
var maxTime float64
|
||||
@@ -140,7 +130,6 @@ func TestSMGV1GetMaxUsage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGV1StopCgrEngine(t *testing.T) {
|
||||
|
||||
if err := engine.KillEngine(100); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -66,7 +66,6 @@ accid22;*postpaid;itsyscom.com;1001;+4986517174963;2013-02-03 19:54:00;123;val_e
|
||||
accid23;*rated;cgrates.org;1001;086517174963;2013-02-03 19:54:00;26;val_extra3;"";val_extra1`
|
||||
|
||||
func TestCsvITInitConfig(t *testing.T) {
|
||||
|
||||
var err error
|
||||
csvCfgPath = path.Join(*dataDir, "conf", "samples", "cdrccsv")
|
||||
if csvCfg, err = config.NewCGRConfigFromFolder(csvCfgPath); err != nil {
|
||||
@@ -76,14 +75,12 @@ func TestCsvITInitConfig(t *testing.T) {
|
||||
|
||||
// InitDb so we can rely on count
|
||||
func TestCsvITInitCdrDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitStorDb(csvCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCsvITCreateCdrDirs(t *testing.T) {
|
||||
|
||||
for _, cdrcProfiles := range csvCfg.CdrcProfiles {
|
||||
for _, cdrcInst := range cdrcProfiles {
|
||||
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
|
||||
@@ -99,7 +96,6 @@ func TestCsvITCreateCdrDirs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCsvITStartEngine(t *testing.T) {
|
||||
|
||||
if _, err := engine.StopStartEngine(csvCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -107,7 +103,6 @@ func TestCsvITStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestCsvITRpcConn(t *testing.T) {
|
||||
|
||||
var err error
|
||||
cdrcRpc, err = jsonrpc.Dial("tcp", csvCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -117,7 +112,6 @@ func TestCsvITRpcConn(t *testing.T) {
|
||||
|
||||
// The default scenario, out of cdrc defined in .cfg file
|
||||
func TestCsvITHandleCdr1File(t *testing.T) {
|
||||
|
||||
fileName := "file1.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(fileContent1), 0644); err != nil {
|
||||
@@ -130,7 +124,6 @@ func TestCsvITHandleCdr1File(t *testing.T) {
|
||||
|
||||
// Scenario out of first .xml config
|
||||
func TestCsvITHandleCdr2File(t *testing.T) {
|
||||
|
||||
fileName := "file2.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(fileContent2), 0644); err != nil {
|
||||
@@ -142,7 +135,6 @@ func TestCsvITHandleCdr2File(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCsvITProcessedFiles(t *testing.T) {
|
||||
|
||||
time.Sleep(time.Duration(2**waitRater) * time.Millisecond)
|
||||
if outContent1, err := ioutil.ReadFile("/tmp/cdrctests/csvit1/out/file1.csv"); err != nil {
|
||||
t.Error(err)
|
||||
@@ -157,7 +149,6 @@ func TestCsvITProcessedFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCsvITAnalyseCDRs(t *testing.T) {
|
||||
|
||||
var reply []*engine.ExternalCDR
|
||||
if err := cdrcRpc.Call("ApierV2.GetCdrs", utils.RPCCDRsFilter{}, &reply); err != nil {
|
||||
t.Error("Unexpected error: ", err.Error())
|
||||
@@ -173,7 +164,6 @@ func TestCsvITAnalyseCDRs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCsvITKillEngine(t *testing.T) {
|
||||
|
||||
if err := engine.KillEngine(*waitRater); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -58,7 +58,6 @@ var part2 = `INVITE|f9d3d5c3|c863a6e3|214d8f52b566e33a9349b184e72a4ccb@0:0:0:0:0
|
||||
INVITE|2daec40c|548625ac|dd0c4c617a9919d29a6175cdff223a9e@0:0:0:0:0:0:0:0|200|OK|1436454408|*prepaid|1001|1002||3401:2069362475`
|
||||
|
||||
func TestFlatstoreitInitCfg(t *testing.T) {
|
||||
|
||||
var err error
|
||||
flatstoreCfgPath = path.Join(*dataDir, "conf", "samples", "cdrcflatstore")
|
||||
if flatstoreCfg, err = config.NewCGRConfigFromFolder(flatstoreCfgPath); err != nil {
|
||||
@@ -68,7 +67,6 @@ func TestFlatstoreitInitCfg(t *testing.T) {
|
||||
|
||||
// InitDb so we can rely on count
|
||||
func TestFlatstoreitInitCdrDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitStorDb(flatstoreCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -76,7 +74,6 @@ func TestFlatstoreitInitCdrDb(t *testing.T) {
|
||||
|
||||
// Creates cdr files and moves them into processing folder
|
||||
func TestFlatstoreitCreateCdrFiles(t *testing.T) {
|
||||
|
||||
if flatstoreCfg == nil {
|
||||
t.Fatal("Empty default cdrc configuration")
|
||||
}
|
||||
@@ -100,7 +97,6 @@ func TestFlatstoreitCreateCdrFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFlatstoreitStartEngine(t *testing.T) {
|
||||
|
||||
if _, err := engine.StopStartEngine(flatstoreCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -108,7 +104,6 @@ func TestFlatstoreitStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestFlatstoreitRpcConn(t *testing.T) {
|
||||
|
||||
var err error
|
||||
flatstoreRpc, err = jsonrpc.Dial("tcp", flatstoreCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -117,7 +112,6 @@ func TestFlatstoreitRpcConn(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFlatstoreitProcessFiles(t *testing.T) {
|
||||
|
||||
if err := ioutil.WriteFile(path.Join("/tmp", "acc_1.log"), []byte(fullSuccessfull), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,6 @@ TRL0001DDB ABC Some Connect A.B.
|
||||
`
|
||||
|
||||
func TestFwvitInitCfg(t *testing.T) {
|
||||
|
||||
var err error
|
||||
fwvCfgPath = path.Join(*dataDir, "conf", "samples", "cdrcfwv")
|
||||
if fwvCfg, err = config.NewCGRConfigFromFolder(fwvCfgPath); err != nil {
|
||||
@@ -85,7 +84,6 @@ func TestFwvitInitCfg(t *testing.T) {
|
||||
|
||||
// Creates cdr files and moves them into processing folder
|
||||
func TestFwvitCreateCdrFiles(t *testing.T) {
|
||||
|
||||
if fwvCfg == nil {
|
||||
t.Fatal("Empty default cdrc configuration")
|
||||
}
|
||||
@@ -109,7 +107,6 @@ func TestFwvitCreateCdrFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFwvitStartEngine(t *testing.T) {
|
||||
|
||||
if _, err := engine.StopStartEngine(fwvCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -117,7 +114,6 @@ func TestFwvitStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestFwvitRpcConn(t *testing.T) {
|
||||
|
||||
var err error
|
||||
fwvRpc, err = jsonrpc.Dial("tcp", fwvCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -126,7 +122,6 @@ func TestFwvitRpcConn(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFwvitProcessFiles(t *testing.T) {
|
||||
|
||||
fileName := "test1.fwv"
|
||||
if err := ioutil.WriteFile(path.Join("/tmp", fileName), []byte(FW_CDR_FILE1), 0644); err != nil {
|
||||
t.Fatal(err.Error)
|
||||
|
||||
@@ -51,7 +51,6 @@ var eCacheDumpFile1 = `4986517174963_004986517174964_04.07.2016 18:58:55,1467651
|
||||
`
|
||||
|
||||
func TestPartcsvITInitConfig(t *testing.T) {
|
||||
|
||||
var err error
|
||||
partpartcsvCfgPath = path.Join(*dataDir, "conf", "samples", "cdrc_partcsv")
|
||||
if partcsvCfg, err = config.NewCGRConfigFromFolder(partpartcsvCfgPath); err != nil {
|
||||
@@ -61,14 +60,12 @@ func TestPartcsvITInitConfig(t *testing.T) {
|
||||
|
||||
// InitDb so we can rely on count
|
||||
func TestPartcsvITInitCdrDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitStorDb(partcsvCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestPartcsvITCreateCdrDirs(t *testing.T) {
|
||||
|
||||
for path, cdrcProfiles := range partcsvCfg.CdrcProfiles {
|
||||
for _, cdrcInst := range cdrcProfiles {
|
||||
if path == "/tmp/cdrctests/partcsv1/in" {
|
||||
@@ -89,7 +86,6 @@ func TestPartcsvITCreateCdrDirs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPartcsvITStartEngine(t *testing.T) {
|
||||
|
||||
if _, err := engine.StopStartEngine(partpartcsvCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -97,7 +93,6 @@ func TestPartcsvITStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestPartcsvITRpcConn(t *testing.T) {
|
||||
|
||||
var err error
|
||||
partcsvRPC, err = jsonrpc.Dial("tcp", partcsvCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -107,7 +102,6 @@ func TestPartcsvITRpcConn(t *testing.T) {
|
||||
|
||||
// The default scenario, out of cdrc defined in .cfg file
|
||||
func TestPartcsvITHandleCdr1File(t *testing.T) {
|
||||
|
||||
fileName := "file1.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(partCsvFileContent1), 0644); err != nil {
|
||||
@@ -120,7 +114,6 @@ func TestPartcsvITHandleCdr1File(t *testing.T) {
|
||||
|
||||
// Scenario out of first .xml config
|
||||
func TestPartcsvITHandleCdr2File(t *testing.T) {
|
||||
|
||||
fileName := "file2.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(partCsvFileContent2), 0644); err != nil {
|
||||
@@ -133,7 +126,6 @@ func TestPartcsvITHandleCdr2File(t *testing.T) {
|
||||
|
||||
// Scenario out of first .xml config
|
||||
func TestPartcsvITHandleCdr3File(t *testing.T) {
|
||||
|
||||
fileName := "file3.csv"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(partCsvFileContent3), 0644); err != nil {
|
||||
@@ -145,7 +137,6 @@ func TestPartcsvITHandleCdr3File(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPartcsvITProcessedFiles(t *testing.T) {
|
||||
|
||||
time.Sleep(time.Duration(3 * time.Second))
|
||||
if outContent1, err := ioutil.ReadFile(path.Join(partcsvCDRCDirOut1, "file1.csv")); err != nil {
|
||||
t.Error(err)
|
||||
@@ -178,7 +169,6 @@ func TestPartcsvITProcessedFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPartcsvITAnalyseCDRs(t *testing.T) {
|
||||
|
||||
var reply []*engine.ExternalCDR
|
||||
if err := partcsvRPC.Call("ApierV2.GetCdrs", utils.RPCCDRsFilter{}, &reply); err != nil {
|
||||
t.Error("Unexpected error: ", err.Error())
|
||||
@@ -199,7 +189,6 @@ func TestPartcsvITAnalyseCDRs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPartcsvITKillEngine(t *testing.T) {
|
||||
|
||||
if err := engine.KillEngine(*waitRater); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -41,7 +41,6 @@ var cdrcXmlRPC *rpc.Client
|
||||
var xmlPathIn1, xmlPathOut1 string
|
||||
|
||||
func TestXmlITInitConfig(t *testing.T) {
|
||||
|
||||
var err error
|
||||
xmlCfgPath = path.Join(*dataDir, "conf", "samples", "cdrcxml")
|
||||
if xmlCfg, err = config.NewCGRConfigFromFolder(xmlCfgPath); err != nil {
|
||||
@@ -51,14 +50,12 @@ func TestXmlITInitConfig(t *testing.T) {
|
||||
|
||||
// InitDb so we can rely on count
|
||||
func TestXmlITInitCdrDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitStorDb(xmlCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestXmlITCreateCdrDirs(t *testing.T) {
|
||||
|
||||
for _, cdrcProfiles := range xmlCfg.CdrcProfiles {
|
||||
for i, cdrcInst := range cdrcProfiles {
|
||||
for _, dir := range []string{cdrcInst.CdrInDir, cdrcInst.CdrOutDir} {
|
||||
@@ -78,7 +75,6 @@ func TestXmlITCreateCdrDirs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestXmlITStartEngine(t *testing.T) {
|
||||
|
||||
if _, err := engine.StopStartEngine(xmlCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -86,7 +82,6 @@ func TestXmlITStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestXmlITRpcConn(t *testing.T) {
|
||||
|
||||
var err error
|
||||
cdrcXmlRPC, err = jsonrpc.Dial("tcp", xmlCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -96,7 +91,6 @@ func TestXmlITRpcConn(t *testing.T) {
|
||||
|
||||
// The default scenario, out of cdrc defined in .cfg file
|
||||
func TestXmlITHandleCdr1File(t *testing.T) {
|
||||
|
||||
fileName := "file1.xml"
|
||||
tmpFilePath := path.Join("/tmp", fileName)
|
||||
if err := ioutil.WriteFile(tmpFilePath, []byte(cdrXmlBroadsoft), 0644); err != nil {
|
||||
@@ -108,7 +102,6 @@ func TestXmlITHandleCdr1File(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestXmlITProcessedFiles(t *testing.T) {
|
||||
|
||||
time.Sleep(time.Duration(2**waitRater) * time.Millisecond)
|
||||
if outContent1, err := ioutil.ReadFile(path.Join(xmlPathOut1, "file1.xml")); err != nil {
|
||||
t.Error(err)
|
||||
@@ -118,7 +111,6 @@ func TestXmlITProcessedFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestXmlITAnalyseCDRs(t *testing.T) {
|
||||
|
||||
var reply []*engine.ExternalCDR
|
||||
if err := cdrcXmlRPC.Call("ApierV2.GetCdrs", utils.RPCCDRsFilter{}, &reply); err != nil {
|
||||
t.Error("Unexpected error: ", err.Error())
|
||||
@@ -134,7 +126,6 @@ func TestXmlITAnalyseCDRs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestXmlITKillEngine(t *testing.T) {
|
||||
|
||||
if err := engine.KillEngine(*waitRater); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ import (
|
||||
var rds *RedisStorage
|
||||
|
||||
func TestRDSitConnectRedis(t *testing.T) {
|
||||
|
||||
cfg, _ := config.NewDefaultCGRConfig()
|
||||
rds, err = NewRedisStorage(fmt.Sprintf("%s:%s", cfg.TpDbHost, cfg.TpDbPort), 4, cfg.TpDbPass, cfg.DBDataEncoding, utils.REDIS_MAX_CONNS, nil, 1)
|
||||
if err != nil {
|
||||
@@ -40,7 +39,6 @@ func TestRDSitConnectRedis(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRDSitFlush(t *testing.T) {
|
||||
|
||||
if err := rds.Flush(""); err != nil {
|
||||
t.Error("Failed to Flush redis database", err.Error())
|
||||
}
|
||||
@@ -48,7 +46,6 @@ func TestRDSitFlush(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRDSitSetGetDerivedCharges(t *testing.T) {
|
||||
|
||||
keyCharger1 := utils.ConcatenatedKey("*out", "cgrates.org", "call", "dan", "dan")
|
||||
charger1 := &utils.DerivedChargers{Chargers: []*utils.DerivedCharger{
|
||||
&utils.DerivedCharger{RunID: "extra1", RequestTypeField: "^prepaid", DirectionField: "*default", TenantField: "*default", CategoryField: "*default",
|
||||
@@ -74,7 +71,6 @@ func TestRDSitSetGetDerivedCharges(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRDSitSetReqFilterIndexes(t *testing.T) {
|
||||
|
||||
idxes := map[string]map[string]utils.StringMap{
|
||||
"Account": map[string]utils.StringMap{
|
||||
"1001": utils.StringMap{
|
||||
@@ -106,7 +102,6 @@ func TestRDSitSetReqFilterIndexes(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRDSitGetReqFilterIndexes(t *testing.T) {
|
||||
|
||||
eIdxes := map[string]map[string]utils.StringMap{
|
||||
"Account": map[string]utils.StringMap{
|
||||
"1001": utils.StringMap{
|
||||
@@ -143,7 +138,6 @@ func TestRDSitGetReqFilterIndexes(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRDSitMatchReqFilterIndex(t *testing.T) {
|
||||
|
||||
eMp := utils.StringMap{
|
||||
"RL1": true,
|
||||
"RL2": true,
|
||||
|
||||
@@ -170,7 +170,6 @@ func TestCdrsFileFailover(t *testing.T) {
|
||||
// Performance test, check `lsof -a -p 8427 | wc -l`
|
||||
|
||||
func TestCdrsHttpCdrReplication2(t *testing.T) {
|
||||
|
||||
cdrs := make([]*engine.CDR, 0)
|
||||
for i := 0; i < 10000; i++ {
|
||||
cdr := &engine.CDR{OriginID: fmt.Sprintf("httpjsonrpc_%d", i),
|
||||
|
||||
@@ -39,7 +39,6 @@ var destCfg *config.CGRConfig
|
||||
var destRPC *rpc.Client
|
||||
|
||||
func TestDestManagInitCfg(t *testing.T) {
|
||||
|
||||
destCfgPath = path.Join(*dataDir, "conf", "samples", "tutmysql")
|
||||
// Init config first
|
||||
var err error
|
||||
@@ -53,7 +52,6 @@ func TestDestManagInitCfg(t *testing.T) {
|
||||
|
||||
// Remove data in both rating and accounting db
|
||||
func TestDestManagResetDataDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitDataDb(destCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -61,7 +59,6 @@ func TestDestManagResetDataDb(t *testing.T) {
|
||||
|
||||
// Wipe out the cdr database
|
||||
func TestDestManagResetStorDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitStorDb(destCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -69,7 +66,6 @@ func TestDestManagResetStorDb(t *testing.T) {
|
||||
|
||||
// Start CGR Engine
|
||||
func TestDestManagStartEngine(t *testing.T) {
|
||||
|
||||
if _, err := engine.StopStartEngine(destCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -77,7 +73,6 @@ func TestDestManagStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestDestManagRpcConn(t *testing.T) {
|
||||
|
||||
var err error
|
||||
destRPC, err = jsonrpc.Dial("tcp", destCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -87,7 +82,6 @@ func TestDestManagRpcConn(t *testing.T) {
|
||||
|
||||
// Load the tariff plan, creating accounts and their balances
|
||||
func TestDestManagLoadTariffPlanFromFolderAll(t *testing.T) {
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "alldests")}
|
||||
var destLoadInst utils.LoadInstance
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
@@ -98,7 +92,6 @@ func TestDestManagLoadTariffPlanFromFolderAll(t *testing.T) {
|
||||
|
||||
|
||||
func TestDestManagAllDestinationLoaded(t *testing.T) {
|
||||
|
||||
dests := make([]*engine.Destination, 0)
|
||||
if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil {
|
||||
t.Error("Got error on ApierV2.GetDestinations: ", err.Error())
|
||||
@@ -116,7 +109,6 @@ func TestDestManagAllDestinationLoaded(t *testing.T) {
|
||||
|
||||
|
||||
func TestDestManagLoadTariffPlanFromFolderRemoveSome(t *testing.T) {
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "removesome")}
|
||||
var destLoadInst utils.LoadInstance
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
@@ -126,7 +118,6 @@ func TestDestManagLoadTariffPlanFromFolderRemoveSome(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagRemoveSomeDestinationLoaded(t *testing.T) {
|
||||
|
||||
dests := make([]*engine.Destination, 0)
|
||||
if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil {
|
||||
t.Error("Got error on ApierV2.GetDestinations: ", err.Error())
|
||||
@@ -143,7 +134,6 @@ func TestDestManagRemoveSomeDestinationLoaded(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagLoadTariffPlanFromFolderRemoveSomeFlush(t *testing.T) {
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "removesome"), FlushDb: true}
|
||||
var destLoadInst utils.LoadInstance
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
@@ -153,7 +143,6 @@ func TestDestManagLoadTariffPlanFromFolderRemoveSomeFlush(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagRemoveSomeFlushDestinationLoaded(t *testing.T) {
|
||||
|
||||
dests := make([]*engine.Destination, 0)
|
||||
if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil {
|
||||
t.Error("Got error on ApierV2.GetDestinations: ", err.Error())
|
||||
@@ -170,7 +159,6 @@ func TestDestManagRemoveSomeFlushDestinationLoaded(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagLoadTariffPlanFromFolderAddBack(t *testing.T) {
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "addback")}
|
||||
var destLoadInst utils.LoadInstance
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
@@ -180,7 +168,6 @@ func TestDestManagLoadTariffPlanFromFolderAddBack(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagAddBackDestinationLoaded(t *testing.T) {
|
||||
|
||||
dests := make([]*engine.Destination, 0)
|
||||
if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil {
|
||||
t.Error("Got error on ApierV2.GetDestinations: ", err.Error())
|
||||
@@ -197,7 +184,6 @@ func TestDestManagAddBackDestinationLoaded(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagLoadTariffPlanFromFolderAddOne(t *testing.T) {
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "test", "destinations", "addone")}
|
||||
var destLoadInst utils.LoadInstance
|
||||
if err := destRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &destLoadInst); err != nil {
|
||||
@@ -207,7 +193,6 @@ func TestDestManagLoadTariffPlanFromFolderAddOne(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagAddOneDestinationLoaded(t *testing.T) {
|
||||
|
||||
dests := make([]*engine.Destination, 0)
|
||||
if err := destRPC.Call("ApierV2.GetDestinations", v2.AttrGetDestinations{DestinationIDs: []string{}}, &dests); err != nil {
|
||||
t.Error("Got error on ApierV2.GetDestinations: ", err.Error())
|
||||
@@ -224,7 +209,6 @@ func TestDestManagAddOneDestinationLoaded(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagCacheWithGetCache(t *testing.T) {
|
||||
|
||||
if err := engine.InitDataDb(destCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -276,7 +260,6 @@ func TestDestManagCacheWithGetCache(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagCacheWithGetCost(t *testing.T) {
|
||||
|
||||
if err := engine.InitDataDb(destCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -279,7 +279,6 @@ func TestRPCITLclStatusBcastRALs1Up(t *testing.T) {
|
||||
|
||||
/*
|
||||
func TestRPCITStatusBcastCmd(t *testing.T) {
|
||||
|
||||
var stats utils.CacheStats
|
||||
if err := rpcRAL1.Call("ApierV2.GetCacheStats", utils.AttrCacheStats{}, &stats); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -105,7 +105,6 @@ func TestTutSMGCacheStats(t *testing.T) {
|
||||
/*
|
||||
// Make sure account was debited properly
|
||||
func TestTutSMGAccountsBefore(t *testing.T) {
|
||||
|
||||
var reply *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
if err := tutSMGRpc.Call("ApierV2.GetAccount", attrs, &reply); err != nil {
|
||||
|
||||
@@ -1218,7 +1218,6 @@ func TestTutITSetAccount(t *testing.T) {
|
||||
/*
|
||||
// Make sure all stats queues were updated
|
||||
func TestTutITCdrStatsAfter(t *testing.T) {
|
||||
|
||||
var statMetrics map[string]float64
|
||||
eMetrics := map[string]float64{engine.ACD: 90.2, engine.ASR: 100, engine.TCC: 1.675, engine.TCD: 451, engine.ACC: 0.335}
|
||||
if err := tutLocalRpc.Call("CDRStatsV1.GetMetrics", v1.AttrGetMetrics{StatsQueueId: "CDRST1"}, &statMetrics); err != nil {
|
||||
|
||||
@@ -31,7 +31,6 @@ import (
|
||||
)
|
||||
|
||||
func TestSMGDataInitCfg(t *testing.T) {
|
||||
|
||||
daCfgPath = path.Join(*dataDir, "conf", "samples", "smg")
|
||||
// Init config first
|
||||
var err error
|
||||
@@ -45,7 +44,6 @@ func TestSMGDataInitCfg(t *testing.T) {
|
||||
|
||||
// Remove data in both rating and accounting db
|
||||
func TestSMGDataResetDataDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitDataDb(daCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -53,7 +51,6 @@ func TestSMGDataResetDataDb(t *testing.T) {
|
||||
|
||||
// Wipe out the cdr database
|
||||
func TestSMGDataResetStorDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitStorDb(daCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -61,7 +58,6 @@ func TestSMGDataResetStorDb(t *testing.T) {
|
||||
|
||||
// Start CGR Engine
|
||||
func TestSMGDataStartEngine(t *testing.T) {
|
||||
|
||||
if _, err := engine.StopStartEngine(daCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -79,7 +75,6 @@ func TestSMGDataApierRpcConn(t *testing.T) {
|
||||
|
||||
// Load the tariff plan, creating accounts and their balances
|
||||
func TestSMGDataTPFromFolder(t *testing.T) {
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testtp")}
|
||||
var loadInst utils.LoadInstance
|
||||
if err := smgRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &loadInst); err != nil {
|
||||
@@ -89,7 +84,6 @@ func TestSMGDataTPFromFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataLastUsedData(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 50000000000.000000
|
||||
@@ -182,7 +176,6 @@ func TestSMGDataLastUsedData(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataLastUsedMultipleData(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 49999979520.000000
|
||||
@@ -378,7 +371,6 @@ func TestSMGDataLastUsedMultipleData(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataDerivedChargingNoCredit(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1011"}
|
||||
eAcntVal := 50000.0
|
||||
@@ -420,7 +412,6 @@ func TestSMGDataDerivedChargingNoCredit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataTTLExpired(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 49999897600.000000
|
||||
@@ -467,7 +458,6 @@ func TestSMGDataTTLExpired(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataTTLExpiredMultiUpdates(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 49998842880.000000
|
||||
@@ -551,7 +541,6 @@ func TestSMGDataTTLExpiredMultiUpdates(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataMultipleDataNoUsage(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 49997767680.000000
|
||||
@@ -747,7 +736,6 @@ func TestSMGDataMultipleDataNoUsage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataMultipleDataConstantUsage(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 49997767680.000000
|
||||
|
||||
@@ -40,7 +40,6 @@ var daCfg *config.CGRConfig
|
||||
var smgRPC *rpc.Client
|
||||
|
||||
func TestSMGVoiceInitCfg(t *testing.T) {
|
||||
|
||||
daCfgPath = path.Join(*dataDir, "conf", "samples", "smg")
|
||||
// Init config first
|
||||
var err error
|
||||
@@ -54,7 +53,6 @@ func TestSMGVoiceInitCfg(t *testing.T) {
|
||||
|
||||
// Remove data in both rating and accounting db
|
||||
func TestSMGVoiceResetDataDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitDataDb(daCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -62,7 +60,6 @@ func TestSMGVoiceResetDataDb(t *testing.T) {
|
||||
|
||||
// Wipe out the cdr database
|
||||
func TestSMGVoiceResetStorDb(t *testing.T) {
|
||||
|
||||
if err := engine.InitStorDb(daCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -78,7 +75,6 @@ func TestSMGVoiceStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestSMGVoiceApierRpcConn(t *testing.T) {
|
||||
|
||||
var err error
|
||||
smgRPC, err = jsonrpc.Dial("tcp", daCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -88,7 +84,6 @@ func TestSMGVoiceApierRpcConn(t *testing.T) {
|
||||
|
||||
// Load the tariff plan, creating accounts and their balances
|
||||
func TestSMGVoiceTPFromFolder(t *testing.T) {
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")}
|
||||
var loadInst utils.LoadInstance
|
||||
if err := smgRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &loadInst); err != nil {
|
||||
@@ -98,7 +93,6 @@ func TestSMGVoiceTPFromFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceMonetaryRefund(t *testing.T) {
|
||||
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
utils.TOR: utils.VOICE,
|
||||
@@ -157,7 +151,6 @@ func TestSMGVoiceMonetaryRefund(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceVoiceRefund(t *testing.T) {
|
||||
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
utils.TOR: utils.VOICE,
|
||||
@@ -216,7 +209,6 @@ func TestSMGVoiceVoiceRefund(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceMixedRefund(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
@@ -288,7 +280,6 @@ func TestSMGVoiceMixedRefund(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceLastUsed(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
eAcntVal := 8.790000
|
||||
@@ -403,7 +394,6 @@ func TestSMGVoiceLastUsed(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceLastUsedEnd(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
eAcntVal := 7.59000
|
||||
@@ -492,7 +482,6 @@ func TestSMGVoiceLastUsedEnd(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceLastUsedNotFixed(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
eAcntVal := 6.59000
|
||||
@@ -581,7 +570,6 @@ func TestSMGVoiceLastUsedNotFixed(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceSessionTTL(t *testing.T) {
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
eAcntVal := 5.590000
|
||||
@@ -685,7 +673,6 @@ func TestSMGVoiceSessionTTL(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceSessionTTLWithRelocate(t *testing.T) {
|
||||
|
||||
attrSetBalance := utils.AttrSetBalance{Tenant: "cgrates.org", Account: "TestTTLWithRelocate", BalanceType: utils.VOICE, BalanceID: utils.StringPointer("TestTTLWithRelocate"),
|
||||
Value: utils.Float64Pointer(300), RatingSubject: utils.StringPointer("*zero50ms")}
|
||||
var reply string
|
||||
@@ -803,7 +790,6 @@ func TestSMGVoiceSessionTTLWithRelocate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceRelocateWithOriginIDPrefix(t *testing.T) {
|
||||
|
||||
attrSetBalance := utils.AttrSetBalance{Tenant: "cgrates.org", Account: "TestRelocateWithOriginIDPrefix",
|
||||
BalanceType: utils.VOICE, BalanceID: utils.StringPointer("TestRelocateWithOriginIDPrefix"),
|
||||
Value: utils.Float64Pointer(300), RatingSubject: utils.StringPointer("*zero1s")}
|
||||
@@ -944,7 +930,6 @@ func TestSMGVoiceRelocateWithOriginIDPrefix(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceSessionStopCgrEngine(t *testing.T) {
|
||||
|
||||
if err := engine.KillEngine(100); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ func TestSMGRplcInitCfg(t *testing.T) {
|
||||
|
||||
// Remove data in both rating and accounting db
|
||||
func TestSMGRplcResetDB(t *testing.T) {
|
||||
|
||||
if err := engine.InitDataDb(smgRplcMasterCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -63,7 +62,6 @@ func TestSMGRplcResetDB(t *testing.T) {
|
||||
|
||||
// Start CGR Engine
|
||||
func TestSMGRplcStartEngine(t *testing.T) {
|
||||
|
||||
if _, err := engine.StopStartEngine(smgRplcSlaveCfgPath, *waitRater); err != nil { // Start slave before master
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -74,7 +72,6 @@ func TestSMGRplcStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestSMGRplcApierRpcConn(t *testing.T) {
|
||||
|
||||
if smgRplcMstrRPC, err = jsonrpc.Dial("tcp", smgRplcMasterCfg.RPCJSONListen); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -85,7 +82,6 @@ func TestSMGRplcApierRpcConn(t *testing.T) {
|
||||
|
||||
// Load the tariff plan, creating accounts and their balances
|
||||
func TestSMGRplcTPFromFolder(t *testing.T) {
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")}
|
||||
var loadInst utils.LoadInstance
|
||||
if err := smgRplcMstrRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &loadInst); err != nil {
|
||||
@@ -95,7 +91,6 @@ func TestSMGRplcTPFromFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGRplcInitiate(t *testing.T) {
|
||||
|
||||
var pSessions []*ActiveSession
|
||||
if err := smgRplcSlvRPC.Call("SMGenericV1.PassiveSessions", nil, &pSessions); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
@@ -149,7 +144,6 @@ func TestSMGRplcInitiate(t *testing.T) {
|
||||
|
||||
// Update on slave
|
||||
func TestSMGRplcUpdate(t *testing.T) {
|
||||
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
utils.ACCID: "123451",
|
||||
@@ -194,7 +188,6 @@ func TestSMGRplcUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGRplcTerminate(t *testing.T) {
|
||||
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
utils.ACCID: "123451",
|
||||
@@ -222,7 +215,6 @@ func TestSMGRplcTerminate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGRplcStopCgrEngine(t *testing.T) {
|
||||
|
||||
if err := engine.KillEngine(100); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user