mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Updated tests for registrarc
This commit is contained in:
committed by
Dan Christian Bogos
parent
54ee982314
commit
e017c7a292
@@ -310,6 +310,7 @@ func testDispatcherSGetDispatcherHostIDs(t *testing.T) {
|
||||
func testDispatcherSUpdateDispatcherHost(t *testing.T) {
|
||||
var result string
|
||||
dispatcherHost.RemoteHost = &config.RemoteHost{
|
||||
ID: "DspHst1",
|
||||
Address: ":4012",
|
||||
Transport: utils.MetaGOB,
|
||||
TLS: false,
|
||||
|
||||
@@ -93,6 +93,7 @@ func TestLoadConfig(t *testing.T) {
|
||||
utils.MaxOpenConnsCfg: 100.,
|
||||
utils.MaxIdleConnsCfg: 10.,
|
||||
utils.SSLModeCfg: "disable",
|
||||
utils.MysqlLocation: "Local",
|
||||
},
|
||||
}
|
||||
// Loader
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
|
||||
// "rpc_conns": {
|
||||
// "*localhost": {
|
||||
// "conns": [{"address": "127.0.0.1:2012", "transport":"*json"},{"id":"dynconn"}],
|
||||
// "conns": [{"address": "127.0.0.1:2012", "transport":"*json"}],
|
||||
// },
|
||||
// }, // rpc connections definitions
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
|
||||
// "http": { // HTTP server configuration
|
||||
// "json_rpc_url": "/jsonrpc", // JSON RPC relative URL ("" to disable)
|
||||
// "dispatchers_registrar_url": "/dispatchers_registrar", // dispatcherH registrar service relative URL
|
||||
// "registrars_url": "/registrar", // registrar service relative URL
|
||||
// "ws_url": "/ws", // WebSockets relative URL ("" to disable)
|
||||
// "freeswitch_cdrs_url": "/freeswitch_json", // Freeswitch CDRS relative URL ("" to disable)
|
||||
// "http_cdrs": "/cdr_http", // CDRS relative URL ("" to disable)
|
||||
@@ -943,11 +943,19 @@
|
||||
// },
|
||||
|
||||
|
||||
// "dispatcherh":{
|
||||
// "enabled": false,
|
||||
// "dispatchers_conns": [],
|
||||
// "hosts": {},
|
||||
// "register_interval": "5m",
|
||||
// "registrarc":{
|
||||
// "rpc":{
|
||||
// "enabled": false,
|
||||
// "registrars_conns": [],
|
||||
// "hosts": {},
|
||||
// "refresh_interval": "5m",
|
||||
// },
|
||||
// "dispatcher":{
|
||||
// "enabled": false,
|
||||
// "registrars_conns": [],
|
||||
// "hosts": {},
|
||||
// "refresh_interval": "5m",
|
||||
// },
|
||||
// },
|
||||
|
||||
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
{
|
||||
// CGRateS Configuration file
|
||||
//
|
||||
|
||||
|
||||
"general": {
|
||||
"node_id": "ALL",
|
||||
"log_level": 7
|
||||
},
|
||||
|
||||
|
||||
"listen": {
|
||||
"rpc_json": ":6012",
|
||||
"rpc_gob": ":6013",
|
||||
"http": ":6080",
|
||||
},
|
||||
|
||||
"data_db": {
|
||||
"db_type": "mongo",
|
||||
"db_name": "11",
|
||||
"db_port": 27017,
|
||||
},
|
||||
|
||||
|
||||
"stor_db": {
|
||||
"db_type": "mongo",
|
||||
"db_name": "cgrates",
|
||||
"db_port": 27017,
|
||||
},
|
||||
|
||||
|
||||
"rpc_conns": {
|
||||
"conn1": {
|
||||
"strategy": "*first",
|
||||
"conns": [{"address": "127.0.0.1:6012", "transport":"*json"}],
|
||||
},
|
||||
"rplConn": {
|
||||
"strategy": "*broadcast_sync",
|
||||
"conns": [{"address": "127.0.0.1:7012", "transport":"*json"}],
|
||||
},
|
||||
"dispConn": {
|
||||
"strategy": "*first",
|
||||
"conns": [{"address": "http://127.0.0.1:2080/registrar", "transport":"*http_jsonrpc"}]
|
||||
}
|
||||
},
|
||||
|
||||
"attributes": {
|
||||
"enabled": true
|
||||
},
|
||||
|
||||
"rals": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"schedulers": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"chargers": {
|
||||
"enabled": true,
|
||||
"attributes_conns": ["*internal"],
|
||||
},
|
||||
|
||||
"thresholds": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"routes": {
|
||||
"enabled": true,
|
||||
"rals_conns": ["*internal"]
|
||||
},
|
||||
|
||||
"stats": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"resources": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
|
||||
"rates": {
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
|
||||
"cdrs": {
|
||||
"enabled": true,
|
||||
"chargers_conns":["*internal"],
|
||||
"rals_conns": ["*internal"],
|
||||
},
|
||||
|
||||
"sessions": {
|
||||
"enabled": true,
|
||||
"listen_bijson": ":6014",
|
||||
"routes_conns": ["*internal"],
|
||||
"resources_conns": ["*internal"],
|
||||
"attributes_conns": ["*internal"],
|
||||
"rals_conns": ["*internal"],
|
||||
"chargers_conns": ["*internal"],
|
||||
"cdrs_conns": ["*internal"],
|
||||
},
|
||||
|
||||
"apiers": {
|
||||
"enabled": true,
|
||||
"caches_conns":["conn1"],
|
||||
"scheduler_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"dispatcherh":{
|
||||
"enabled": true,
|
||||
"dispatchers_conns": ["dispConn"],
|
||||
"hosts": {
|
||||
"*default":[{"ID":"ALL", "register_transport": "*json", "register_tls": false}]
|
||||
},
|
||||
"register_interval": "1s",
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
@@ -103,15 +103,16 @@
|
||||
"scheduler_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"dispatcherh":{
|
||||
"enabled": true,
|
||||
"dispatchers_conns": ["dispConn"],
|
||||
"hosts": {
|
||||
"*default":[{"ID":"ALL", "register_transport": "*json", "register_tls": false}]
|
||||
},
|
||||
"register_interval": "1s",
|
||||
},
|
||||
|
||||
|
||||
"registrarc":{
|
||||
"dispatcher":{
|
||||
"enabled": true,
|
||||
"registrars_conns": ["dispConn"],
|
||||
"hosts": {
|
||||
"*default":[{"ID":"ALL2", "transport": "*json", "tls": false}]
|
||||
},
|
||||
"refresh_interval": "1s",
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
@@ -103,14 +103,6 @@
|
||||
|
||||
|
||||
"registrarc":{
|
||||
"rpc":{
|
||||
"enabled": true,
|
||||
"registrars_conns": ["dispConn"],
|
||||
"hosts": {
|
||||
"*default":[{"ID":"ALL2", "transport": "*json", "tls": false}]
|
||||
},
|
||||
"refresh_interval": "1s",
|
||||
},
|
||||
"dispatcher":{
|
||||
"enabled": true,
|
||||
"registrars_conns": ["dispConn"],
|
||||
@@ -107,13 +107,16 @@
|
||||
"scheduler_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"dispatcherh":{
|
||||
"enabled": true,
|
||||
"dispatchers_conns": [],
|
||||
"hosts": {},
|
||||
"register_interval": "5m"
|
||||
},
|
||||
|
||||
|
||||
"registrarc":{
|
||||
"dispatcher":{
|
||||
"enabled": true,
|
||||
"registrars_conns": ["dispConn"],
|
||||
"hosts": {
|
||||
"*default":[{"ID":"ALL2", "transport": "*json", "tls": false}]
|
||||
},
|
||||
"refresh_interval": "1s",
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
@@ -105,15 +105,17 @@
|
||||
"scheduler_conns": ["*internal"],
|
||||
},
|
||||
|
||||
|
||||
"dispatcherh":{
|
||||
"enabled": true,
|
||||
"dispatchers_conns": ["dispConn"],
|
||||
"hosts": {
|
||||
"*default":[{"ID":"ALL2", "register_transport": "*json", "register_tls": false}]
|
||||
},
|
||||
"register_interval": "1s",
|
||||
},
|
||||
|
||||
"registrarc":{
|
||||
"dispatcher":{
|
||||
"enabled": true,
|
||||
"registrars_conns": ["dispConn"],
|
||||
"hosts": {
|
||||
"*default":[{"ID":"ALL2", "transport": "*json", "tls": false}]
|
||||
},
|
||||
"refresh_interval": "1s",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -82,9 +82,9 @@ func TestDspHosts(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDsphInitCfg(t *testing.T) {
|
||||
dspCfgPath = path.Join(*dataDir, "conf", "samples", "dispatcherh", dspDir)
|
||||
allCfgPath = path.Join(*dataDir, "conf", "samples", "dispatcherh", allDir)
|
||||
all2CfgPath = path.Join(*dataDir, "conf", "samples", "dispatcherh", all2Dir)
|
||||
dspCfgPath = path.Join(*dataDir, "conf", "samples", "registrarc", dspDir)
|
||||
allCfgPath = path.Join(*dataDir, "conf", "samples", "registrarc", allDir)
|
||||
all2CfgPath = path.Join(*dataDir, "conf", "samples", "registrarc", all2Dir)
|
||||
var err error
|
||||
if dspCfg, err = config.NewCGRConfigFromPath(dspCfgPath); err != nil {
|
||||
t.Error(err)
|
||||
@@ -112,7 +112,7 @@ func testDsphStartEngine(t *testing.T) {
|
||||
}
|
||||
|
||||
func testDsphLoadData(t *testing.T) {
|
||||
loader := exec.Command("cgr-loader", "-config_path", dspCfgPath, "-path", path.Join(*dataDir, "tariffplans", "dispatcherh"), "-caches_address=")
|
||||
loader := exec.Command("cgr-loader", "-config_path", dspCfgPath, "-path", path.Join(*dataDir, "tariffplans", "registrarc"), "-caches_address=")
|
||||
output := bytes.NewBuffer(nil)
|
||||
outerr := bytes.NewBuffer(nil)
|
||||
loader.Stdout = output
|
||||
|
||||
@@ -68,7 +68,7 @@ func TestDispatcherHReload(t *testing.T) {
|
||||
|
||||
var reply string
|
||||
if err := cfg.V1ReloadConfig(&config.ReloadArgs{
|
||||
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "dispatcherh", "all_mongo"),
|
||||
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "registrarc", "all_mongo"),
|
||||
Section: config.RegistrarCJson,
|
||||
}, &reply); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user