Updated dispatcherH integration tests

This commit is contained in:
Trial97
2020-11-05 09:48:26 +02:00
committed by Dan Christian Bogos
parent 568df81745
commit 31c635e3f7
10 changed files with 17 additions and 13 deletions

View File

@@ -719,7 +719,7 @@ func (cfg *CGRConfig) checkConfigSanity() error {
if !has {
return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.DispatcherH, connID)
}
if len(connCfg.Conns) != 0 {
if len(connCfg.Conns) != 1 {
return fmt.Errorf("<%s> connection with id: <%s> needs to have only one host", utils.DispatcherH, connID)
}
if connCfg.Conns[0].Transport != rpcclient.HTTPjson {

View File

@@ -36,7 +36,7 @@
},
"dispConn": {
"strategy": "*first",
"conns": [{"address": "127.0.0.1:2012/registar", "transport":"*http_jsonrpc"}]
"conns": [{"address": "http://127.0.0.1:2080/dispatchers_registrar", "transport":"*http_jsonrpc"}]
}
},
@@ -105,7 +105,7 @@
"dispatcherh":{
"enabled": false,
"enabled": true,
"dispatchers_conns": ["dispConn"],
"hosts": {
"*default":[{"ID":"ALL", "register_transport": "*json", "register_tls": false}]

View File

@@ -34,7 +34,7 @@
},
"dispConn": {
"strategy": "*first",
"conns": [{"address": "127.0.0.1:2012/registar", "transport":"*http_jsonrpc"}]
"conns": [{"address": "http://127.0.0.1:2080/dispatchers_registrar", "transport":"*http_jsonrpc"}]
}
},
@@ -104,7 +104,7 @@
"dispatcherh":{
"enabled": false,
"enabled": true,
"dispatchers_conns": ["dispConn"],
"hosts": {
"*default":[{"ID":"ALL2", "register_transport": "*json", "register_tls": false}]

View File

@@ -40,7 +40,7 @@
},
"dispConn": {
"strategy": "*first",
"conns": [{"address": "127.0.0.1:2012/registar", "transport":"*http_jsonrpc"}]
"conns": [{"address": "http://127.0.0.1:2080/dispatchers_registrar", "transport":"*http_jsonrpc"}]
}
},
@@ -109,7 +109,7 @@
"dispatcherh":{
"enabled": false,
"enabled": true,
"dispatchers_conns": ["dispConn"],
"hosts": {
"*default":[{"ID":"ALL", "register_transport": "*json", "register_tls": false}]

View File

@@ -37,7 +37,7 @@
},
"dispConn": {
"strategy": "*first",
"conns": [{"address": "127.0.0.1:2012/registar", "transport":"*http_jsonrpc"}]
"conns": [{"address": "http://127.0.0.1:2080/dispatchers_registrar", "transport":"*http_jsonrpc"}]
}
},
@@ -107,7 +107,7 @@
"dispatcherh":{
"enabled": false,
"enabled": true,
"dispatchers_conns": ["dispConn"],
"hosts": {
"*default":[{"ID":"ALL2", "register_transport": "*json", "register_tls": false}]

View File

@@ -34,7 +34,8 @@
"caches":{
"partitions": {
"*dispatcher_routes": {"limit": -1, "ttl": "2s"}
"*dispatcher_routes": {"limit": -1, "ttl": "2s"},
"*dispatcher_hosts": {"limit": -1, "ttl": "2s"}
},
},

View File

@@ -25,7 +25,8 @@
"caches":{
"partitions": {
"*dispatcher_routes": {"limit": -1, "ttl": "2s"}
"*dispatcher_routes": {"limit": -1, "ttl": "2s"},
"*dispatcher_hosts": {"limit": -1, "ttl": "2s"}
},
},

View File

@@ -26,6 +26,7 @@ import (
"os/exec"
"path"
"testing"
"time"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/engine"
@@ -172,6 +173,7 @@ func testDsphStopEngines(t *testing.T) {
if err := all2Cmd.Process.Kill(); err != nil {
t.Fatal(err)
}
time.Sleep(2 * time.Second)
if _, err := testDsphGetNodeID(); err == nil || err.Error() != utils.ErrHostNotFound.Error() {
t.Errorf("Expected error: %s received: %v", utils.ErrHostNotFound, err)
}

View File

@@ -64,7 +64,7 @@ func (dspS *DispatcherHostsService) Start() (err error) {
if dspS.IsRunning() {
return utils.ErrServiceAlreadyRunning
}
utils.Logger.Info("Starting CGRateS Dispatcher service.")
utils.Logger.Info("Starting CGRateS DispatcherH service.")
dspS.Lock()
defer dspS.Unlock()

View File

@@ -72,7 +72,7 @@ func (dspS *DispatcherService) Start() (err error) {
if dspS.IsRunning() {
return utils.ErrServiceAlreadyRunning
}
utils.Logger.Info("Starting CGRateS Dispatcher service.")
utils.Logger.Info("Starting CGRateS DispatcherS service.")
fltrS := <-dspS.filterSChan
dspS.filterSChan <- fltrS
<-dspS.cacheS.GetPrecacheChannel(utils.CacheDispatcherProfiles)