Merge pull request #1879 from adragusin/master

Updated IT tests in general_tests
This commit is contained in:
Dan Christian Bogos
2020-01-20 17:32:46 +01:00
committed by GitHub
29 changed files with 727 additions and 98 deletions

View File

@@ -0,0 +1,134 @@
{
// CGRateS Configuration file
//
// Used in apier_local_tests
// Starts rater, cdrs and mediator connecting over internal channel
"general": {
"log_level": 7,
"poster_attempts": 1,
},
"data_db": {
"db_type": "mongo",
"db_name": "10",
"db_port": 27017,
},
"stor_db": {
"db_type": "mongo",
"db_name": "cgrates",
"db_port": 27017,
},
"rals": {
"enabled": true, // enable Rater service: <true|false>
},
"cdrs": {
"enabled": true, // start the CDR Server service: <true|false>
"store_cdrs": false, // store cdrs in storDb
"chargers_conns":["*internal"],
"rals_conns": ["*internal"],
"online_cdr_exports": ["http_localhost", "amqp_localhost", "http_test_file", "amqp_test_file","aws_test_file","sqs_test_file","kafka_localhost","s3_test_file"],
},
"chargers": {
"enabled": true,
},
"cdre": {
"http_localhost": {
"export_format": "*http_post",
"export_path": "http://127.0.0.1:12080/cdr_http",
"content_fields": [ // template of the exported content fields
{"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"},
{"tag":"RunID", "type": "*composed", "value": "~RunID", "field_id": "RunID"},
{"tag":"TOR", "type": "*composed", "value": "~ToR", "field_id": "ToR"},
{"tag":"OriginID", "type": "*composed", "value": "~OriginID", "field_id": "OriginID"},
{"tag":"OriginHost", "type": "*composed", "value": "~OriginHost", "field_id": "OriginHost"},
{"tag":"RequestType", "type": "*composed", "value": "~RequestType", "field_id": "RequestType"},
{"tag":"Direction", "type": "*composed", "value": "~Direction", "field_id": "Direction"},
{"tag":"Tenant", "type": "*composed", "value": "~Tenant", "field_id": "Tenant"},
{"tag":"Category", "type": "*composed", "value": "~Category", "field_id": "Category"},
{"tag":"Account", "type": "*composed", "value": "~Account", "field_id": "Account"},
{"tag":"Subject", "type": "*composed", "value": "~Subject", "field_id": "Subject"},
{"tag":"Destination", "type": "*composed", "value": "~Destination", "field_id": "Destination"},
{"tag":"SetupTime", "type": "*composed", "value": "~SetupTime", "layout": "2006-01-02T15:04:05Z07:00", "field_id": "SetupTime"},
{"tag":"AnswerTime", "type": "*composed", "value": "~AnswerTime", "layout": "2006-01-02T15:04:05Z07:00", "field_id": "AnswerTime"},
{"tag":"Usage", "type": "*composed", "value": "~Usage", "field_id": "Usage"},
{"tag":"Cost", "type": "*composed", "value": "~Cost", "field_id": "Cost"},
],
},
"amqp_localhost": {
"export_format": "*amqp_json_map",
"export_path": "amqp://guest:guest@localhost:5672/?queue_id=cgrates_cdrs&exchange=exchangename&exchange_type=fanout&routing_key=cgr_cdrs",
"attempts": 3,
"content_fields": [ // template of the exported content fields
{"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"},
{"tag":"RunID", "type": "*composed", "value": "~RunID", "field_id": "RunID"},
{"tag":"TOR", "type": "*composed", "value": "~ToR", "field_id": "ToR"},
{"tag":"OriginID", "type": "*composed", "value": "~OriginID", "field_id": "OriginID"},
{"tag":"OriginHost", "type": "*composed", "value": "~OriginHost", "field_id": "OriginHost"},
{"tag":"RequestType", "type": "*composed", "value": "~RequestType", "field_id": "RequestType"},
{"tag":"Direction", "type": "*composed", "value": "~Direction", "field_id": "Direction"},
{"tag":"Tenant", "type": "*composed", "value": "~Tenant", "field_id": "Tenant"},
{"tag":"Category", "type": "*composed", "value": "~Category", "field_id": "Category"},
{"tag":"Account", "type": "*composed", "value": "~Account", "field_id": "Account"},
{"tag":"Subject", "type": "*composed", "value": "~Subject", "field_id": "Subject"},
{"tag":"Destination", "type": "*composed", "value": "~Destination", "field_id": "Destination"},
{"tag":"SetupTime", "type": "*composed", "value": "~SetupTime", "layout": "2006-01-02T15:04:05Z07:00", "field_id": "SetupTime"},
{"tag":"AnswerTime", "type": "*composed", "value": "~AnswerTime", "layout": "2006-01-02T15:04:05Z07:00", "field_id": "AnswerTime"},
{"tag":"Usage", "type": "*composed", "value": "~Usage", "field_id": "Usage"},
{"tag":"Cost", "type": "*composed", "value": "~Cost", "field_id": "Cost"},
],
},
"http_test_file": {
"export_format": "*http_post",
"export_path": "http://127.0.0.1:12080/invalid",
"content_fields": [
{"tag": "OriginID", "type": "*composed", "value": "~OriginID", "field_id": "OriginID"},
],
},
"aws_test_file": {
"export_format": "*amqpv1_json_map",
"export_path": "amqps://guest:guest@localhost:25672/?queue_id=cgrates_cdrs",
"content_fields": [
{"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"},
],
},
"sqs_test_file": {
"export_format": "*sqs_json_map",
// export_path for sqs: "endpoint?aws_region=region&aws_key=IDkey&aws_secret=secret&aws_token=sessionToken&queue_id=cgrates-cdrs"
"export_path": "http://sqs.eu-west-2.amazonaws.com/?aws_region=eu-west-2&aws_key=testkey&aws_secret=testsecret&queue_id=cgrates-cdrs",
"content_fields": [
{"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"},
],
},
"amqp_test_file": {
"export_format": "*amqp_json_map",
"export_path": "amqp://guest:guest@localhost:25672/?queue_id=cgrates_cdrs",
"content_fields": [
{"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"},
],
},
"kafka_localhost": {
"export_format": "*kafka_json_map",
"export_path": "localhost:9092?topic=cgrates_cdrs",
"content_fields": [
{"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"},
],
},
"s3_test_file": {
"export_format": "*s3_json_map",
// export_path for s3: "endpoint?aws_region=region&aws_key=IDkey&aws_secret=secret&aws_token=sessionToken&queue_id=cgrates-cdrs"
"export_path": "http://s3.us-east-2.amazonaws.com/?aws_region=eu-west-2&aws_key=testkey&aws_secret=testsecret&queue_id=cgrates-cdrs",
"content_fields": [
{"tag": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"},
],
},
},
}

View File

@@ -9,6 +9,11 @@
"poster_attempts": 1,
},
"data_db": {
"db_type": "redis",
"db_port": 6379,
"db_name": "10",
},
"stor_db": { // database used to store offline tariff plans and CDRs
"db_password": "CGRateS.org", // password to use when connecting to stordb

View File

@@ -0,0 +1,40 @@
{
// CGRateS Configuration file
//
// Used in apier_local_tests
// Starts rater, cdrs and mediator connecting over internal channel
"listen": {
"rpc_json": "127.0.0.1:12012", // RPC JSON listening address
"rpc_gob": "127.0.0.1:12013", // RPC GOB listening address
"http": "127.0.0.1:12080", // HTTP listening address
},
"data_db": {
"db_type": "mongo",
"db_name": "10",
"db_port": 27017,
},
"stor_db": {
"db_type": "mongo",
"db_name": "cgrates",
"db_port": 27017,
},
"rals": {
"enabled": true, // enable Rater service: <true|false>
},
"cdrs": {
"enabled": true, // start the CDR Server service: <true|false>
"chargers_conns":["*internal"],
"rals_conns": ["*internal"],
},
"chargers": {
"enabled": true,
},
}

View File

@@ -10,6 +10,12 @@
"http": "127.0.0.1:12080", // HTTP listening address
},
"data_db": {
"db_type": "redis",
"db_port": 6379,
"db_name": "10",
},
"stor_db": { // database used to store offline tariff plans and CDRs
"db_password": "CGRateS.org", // password to use when connecting to stordb
},

View File

@@ -0,0 +1,30 @@
{
// CGRateS Configuration file
//
// Used for multiple RAL configuration tests
// Starts rater, scheduler
"general": {
"node_id":"node1",
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"data_db": {
"db_type": "*internal",
},
"stor_db": {
"db_type": "*internal",
},
"rals": {
"enabled": true, // enable Rater service: <true|false>
},
}

View File

@@ -0,0 +1,34 @@
{
// CGRateS Configuration file
//
// Used for multiple RAL configuration tests
// Starts rater, scheduler
"general": {
"node_id":"node1",
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"data_db": {
"db_type": "mongo",
"db_name": "10",
"db_port": 27017,
},
"stor_db": {
"db_type": "mongo",
"db_name": "cgrates",
"db_port": 27017,
},
"rals": {
"enabled": true, // enable Rater service: <true|false>
},
}

View File

@@ -14,6 +14,12 @@
"http": ":2080", // HTTP listening address
},
"data_db": {
"db_type": "redis",
"db_port": 6379,
"db_name": "10",
},
"stor_db": { // database used to store offline tariff plans and CDRs
"db_password": "CGRateS.org", // password to use when connecting to stordb
},

View File

@@ -0,0 +1,42 @@
{
// CGRateS Configuration file
//
// Used for multiple RAL configuration tests
// Starts RAL
"general": {
"node_id":"node2",
},
"listen": {
"rpc_json": ":12012",
"rpc_gob": ":12013",
"http": ":12080",
},
"data_db": {
"db_type": "*internal",
},
"stor_db": {
"db_type": "*internal",
},
"rals": {
"enabled": true,
},
"cdrs": {
"enabled": true,
},
"chargers": {
"enabled": true,
},
"sessions": {
"enabled": true,
},
}

View File

@@ -0,0 +1,45 @@
{
// CGRateS Configuration file
//
// Used for multiple RAL configuration tests
// Starts RAL
"general": {
"node_id":"node2",
},
"listen": {
"rpc_json": ":12012",
"rpc_gob": ":12013",
"http": ":12080",
},
"data_db": {
"db_type": "mongo",
"db_name": "10",
"db_port": 27017,
},
"stor_db": {
"db_type": "mongo",
"db_name": "cgrates",
"db_port": 27017,
},
"rals": {
"enabled": true,
},
"cdrs": {
"enabled": true,
},
"chargers": {
"enabled": true,
},
"sessions": {
"enabled": true,
},
}

View File

@@ -14,6 +14,12 @@
"http": ":12080",
},
"data_db": {
"db_type": "redis",
"db_port": 6379,
"db_name": "10",
},
"stor_db": { // database used to store offline tariff plans and CDRs
"db_password": "CGRateS.org", // password to use when connecting to stordb
},

View File

@@ -1,76 +0,0 @@
{
"general": {
"log_level": 7,
"reply_timeout": "10s", // consider connection down for replies taking longer than this value
},
"listen": {
"rpc_json": ":2012",
"rpc_gob": ":2013",
"http": ":2080",
},
"data_db": {
"db_type": "*internal",
},
"stor_db": {
"db_type": "*internal",
},
"caches":{
"*rpc_responses": {"limit": -1, "ttl": "1s"},
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
"session_cost_retries": 2, // number of queries to session_costs before recalculating CDR
},
"attributes": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"],
},
"thresholds": {
"enabled": true,
"store_interval": "-1",
},
"sessions": {
"enabled": true,
"chargers_conns": ["*internal"],
"rals_conns": ["*internal"],
"cdrs_conns": ["*internal"],
"attributes_conns": ["*internal"],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,72 @@
{
// Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
// Copyright (C) ITsysCOM GmbH
"general": {
"log_level": 7,
"node_id":"MasterReplication",
},
"listen": {
"rpc_json": "127.0.0.1:2012",
"rpc_gob": "127.0.0.1:2013",
"http": "127.0.0.1:2080",
},
"rpc_conns": {
"rplConn": {
"strategy": "*broadcast_sync",
"conns": [{"address": "127.0.0.1:22012", "transport": "*json"}],
},
},
"data_db": {
"db_type": "mongo",
"db_name": "10",
"db_port": 27017,
},
"stor_db": {
"db_type": "mongo",
"db_name": "cgrates",
"db_port": 27017,
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
},
"attributes": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"],
},
"sessions": {
"enabled": true,
"debit_interval": "5ms", // interval to perform debits on.
"replication_conns": ["rplConn"],
"rals_conns": ["*internal"],
"cdrs_conns": ["*internal"],
"chargers_conns": ["*internal"],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,77 @@
{
// Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
// Copyright (C) ITsysCOM GmbH
"general": {
"log_level": 7,
"node_id":"SlaveReplication",
},
"listen": {
"rpc_json": "127.0.0.1:22012", // RPC JSON listening address
"rpc_gob": "127.0.0.1:22013", // RPC GOB listening address
"http": "127.0.0.1:22080", // HTTP listening address
},
"rpc_conns": {
"conn1": {
"strategy": "*first",
"conns": [{"address": "127.0.0.1:22012", "transport":"*json"}],
},
"rplConn": {
"strategy": "*broadcast",
"conns": [{"address": "127.0.0.1:2012", "transport": "*json"}],
}
},
"data_db": {
"db_type": "mongo",
"db_name": "10",
"db_port": 27017,
},
"stor_db": {
"db_type": "mongo",
"db_name": "cgrates",
"db_port": 27017,
},
"rals": {
"enabled": true, // enable Rater service: <true|false>
},
"cdrs": {
"enabled": true, // start the CDR Server service: <true|false>
},
"schedulers": {
"enabled": true,
},
"attributes": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"],
},
"sessions": {
"enabled": true, // starts SessionManager service: <true|false>
"debit_interval": "5ms", // interval to perform debits on.
"listen_bijson": "127.0.0.1:22014", // address where to listen for bidirectional JSON-RPC requests
"replication_conns": ["rplConn"],
"rals_conns": ["conn1"],
"cdrs_conns": ["*internal"],
"chargers_conns": ["*internal"],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,121 @@
{
// CGRateS Configuration file
//
// used by gen/cdre_it_test.go
"general": {
"log_level": 7,
"reply_timeout": "50s",
},
"listen": {
"rpc_json": ":2012",
"rpc_gob": ":2013",
"http": ":2080",
},
"data_db": {
"db_type": "*internal",
},
"stor_db": {
"db_type": "*internal",
},
"rals": {
"enabled": true,
"thresholds_conns": ["*internal"],
"max_increments":3000000,
},
"schedulers": {
"enabled": true,
"cdrs_conns": ["*internal"],
},
"cdre": {
"TestTutITExportCDR": {
"content_fields": [
{"tag": "CGRID", "type": "*composed", "value": "~CGRID"},
{"tag": "RunID", "type": "*composed", "value": "~RunID"},
{"tag":"OriginID", "type": "*composed", "value": "~OriginID"},
{"tag":"RequestType", "type": "*composed", "value": "~RequestType"},
{"tag":"Tenant", "type": "*composed", "value": "~Tenant"},
{"tag":"Category", "type": "*composed", "value": "~Category"},
{"tag":"Account", "type": "*composed", "value": "~Account"},
{"tag":"Destination", "type": "*composed", "value": "~Destination"},
{"tag":"AnswerTime", "type": "*composed", "value": "~AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"},
{"tag":"Usage", "type": "*composed", "value": "~Usage"},
{"tag":"Cost", "type": "*composed", "value": "~Cost", "rounding_decimals": 4},
{"tag":"MatchedDestinationID", "type": "*composed", "value": "~CostDetails:s/\"MatchedDestId\":.*_(\\w{4})/${1}/:s/\"MatchedDestId\":\"INTERNAL\"/ON010/"},
],
},
},
"cdrs": {
"enabled": true,
"chargers_conns":["*internal"],
},
"attributes": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"],
},
"resources": {
"enabled": true,
"store_interval": "-1",
"thresholds_conns": ["*internal"]
},
"stats": {
"enabled": true,
"store_interval": "-1",
"thresholds_conns": ["*internal"],
},
"thresholds": {
"enabled": true,
"store_interval": "-1",
},
"suppliers": {
"enabled": true,
"prefix_indexed_fields":["Destination"],
"stats_conns": ["*internal"],
"resources_conns": ["*internal"],
},
"sessions": {
"enabled": true,
"suppliers_conns": ["*internal"],
"resources_conns": ["*internal"],
"attributes_conns": ["*internal"],
"rals_conns": ["*internal"],
"cdrs_conns": ["*internal"],
"chargers_conns": ["*internal"],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -608,6 +608,9 @@ func (iDB *InternalDB) UpdateReverseDestinationDrv(oldDest, newDest *Destination
var mpRevDst utils.StringMap
var addedPrefixes []string
var found bool
if oldDest == nil {
oldDest = new(Destination) // so we can process prefixes
}
for _, oldPrefix := range oldDest.Prefixes {
found = false
for _, newPrefix := range newDest.Prefixes {

View File

@@ -55,7 +55,7 @@ var (
func TestCDREIT(t *testing.T) {
switch *dbType {
case utils.MetaInternal:
cdreConfigDIR = "tutinternal"
cdreConfigDIR = "tutinternal_new"
case utils.MetaSQL:
cdreConfigDIR = "tutmysql"
case utils.MetaMongo:

View File

@@ -443,7 +443,7 @@ func testV2CDRsGetCdrs4(t *testing.T) {
func testV2CDRsGetCdrs5(t *testing.T) {
var cdrCnt int64
req := utils.AttrGetCdrs{Accounts: []string{"testV2CDRsProcessCDR5"}}
req := utils.RPCCDRsFilter{Accounts: []string{"testV2CDRsProcessCDR5"}}
if err := cdrsRpc.Call(utils.ApierV2CountCDRs, req, &cdrCnt); err != nil {
t.Error("Unexpected error: ", err.Error())
} else if cdrCnt != 0 {

View File

@@ -43,6 +43,7 @@ import (
var (
cdrsMasterCfgPath, cdrsSlaveCfgPath string
cdrsMasterCfgDIR, cdrsSlaveCfgDIR string
cdrsMasterCfg, cdrsSlaveCfg *config.CGRConfig
cdrsMasterRpc *rpcclient.RPCClient
httpCGRID = utils.UUIDSha1Prefix()
@@ -71,18 +72,33 @@ var (
)
func TestCDRsOnExp(t *testing.T) {
switch *dbType {
case utils.MetaInternal:
t.SkipNow()
case utils.MetaSQL:
cdrsMasterCfgDIR = "cdrsonexpmaster_mysql"
cdrsSlaveCfgDIR = "cdrsonexpslave_mysql"
case utils.MetaMongo:
cdrsMasterCfgDIR = "cdrsonexpmaster_mongo"
cdrsSlaveCfgDIR = "cdrsonexpslave_mongo"
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
for _, stest := range sTestsCDRsOnExp {
t.Run("TestCDRsOnExp", stest)
t.Run(*dbType, stest)
}
}
func testCDRsOnExpInitConfig(t *testing.T) {
var err error
cdrsMasterCfgPath = path.Join(*dataDir, "conf", "samples", "cdrsonexpmaster")
cdrsMasterCfgPath = path.Join(*dataDir, "conf", "samples", cdrsMasterCfgDIR)
if cdrsMasterCfg, err = config.NewCGRConfigFromPath(cdrsMasterCfgPath); err != nil {
t.Fatal("Got config error: ", err.Error())
}
cdrsSlaveCfgPath = path.Join(*dataDir, "conf", "samples", "cdrsonexpslave")
cdrsSlaveCfgPath = path.Join(*dataDir, "conf", "samples", cdrsSlaveCfgDIR)
if cdrsSlaveCfg, err = config.NewCGRConfigFromPath(cdrsSlaveCfgPath); err != nil {
t.Fatal("Got config error: ", err.Error())
}

View File

@@ -72,7 +72,7 @@ var (
func TestRPCMethods(t *testing.T) {
switch *dbType {
case utils.MetaInternal:
rpcConfDIR = "rpccaching_internal"
t.SkipNow()
case utils.MetaSQL:
rpcConfDIR = "rpccaching_mysql"
case utils.MetaMongo:

View File

@@ -39,6 +39,7 @@ var testRemoteRALs = flag.Bool("remote_rals", false, "Perform the tests in integ
var ( // shared vars
rpcITCfgPath1, rpcITCfgPath2 string
rpcITCfgDIR1, rpcITCfgDIR2 string
rpcITCfg1, rpcITCfg2 *config.CGRConfig
rpcRAL1, rpcRAL2 *rpcclient.RPCClient
rpcPoolFirst, rpcPoolBroadcast *rpcclient.RPCPool
@@ -72,14 +73,29 @@ var sTestRPCITLcl = []func(t *testing.T){
}
func TestRPCITLcl(t *testing.T) {
switch *dbType {
case utils.MetaInternal:
rpcITCfgDIR1 = "multiral1_internal"
rpcITCfgDIR2 = "multiral2_internal"
case utils.MetaSQL:
rpcITCfgDIR1 = "multiral1_mysql"
rpcITCfgDIR2 = "multiral2_mysql"
case utils.MetaMongo:
rpcITCfgDIR1 = "multiral1_mongo"
rpcITCfgDIR2 = "multiral2_mongo"
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
for _, stest := range sTestRPCITLcl {
t.Run("sTestRPCITLcl", stest)
t.Run(*dbType, stest)
}
}
func testRPCITLclInitCfg(t *testing.T) {
rpcITCfgPath1 = path.Join(*dataDir, "conf", "samples", "multiral1")
rpcITCfgPath2 = path.Join(*dataDir, "conf", "samples", "multiral2")
rpcITCfgPath1 = path.Join(*dataDir, "conf", "samples", rpcITCfgDIR1)
rpcITCfgPath2 = path.Join(*dataDir, "conf", "samples", rpcITCfgDIR2)
rpcITCfg1, err = config.NewCGRConfigFromPath(rpcITCfgPath1)
if err != nil {
t.Error(err)

View File

@@ -64,11 +64,22 @@ var (
// Sentinel1 will be started at port 16381 and will watch Node1
// Sentinel2 will be started at port 16382 and will watch Node1
func TestRedisSentinel(t *testing.T) {
switch *dbType {
case utils.MetaInternal:
t.SkipNow()
case utils.MetaSQL:
case utils.MetaMongo:
t.SkipNow()
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
if !*redisSentinel {
return
}
for _, stest := range sTestsRds {
t.Run("", stest)
t.Run("TestRedisSentinel", stest)
}
}

View File

@@ -35,6 +35,7 @@ import (
var (
smgRplcMasterCfgPath, smgRplcSlaveCfgPath string
smgRplcMasterCfgDIR, smgRplcSlaveCfgDIR string
smgRplcMasterCfg, smgRplcSlaveCfg *config.CGRConfig
smgRplcMstrRPC, smgRplcSlvRPC *rpc.Client
masterEngine *exec.Cmd
@@ -54,8 +55,23 @@ var (
)
func TestSessionSRpl(t *testing.T) {
switch *dbType {
case utils.MetaInternal:
t.SkipNow()
case utils.MetaSQL:
smgRplcMasterCfgDIR = "smgreplcmaster_mysql"
smgRplcSlaveCfgDIR = "smgreplcslave_mysql"
case utils.MetaMongo:
smgRplcMasterCfgDIR = "smgreplcmaster_mongo"
smgRplcSlaveCfgDIR = "smgreplcslave_mongo"
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
for _, stest := range sTestsSession {
t.Run("TestSessionSRpl", stest)
t.Run(*dbType, stest)
}
}
@@ -93,13 +109,13 @@ func testSessionSRplAddVoiceBalance(t *testing.T) {
//Init Config
func testSessionSRplInitCfg(t *testing.T) {
smgRplcMasterCfgPath = path.Join(*dataDir, "conf", "samples", "sessions_replication", "smgreplcmaster")
smgRplcMasterCfgPath = path.Join(*dataDir, "conf", "samples", "sessions_replication", smgRplcMasterCfgDIR)
if smgRplcMasterCfg, err = config.NewCGRConfigFromPath(smgRplcMasterCfgPath); err != nil {
t.Fatal(err)
}
smgRplcMasterCfg.DataFolderPath = *dataDir
config.SetCgrConfig(smgRplcMasterCfg)
smgRplcSlaveCfgPath = path.Join(*dataDir, "conf", "samples", "sessions_replication", "smgreplcslave")
smgRplcSlaveCfgPath = path.Join(*dataDir, "conf", "samples", "sessions_replication", smgRplcSlaveCfgDIR)
if smgRplcSlaveCfg, err = config.NewCGRConfigFromPath(smgRplcSlaveCfgPath); err != nil {
t.Fatal(err)
}

View File

@@ -27,6 +27,8 @@ import (
)
func TestSMSSetStorageSmsChrg1(t *testing.T) {
dflt, _ := config.NewDefaultCGRConfig()
config.SetCgrConfig(dflt)
config.CgrConfig().CacheCfg()[utils.CacheRatingPlans].Precache = true // precache rating plan
data := engine.NewInternalDB(nil, nil, true, config.CgrConfig().DataDbCfg().Items)
dataDB = engine.NewDataManager(data, config.CgrConfig().CacheCfg(), nil)

View File

@@ -35,6 +35,7 @@ import (
var (
tutSMGCfgPath string
tutSMGCfgDIR string
tutSMGCfg *config.CGRConfig
tutSMGRpc *rpc.Client
smgLoadInst utils.LoadInstance // Share load information between tests
@@ -52,13 +53,26 @@ var (
)
func TestTutSMG(t *testing.T) {
switch *dbType {
case utils.MetaInternal:
t.SkipNow()
case utils.MetaSQL:
tutSMGCfgDIR = "smgeneric_mysql"
case utils.MetaMongo:
t.SkipNow()
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
//mongo and sql tutmongo tutmysql
for _, stest := range sTestTutSMG {
t.Run("TestTutSMG", stest)
t.Run(tutSMGCfgDIR, stest)
}
}
func testTutSMGInitCfg(t *testing.T) {
tutSMGCfgPath = path.Join(*dataDir, "conf", "samples", "smgeneric")
tutSMGCfgPath = path.Join(*dataDir, "conf", "samples", tutSMGCfgDIR)
// Init config first
var err error
tutSMGCfg, err = config.NewCGRConfigFromPath(tutSMGCfgPath)

View File

@@ -66,6 +66,9 @@ func TestTutorial2(t *testing.T) {
default:
t.Fatal("Unknown Database type")
}
if *encoding == utils.MetaGOB {
tutCfgDir += "_gob"
}
for _, stest := range sTutTests {
t.Run(tutCfgDir, stest)
@@ -75,9 +78,6 @@ func TestTutorial2(t *testing.T) {
func testTutLoadConfig(t *testing.T) {
var err error
tutCfgPath = path.Join(*dataDir, "conf", "samples", tutCfgDir)
if *encoding == utils.MetaGOB {
tutCfgPath = path.Join(*dataDir, "conf", "samples", tutCfgDir+"_gob")
}
if tutCfg, err = config.NewCGRConfigFromPath(tutCfgPath); err != nil {
t.Error(err)
}

View File

@@ -16,10 +16,12 @@ en_internal=$?
echo 'go test github.com/cgrates/cgrates/ers -tags=integration -dbtype=*internal'
go test github.com/cgrates/cgrates/ers -tags=integration -dbtype=*internal
ers_internal=$?
echo 'go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*internal'
go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*internal
lds_internal=$?
echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*internal'
go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*internal
gnr_internal=$?
# SQL
echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*sql'
go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*sql
@@ -36,6 +38,9 @@ ers_sql=$?
echo 'go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*sql'
go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*sql
lds_sql=$?
echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*sql'
go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*sql
gnr_sql=$?
# Mongo
echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*mongo'
go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*mongo
@@ -52,6 +57,9 @@ ers_mongo=$?
echo 'go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*mongo'
go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*mongo
lds_mongo=$?
echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*mongo'
go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*mongo
gnr_mongo=$?
# Postgres
echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*postgres'
go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*postgres
@@ -68,6 +76,9 @@ ers_postgres=$?
echo 'go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*postgres'
go test github.com/cgrates/cgrates/loaders -tags=integration -dbtype=*postgres
lds_postgres=$?
echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*postgres'
go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*postgres
gnr_postgres=$?
echo 'go test github.com/cgrates/cgrates/cdrc -tags=integration'
go test github.com/cgrates/cgrates/cdrc -tags=integration
@@ -77,9 +88,7 @@ go test github.com/cgrates/cgrates/config -tags=integration
cfg=$?
#All
echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration'
go test github.com/cgrates/cgrates/general_tests -tags=integration
gnr=$?
echo 'go test github.com/cgrates/cgrates/agents -tags=integration'
go test github.com/cgrates/cgrates/agents -tags=integration
agts=$?