mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
SM integration tests refactoring
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
// +build integration
|
||||
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
@@ -31,9 +33,7 @@ import (
|
||||
var cgrRater1Cmd, cgrSmg1Cmd *exec.Cmd
|
||||
|
||||
func TestHaPoolInitCfg(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
daCfgPath = path.Join(*dataDir, "conf", "samples", "hapool", "cgrrater1")
|
||||
// Init config first
|
||||
var err error
|
||||
@@ -57,9 +57,7 @@ func TestHaPoolResetStorDb(t *testing.T) {
|
||||
|
||||
// Start CGR Engine
|
||||
func TestHaPoolStartEngine(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
engine.KillEngine(*waitRater) // just to make sure
|
||||
var err error
|
||||
cgrRater1 := path.Join(*dataDir, "conf", "samples", "hapool", "cgrrater1")
|
||||
|
||||
@@ -170,9 +170,7 @@ func TestCdrsFileFailover(t *testing.T) {
|
||||
// Performance test, check `lsof -a -p 8427 | wc -l`
|
||||
|
||||
func TestCdrsHttpCdrReplication2(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
cdrs := make([]*engine.CDR, 0)
|
||||
for i := 0; i < 10000; i++ {
|
||||
cdr := &engine.CDR{OriginID: fmt.Sprintf("httpjsonrpc_%d", i),
|
||||
|
||||
@@ -39,9 +39,7 @@ var destCfg *config.CGRConfig
|
||||
var destRPC *rpc.Client
|
||||
|
||||
func TestDestManagInitCfg(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
destCfgPath = path.Join(*dataDir, "conf", "samples", "tutmysql")
|
||||
// Init config first
|
||||
var err error
|
||||
@@ -55,9 +53,7 @@ func TestDestManagInitCfg(t *testing.T) {
|
||||
|
||||
// Remove data in both rating and accounting db
|
||||
func TestDestManagResetDataDb(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if err := engine.InitDataDb(destCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -65,9 +61,7 @@ func TestDestManagResetDataDb(t *testing.T) {
|
||||
|
||||
// Wipe out the cdr database
|
||||
func TestDestManagResetStorDb(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if err := engine.InitStorDb(destCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -75,9 +69,7 @@ func TestDestManagResetStorDb(t *testing.T) {
|
||||
|
||||
// Start CGR Engine
|
||||
func TestDestManagStartEngine(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := engine.StopStartEngine(destCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -85,9 +77,7 @@ func TestDestManagStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestDestManagRpcConn(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var err error
|
||||
destRPC, err = jsonrpc.Dial("tcp", destCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -97,9 +87,7 @@ func TestDestManagRpcConn(t *testing.T) {
|
||||
|
||||
// Load the tariff plan, creating accounts and their balances
|
||||
func TestDestManagLoadTariffPlanFromFolderAll(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -110,9 +98,7 @@ func TestDestManagLoadTariffPlanFromFolderAll(t *testing.T) {
|
||||
|
||||
|
||||
func TestDestManagAllDestinationLoaded(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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())
|
||||
@@ -130,9 +116,7 @@ func TestDestManagAllDestinationLoaded(t *testing.T) {
|
||||
|
||||
|
||||
func TestDestManagLoadTariffPlanFromFolderRemoveSome(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -142,9 +126,7 @@ func TestDestManagLoadTariffPlanFromFolderRemoveSome(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagRemoveSomeDestinationLoaded(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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())
|
||||
@@ -161,9 +143,7 @@ func TestDestManagRemoveSomeDestinationLoaded(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagLoadTariffPlanFromFolderRemoveSomeFlush(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -173,9 +153,7 @@ func TestDestManagLoadTariffPlanFromFolderRemoveSomeFlush(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagRemoveSomeFlushDestinationLoaded(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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())
|
||||
@@ -192,9 +170,7 @@ func TestDestManagRemoveSomeFlushDestinationLoaded(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagLoadTariffPlanFromFolderAddBack(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -204,9 +180,7 @@ func TestDestManagLoadTariffPlanFromFolderAddBack(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagAddBackDestinationLoaded(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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())
|
||||
@@ -223,9 +197,7 @@ func TestDestManagAddBackDestinationLoaded(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagLoadTariffPlanFromFolderAddOne(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -235,9 +207,7 @@ func TestDestManagLoadTariffPlanFromFolderAddOne(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagAddOneDestinationLoaded(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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())
|
||||
@@ -254,9 +224,7 @@ func TestDestManagAddOneDestinationLoaded(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagCacheWithGetCache(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if err := engine.InitDataDb(destCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -308,9 +276,7 @@ func TestDestManagCacheWithGetCache(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDestManagCacheWithGetCost(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if err := engine.InitDataDb(destCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -279,9 +279,7 @@ func TestRPCITLclStatusBcastRALs1Up(t *testing.T) {
|
||||
|
||||
/*
|
||||
func TestRPCITStatusBcastCmd(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var stats utils.CacheStats
|
||||
if err := rpcRAL1.Call("ApierV2.GetCacheStats", utils.AttrCacheStats{}, &stats); err != nil {
|
||||
t.Error(err)
|
||||
|
||||
@@ -1218,9 +1218,7 @@ func TestTutITSetAccount(t *testing.T) {
|
||||
/*
|
||||
// Make sure all stats queues were updated
|
||||
func TestTutITCdrStatsAfter(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// +build integration
|
||||
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
@@ -29,9 +31,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSMGDataInitCfg(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
daCfgPath = path.Join(*dataDir, "conf", "samples", "smg")
|
||||
// Init config first
|
||||
var err error
|
||||
@@ -45,9 +45,7 @@ func TestSMGDataInitCfg(t *testing.T) {
|
||||
|
||||
// Remove data in both rating and accounting db
|
||||
func TestSMGDataResetDataDb(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if err := engine.InitDataDb(daCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -55,9 +53,7 @@ func TestSMGDataResetDataDb(t *testing.T) {
|
||||
|
||||
// Wipe out the cdr database
|
||||
func TestSMGDataResetStorDb(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if err := engine.InitStorDb(daCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -65,9 +61,7 @@ func TestSMGDataResetStorDb(t *testing.T) {
|
||||
|
||||
// Start CGR Engine
|
||||
func TestSMGDataStartEngine(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := engine.StopStartEngine(daCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -75,9 +69,7 @@ func TestSMGDataStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestSMGDataApierRpcConn(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var err error
|
||||
smgRPC, err = jsonrpc.Dial("tcp", daCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -87,9 +79,7 @@ func TestSMGDataApierRpcConn(t *testing.T) {
|
||||
|
||||
// Load the tariff plan, creating accounts and their balances
|
||||
func TestSMGDataTPFromFolder(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "testtp")}
|
||||
var loadInst utils.LoadInstance
|
||||
if err := smgRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &loadInst); err != nil {
|
||||
@@ -99,9 +89,7 @@ func TestSMGDataTPFromFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataLastUsedData(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 50000000000.000000
|
||||
@@ -194,9 +182,7 @@ func TestSMGDataLastUsedData(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataLastUsedMultipleData(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 49999979520.000000
|
||||
@@ -392,9 +378,7 @@ func TestSMGDataLastUsedMultipleData(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataDerivedChargingNoCredit(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1011"}
|
||||
eAcntVal := 50000.0
|
||||
@@ -436,9 +420,7 @@ func TestSMGDataDerivedChargingNoCredit(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataTTLExpired(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 49999897600.000000
|
||||
@@ -485,9 +467,7 @@ func TestSMGDataTTLExpired(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataTTLExpiredMultiUpdates(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 49998842880.000000
|
||||
@@ -571,9 +551,7 @@ func TestSMGDataTTLExpiredMultiUpdates(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataMultipleDataNoUsage(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 49997767680.000000
|
||||
@@ -769,9 +747,7 @@ func TestSMGDataMultipleDataNoUsage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGDataMultipleDataConstantUsage(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1010"}
|
||||
eAcntVal := 49997767680.000000
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
)
|
||||
|
||||
var cfg, _ = config.NewDefaultCGRConfig()
|
||||
var err error
|
||||
|
||||
func TestSMGenericEventParseFields(t *testing.T) {
|
||||
smGev := SMGenericEvent{}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// +build integration
|
||||
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
@@ -30,19 +32,15 @@ import (
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
var testIntegration = flag.Bool("integration", false, "Perform the tests in integration mode, not by default.") // This flag will be passed here via "go test -local" args
|
||||
var waitRater = flag.Int("wait_rater", 150, "Number of miliseconds to wait for rater to start and cache")
|
||||
var dataDir = flag.String("data_dir", "/usr/share/cgrates", "CGR data dir path here")
|
||||
|
||||
var daCfgPath string
|
||||
var daCfg *config.CGRConfig
|
||||
var smgRPC *rpc.Client
|
||||
var err error
|
||||
|
||||
func TestSMGVoiceInitCfg(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
daCfgPath = path.Join(*dataDir, "conf", "samples", "smg")
|
||||
// Init config first
|
||||
var err error
|
||||
@@ -56,9 +54,7 @@ func TestSMGVoiceInitCfg(t *testing.T) {
|
||||
|
||||
// Remove data in both rating and accounting db
|
||||
func TestSMGVoiceResetDataDb(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if err := engine.InitDataDb(daCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -66,9 +62,7 @@ func TestSMGVoiceResetDataDb(t *testing.T) {
|
||||
|
||||
// Wipe out the cdr database
|
||||
func TestSMGVoiceResetStorDb(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if err := engine.InitStorDb(daCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -76,9 +70,7 @@ func TestSMGVoiceResetStorDb(t *testing.T) {
|
||||
|
||||
// Start CGR Engine
|
||||
func TestSMGVoiceStartEngine(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := engine.StopStartEngine(daCfgPath, *waitRater); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -86,9 +78,7 @@ func TestSMGVoiceStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestSMGVoiceApierRpcConn(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var err error
|
||||
smgRPC, err = jsonrpc.Dial("tcp", daCfg.RPCJSONListen) // We connect over JSON so we can also troubleshoot if needed
|
||||
if err != nil {
|
||||
@@ -98,9 +88,7 @@ func TestSMGVoiceApierRpcConn(t *testing.T) {
|
||||
|
||||
// Load the tariff plan, creating accounts and their balances
|
||||
func TestSMGVoiceTPFromFolder(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")}
|
||||
var loadInst utils.LoadInstance
|
||||
if err := smgRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &loadInst); err != nil {
|
||||
@@ -110,9 +98,7 @@ func TestSMGVoiceTPFromFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceMonetaryRefund(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
utils.TOR: utils.VOICE,
|
||||
@@ -171,9 +157,7 @@ func TestSMGVoiceMonetaryRefund(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceVoiceRefund(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
utils.TOR: utils.VOICE,
|
||||
@@ -232,9 +216,7 @@ func TestSMGVoiceVoiceRefund(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceMixedRefund(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
@@ -306,9 +288,7 @@ func TestSMGVoiceMixedRefund(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceLastUsed(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
eAcntVal := 8.790000
|
||||
@@ -423,9 +403,7 @@ func TestSMGVoiceLastUsed(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceLastUsedEnd(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
eAcntVal := 7.59000
|
||||
@@ -514,9 +492,7 @@ func TestSMGVoiceLastUsedEnd(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceLastUsedNotFixed(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
eAcntVal := 6.59000
|
||||
@@ -605,9 +581,7 @@ func TestSMGVoiceLastUsedNotFixed(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceSessionTTL(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
eAcntVal := 5.590000
|
||||
@@ -711,9 +685,7 @@ func TestSMGVoiceSessionTTL(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceSessionTTLWithRelocate(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
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
|
||||
@@ -831,9 +803,7 @@ func TestSMGVoiceSessionTTLWithRelocate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceRelocateWithOriginIDPrefix(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
attrSetBalance := utils.AttrSetBalance{Tenant: "cgrates.org", Account: "TestRelocateWithOriginIDPrefix",
|
||||
BalanceType: utils.VOICE, BalanceID: utils.StringPointer("TestRelocateWithOriginIDPrefix"),
|
||||
Value: utils.Float64Pointer(300), RatingSubject: utils.StringPointer("*zero1s")}
|
||||
@@ -974,9 +944,7 @@ func TestSMGVoiceRelocateWithOriginIDPrefix(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGVoiceSessionStopCgrEngine(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if err := engine.KillEngine(100); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// +build integration
|
||||
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
@@ -35,9 +37,7 @@ var smgRplcMasterCfg, smgRplcSlaveCfg *config.CGRConfig
|
||||
var smgRplcMstrRPC, smgRplcSlvRPC *rpc.Client
|
||||
|
||||
func TestSMGRplcInitCfg(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
smgRplcMasterCfgPath = path.Join(*dataDir, "conf", "samples", "smgreplcmaster")
|
||||
if smgRplcMasterCfg, err = config.NewCGRConfigFromFolder(smgRplcMasterCfgPath); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -52,9 +52,7 @@ func TestSMGRplcInitCfg(t *testing.T) {
|
||||
|
||||
// Remove data in both rating and accounting db
|
||||
func TestSMGRplcResetDB(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if err := engine.InitDataDb(smgRplcMasterCfg); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -65,9 +63,7 @@ func TestSMGRplcResetDB(t *testing.T) {
|
||||
|
||||
// Start CGR Engine
|
||||
func TestSMGRplcStartEngine(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if _, err := engine.StopStartEngine(smgRplcSlaveCfgPath, *waitRater); err != nil { // Start slave before master
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -78,9 +74,7 @@ func TestSMGRplcStartEngine(t *testing.T) {
|
||||
|
||||
// Connect rpc client to rater
|
||||
func TestSMGRplcApierRpcConn(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if smgRplcMstrRPC, err = jsonrpc.Dial("tcp", smgRplcMasterCfg.RPCJSONListen); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -91,9 +85,7 @@ func TestSMGRplcApierRpcConn(t *testing.T) {
|
||||
|
||||
// Load the tariff plan, creating accounts and their balances
|
||||
func TestSMGRplcTPFromFolder(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "tutorial")}
|
||||
var loadInst utils.LoadInstance
|
||||
if err := smgRplcMstrRPC.Call("ApierV2.LoadTariffPlanFromFolder", attrs, &loadInst); err != nil {
|
||||
@@ -103,9 +95,7 @@ func TestSMGRplcTPFromFolder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGRplcInitiate(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
var pSessions []*ActiveSession
|
||||
if err := smgRplcSlvRPC.Call("SMGenericV1.PassiveSessions", nil, &pSessions); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
@@ -159,9 +149,7 @@ func TestSMGRplcInitiate(t *testing.T) {
|
||||
|
||||
// Update on slave
|
||||
func TestSMGRplcUpdate(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
utils.ACCID: "123451",
|
||||
@@ -206,9 +194,7 @@ func TestSMGRplcUpdate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGRplcTerminate(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
smgEv := SMGenericEvent{
|
||||
utils.EVENT_NAME: "TEST_EVENT",
|
||||
utils.ACCID: "123451",
|
||||
@@ -236,9 +222,7 @@ func TestSMGRplcTerminate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSMGRplcStopCgrEngine(t *testing.T) {
|
||||
if !*testIntegration {
|
||||
return
|
||||
}
|
||||
|
||||
if err := engine.KillEngine(100); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user