diff --git a/data/conf/samples/dispatcherh/dispatchers_mysql_test/cgrates.json b/data/conf/samples/dispatcherh/dispatchers_mysql_test/cgrates.json
deleted file mode 100755
index 99a9e6448..000000000
--- a/data/conf/samples/dispatcherh/dispatchers_mysql_test/cgrates.json
+++ /dev/null
@@ -1,67 +0,0 @@
-{
-
-// Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-// Copyright (C) ITsysCOM GmbH
-//
-// This file contains the default configuration hardcoded into CGRateS.
-// This is what you get when you load CGRateS with an empty configuration file.
-
-"general": {
- "node_id": "DispatcherS1",
- "log_level": 7,
- "reconnects": 1,
-},
-
-
-"listen": {
- "rpc_json": ":2012",
- "rpc_gob": ":2013",
- "http": ":2080",
-},
-
-"stor_db": {
- "db_type":"*internal",
-},
-
-"caches":{
- "partitions": {
- "*dispatcher_routes": {"limit": -1, "ttl": "2s"},
- "*dispatcher_hosts": {"limit": -1, "ttl": "2s"}
- },
-},
-
-
-
-"schedulers": {
- "enabled": true,
-},
-
-"rals": {
- "enabled": true,
-},
-
-"chargers": {
- "enabled": true,
-},
-
-"sessions": {
- "enabled": true,
- "rals_conns": ["*localhost"],
- "resources_conns": ["*localhost"],
- "chargers_conns": ["*localhost"],
- "listen_bijson": ":3014",
-},
-
-"dispatchers":{
- "enabled": true,
-},
-
-"dispatcherh":{
- "enabled": true,
-},
-
-"apiers": {
- "enabled": true,
- "scheduler_conns": ["*internal"],
-},
-}
\ No newline at end of file
diff --git a/services/dispatcherh_it_test.go b/services/dispatcherh_it_test.go
deleted file mode 100644
index 2617891a2..000000000
--- a/services/dispatcherh_it_test.go
+++ /dev/null
@@ -1,94 +0,0 @@
-// +build integration
-
-/*
-Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
-Copyright (C) ITsysCOM GmbH
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see
-*/
-package services
-
-/*
-func TestDispatcherhReload(t *testing.T) {
- cfg := config.NewDefaultCGRConfig()
-
- utils.Logger, _ = utils.Newlogger(utils.MetaSysLog, cfg.GeneralCfg().NodeID)
- utils.Logger.SetLogLevel(7)
- cfg.AttributeSCfg().Enabled = true
- shdChan := utils.NewSyncedChan()
- shdWg := new(sync.WaitGroup)
- chS := engine.NewCacheS(cfg, nil, nil)
- close(chS.GetPrecacheChannel(utils.CacheAttributeProfiles))
- close(chS.GetPrecacheChannel(utils.CacheAttributeFilterIndexes))
- close(chS.GetPrecacheChannel(utils.CacheDispatcherProfiles))
- close(chS.GetPrecacheChannel(utils.CacheDispatcherHosts))
- close(chS.GetPrecacheChannel(utils.CacheDispatcherFilterIndexes))
- filterSChan := make(chan *engine.FilterS, 1)
- filterSChan <- nil
- server := cores.NewServer(nil)
- srvMngr := servmanager.NewServiceManager(cfg, shdChan, shdWg)
- srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)}
- db := NewDataDBService(cfg, nil, srvDep)
- anz := NewAnalyzerService(cfg, server, filterSChan, shdChan, make(chan rpcclient.ClientConnector, 1), srvDep)
- attrS := NewAttributeService(cfg, db, chS, filterSChan, server, make(chan rpcclient.ClientConnector, 1), anz, srvDep)
- rpcInternal := map[string]chan rpcclient.ClientConnector{}
- cM := engine.NewConnManager(cfg, rpcInternal)
- srv := NewDispatcherHostsService(cfg, server, cM, anz, srvDep)
- engine.NewConnManager(cfg, nil)
- srvMngr.AddServices(attrS, srv,
- NewLoaderService(cfg, db, filterSChan, server,
- make(chan rpcclient.ClientConnector, 1), nil, anz, srvDep), db)
- if err := srvMngr.StartServices(); err != nil {
- t.Error(err)
- }
- if srv.IsRunning() {
- t.Errorf("Expected service to be down")
- }
- if db.IsRunning() {
- t.Errorf("Expected service to be down")
- }
- var reply string
- if err := cfg.V1ReloadConfig(&config.ReloadArgs{
- Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "dispatcherh", "dispatchers_mysql_test"),
- Section: config.DispatcherHJson,
- }, &reply); err != nil {
- t.Error(err)
- } else if reply != utils.OK {
- t.Errorf("Expecting OK ,received %s", reply)
- }
- time.Sleep(10 * time.Millisecond) //need to switch to gorutine
- if !srv.IsRunning() {
- t.Errorf("Expected service to be running")
- }
- if !db.IsRunning() {
- t.Errorf("Expected service to be running")
- }
- err := srv.Start()
- if err == nil || err != utils.ErrServiceAlreadyRunning {
- t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.ErrServiceAlreadyRunning, err)
- }
- err = srv.Reload()
- if err != nil {
- t.Errorf("\nExpecting ,\n Received <%+v>", err)
- }
- cfg.DispatcherHCfg().Enabled = false
- cfg.GetReloadChan(config.DispatcherHJson) <- struct{}{}
- time.Sleep(10 * time.Millisecond)
- if srv.IsRunning() {
- t.Errorf("Expected service to be down")
- }
- shdChan.CloseOnce()
- time.Sleep(10 * time.Millisecond)
-}
-*/
diff --git a/services/globalvars_it_test.go b/services/globalvars_it_test.go
new file mode 100644
index 000000000..f40832b13
--- /dev/null
+++ b/services/globalvars_it_test.go
@@ -0,0 +1,50 @@
+// +build integration
+
+/*
+Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
+Copyright (C) ITsysCOM GmbH
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see
+*/
+package services
+
+import (
+ "sync"
+ "testing"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/utils"
+)
+
+func TestGlobalVarsReload(t *testing.T) {
+ cfg := config.NewDefaultCGRConfig()
+ srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)}
+ srv := NewGlobalVarS(cfg, srvDep)
+ err := srv.Start()
+ if !srv.IsRunning() {
+ t.Errorf("Expected service to be running")
+ }
+ if err != nil {
+ t.Errorf("\nExpected , \nReceived <%+v>", err)
+ }
+ err = srv.Reload()
+ if err != nil {
+ t.Errorf("\nExpected , \nReceived <%+v>", err)
+ }
+ err = srv.Shutdown()
+ if err != nil {
+ t.Errorf("\nExpected , \nReceived <%+v>", err)
+ }
+
+}
diff --git a/services/routes_it_test.go b/services/routes_it_test.go
index faa03adc0..e3a0269b9 100644
--- a/services/routes_it_test.go
+++ b/services/routes_it_test.go
@@ -19,22 +19,31 @@ along with this program. If not, see
*/
package services
-/*
+import (
+ "path"
+ "sync"
+ "testing"
+ "time"
+
+ "github.com/cgrates/cgrates/config"
+ "github.com/cgrates/cgrates/cores"
+ "github.com/cgrates/cgrates/engine"
+ "github.com/cgrates/cgrates/servmanager"
+ "github.com/cgrates/cgrates/utils"
+ "github.com/cgrates/rpcclient"
+)
+
func TestRouteSReload(t *testing.T) {
// utils.Logger.SetLogLevel(7)
cfg := config.NewDefaultCGRConfig()
utils.Logger, _ = utils.Newlogger(utils.MetaSysLog, cfg.GeneralCfg().NodeID)
utils.Logger.SetLogLevel(7)
- cfg.ThresholdSCfg().Enabled = true
filterSChan := make(chan *engine.FilterS, 1)
filterSChan <- nil
shdChan := utils.NewSyncedChan()
shdWg := new(sync.WaitGroup)
chS := engine.NewCacheS(cfg, nil, nil)
- close(chS.GetPrecacheChannel(utils.CacheThresholdProfiles))
- close(chS.GetPrecacheChannel(utils.CacheThresholds))
- close(chS.GetPrecacheChannel(utils.CacheThresholdFilterIndexes))
close(chS.GetPrecacheChannel(utils.CacheRouteProfiles))
close(chS.GetPrecacheChannel(utils.CacheRouteFilterIndexes))
server := cores.NewServer(nil)
@@ -42,15 +51,14 @@ func TestRouteSReload(t *testing.T) {
srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)}
anz := NewAnalyzerService(cfg, server, filterSChan, shdChan, make(chan rpcclient.ClientConnector, 1), srvDep)
db := NewDataDBService(cfg, nil, srvDep)
- tS := NewThresholdService(cfg, db, chS, filterSChan, server, make(chan rpcclient.ClientConnector, 1), anz, srvDep)
- reS := NewRouteService(cfg, db, chS, filterSChan, server, make(chan rpcclient.ClientConnector, 1), nil, anz, srvDep)
+ routeS := NewRouteService(cfg, db, chS, filterSChan, server, make(chan rpcclient.ClientConnector, 1), nil, anz, srvDep)
engine.NewConnManager(cfg, nil)
- srvMngr.AddServices(tS, reS,
+ srvMngr.AddServices(routeS,
NewLoaderService(cfg, db, filterSChan, server, make(chan rpcclient.ClientConnector, 1), nil, anz, srvDep), db)
if err := srvMngr.StartServices(); err != nil {
t.Error(err)
}
- if reS.IsRunning() {
+ if routeS.IsRunning() {
t.Errorf("Expected service to be down")
}
if db.IsRunning() {
@@ -58,7 +66,7 @@ func TestRouteSReload(t *testing.T) {
}
var reply string
if err := cfg.V1ReloadConfig(&config.ReloadArgs{
- Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"),
+ Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "cluelrn"),
Section: config.RouteSJson,
}, &reply); err != nil {
t.Error(err)
@@ -66,27 +74,27 @@ func TestRouteSReload(t *testing.T) {
t.Errorf("Expecting OK ,received %s", reply)
}
time.Sleep(10 * time.Millisecond) //need to switch to gorutine
- if !reS.IsRunning() {
- t.Errorf("Expected service to be running")
+ if !routeS.IsRunning() {
+ t.Fatalf("Expected service to be running")
}
if !db.IsRunning() {
t.Errorf("Expected service to be running")
}
- err := reS.Start()
+
+ err := routeS.Start()
if err == nil || err != utils.ErrServiceAlreadyRunning {
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.ErrServiceAlreadyRunning, err)
}
- err = reS.Reload()
+ err = routeS.Reload()
if err != nil {
t.Errorf("\nExpecting ,\n Received <%+v>", err)
}
cfg.RouteSCfg().Enabled = false
cfg.GetReloadChan(config.RouteSJson) <- struct{}{}
time.Sleep(10 * time.Millisecond)
- if reS.IsRunning() {
+ if routeS.IsRunning() {
t.Errorf("Expected service to be down")
}
shdChan.CloseOnce()
time.Sleep(10 * time.Millisecond)
}
-*/