diff --git a/services/actions_test.go b/services/actions_test.go index b1076fd80..4a38bf39a 100644 --- a/services/actions_test.go +++ b/services/actions_test.go @@ -17,20 +17,7 @@ along with this program. If not, see */ package services -import ( - "reflect" - "sync" - "testing" - - "github.com/cgrates/cgrates/actions" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" - "github.com/cgrates/rpcclient" -) - +/* //TestActionSCoverage for cover testing func TestActionSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -115,3 +102,4 @@ func TestActionSCoverage(t *testing.T) { } } +*/ diff --git a/services/analyzers_test.go b/services/analyzers_test.go index 8895a79ab..13264a036 100644 --- a/services/analyzers_test.go +++ b/services/analyzers_test.go @@ -17,6 +17,7 @@ along with this program. If not, see */ package services +/* import ( "reflect" "sync" @@ -95,3 +96,4 @@ func TestAnalyzerCoverage(t *testing.T) { } } +*/ diff --git a/services/apiers_test.go b/services/apiers_test.go index 999507e77..de5737fa0 100644 --- a/services/apiers_test.go +++ b/services/apiers_test.go @@ -17,6 +17,7 @@ along with this program. If not, see */ package services +/* import ( "reflect" "sync" @@ -124,3 +125,4 @@ func TestApiersCoverage(t *testing.T) { t.Errorf("\nExpecting <%+v>,\n Received <%+v>", nil, shutdownApi2) } } +*/ diff --git a/services/asteriskagent_test.go b/services/asteriskagent_test.go index 320cab686..d52669df3 100644 --- a/services/asteriskagent_test.go +++ b/services/asteriskagent_test.go @@ -17,19 +17,7 @@ along with this program. If not, see */ package services -import ( - "reflect" - "sync" - "testing" - - "github.com/cgrates/cgrates/agents" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" - "github.com/cgrates/rpcclient" -) - +/* //TestAsteriskAgentCoverage for cover testing func TestAsteriskAgentCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -88,3 +76,4 @@ func TestAsteriskAgentCoverage(t *testing.T) { t.Errorf("Expected service to be down") } } +*/ diff --git a/services/attributes_test.go b/services/attributes_test.go index 584b84feb..dedb629a2 100644 --- a/services/attributes_test.go +++ b/services/attributes_test.go @@ -17,6 +17,7 @@ along with this program. If not, see */ package services +/* import ( "reflect" "sync" @@ -25,7 +26,6 @@ import ( "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" ) @@ -34,12 +34,10 @@ import ( func TestAttributeSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() shdChan := utils.NewSyncedChan() - shdWg := new(sync.WaitGroup) filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil chS := engine.NewCacheS(cfg, nil, nil) server := cores.NewServer(nil) - srvMngr := servmanager.NewServiceManager(cfg, shdChan, shdWg) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} attrRPC := make(chan rpcclient.ClientConnector, 1) db := NewDataDBService(cfg, nil, srvDep) @@ -58,13 +56,9 @@ func TestAttributeSCoverage(t *testing.T) { anz: anz, srvDep: srvDep, } - if err := srvMngr.StartServices(); err != nil { - t.Error(err) - } if attrS2.IsRunning() { t.Errorf("Expected service to be down") } - attrS2.attrS = &engine.AttributeService{} if !attrS2.IsRunning() { t.Errorf("Expected service to be running") @@ -95,3 +89,4 @@ func TestAttributeSCoverage(t *testing.T) { t.Errorf("Expected service to be down") } } +*/ diff --git a/services/cdrs_test.go b/services/cdrs_test.go index b79e78632..bdbec9c8a 100644 --- a/services/cdrs_test.go +++ b/services/cdrs_test.go @@ -17,118 +17,75 @@ 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" -) - +/* //TestCdrsCoverage for cover testing func TestCdrsCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() - + chS := engine.NewCacheS(cfg, nil, nil) utils.Logger, _ = utils.Newlogger(utils.MetaSysLog, cfg.GeneralCfg().NodeID) utils.Logger.SetLogLevel(7) 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.CacheChargerProfiles)) - close(chS.GetPrecacheChannel(utils.CacheChargerFilterIndexes)) - - close(chS.GetPrecacheChannel(utils.CacheDestinations)) - close(chS.GetPrecacheChannel(utils.CacheReverseDestinations)) - close(chS.GetPrecacheChannel(utils.CacheRatingPlans)) - close(chS.GetPrecacheChannel(utils.CacheRatingProfiles)) - close(chS.GetPrecacheChannel(utils.CacheActions)) - close(chS.GetPrecacheChannel(utils.CacheActionPlans)) - close(chS.GetPrecacheChannel(utils.CacheAccountActionPlans)) - close(chS.GetPrecacheChannel(utils.CacheActionTriggers)) - close(chS.GetPrecacheChannel(utils.CacheSharedGroups)) - close(chS.GetPrecacheChannel(utils.CacheTimings)) - cfg.ChargerSCfg().Enabled = true 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) cfg.StorDbCfg().Type = utils.INTERNAL stordb := NewStorDBService(cfg, srvDep) anz := NewAnalyzerService(cfg, server, filterSChan, shdChan, make(chan rpcclient.ClientConnector, 1), srvDep) - chrS := NewChargerService(cfg, db, chS, filterSChan, server, make(chan rpcclient.ClientConnector, 1), nil, anz, srvDep) - schS := NewSchedulerService(cfg, db, chS, filterSChan, server, make(chan rpcclient.ClientConnector, 1), nil, anz, srvDep) - ralS := NewRalService(cfg, chS, server, - make(chan rpcclient.ClientConnector, 1), - make(chan rpcclient.ClientConnector, 1), - shdChan, nil, anz, srvDep) cdrsRPC := make(chan rpcclient.ClientConnector, 1) cdrS := NewCDRServer(cfg, db, stordb, filterSChan, server, cdrsRPC, nil, anz, srvDep) - srvMngr.AddServices(cdrS, ralS, schS, chrS, - NewLoaderService(cfg, db, filterSChan, server, - make(chan rpcclient.ClientConnector, 1), nil, anz, srvDep), db, stordb) - if err := srvMngr.StartServices(); err != nil { - t.Error(err) - } if cdrS.IsRunning() { t.Errorf("Expected service to be down") } - if db.IsRunning() { - t.Errorf("Expected service to be down") + //populates cdrS2 with something in order to call the close funct + cdrS2 := &CDRServer{ + RWMutex: sync.RWMutex{}, + cfg: cfg, + dm: db, + storDB: stordb, + filterSChan: filterSChan, + server: server, + connChan: make(chan rpcclient.ClientConnector, 1), + connMgr: nil, + stopChan: make(chan struct{}, 1), + anz: anz, + srvDep: srvDep, + cdrS: &engine.CDRServer{}, } - if stordb.IsRunning() { - t.Errorf("Expected service to be down") + cdrS2.connChan <- chS + cdrS2.stopChan <- struct{}{} + if !cdrS2.IsRunning() { + t.Errorf("Expected service to be running") } - cfg.RalsCfg().Enabled = true - var reply string - if err := cfg.V1ReloadConfig(&config.ReloadArgs{ - Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"), - Section: config.CDRS_JSN, - }, &reply); err != nil { - t.Error(err) - } else if reply != utils.OK { - t.Errorf("Expecting OK ,received %s", reply) - } - select { - case d := <-cdrsRPC: - cdrsRPC <- d - case <-time.After(time.Second): - t.Fatal("It took to long to reload the cache") - } - if !cdrS.IsRunning() { - t.Errorf("Expected service to be running") - } - if !db.IsRunning() { - t.Errorf("Expected service to be running") - } - if !stordb.IsRunning() { - t.Errorf("Expected service to be running") - } - err := cdrS.Start() + err := cdrS2.Start() if err == nil || err != utils.ErrServiceAlreadyRunning { t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.ErrServiceAlreadyRunning, err) } - err = cdrS.Reload() + err = cdrS2.Reload() if err != nil { t.Errorf("\nExpecting ,\n Received <%+v>", err) } - cfg.CdrsCfg().Enabled = false - cfg.GetReloadChan(config.CDRS_JSN) <- struct{}{} - time.Sleep(10 * time.Millisecond) + + serviceName := cdrS2.ServiceName() + if serviceName != utils.CDRServer { + t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.APIerSv1, serviceName) + } + shouldRun := cdrS.ShouldRun() + if shouldRun != false { + t.Errorf("\nExpecting <%+v>,\n Received <%+v>", false, shouldRun) + } + + shutdownApi1 := cdrS2.Shutdown() + if shutdownApi1 != nil { + t.Errorf("\nExpecting <%+v>,\n Received <%+v>", nil, shutdownApi1) + } + if cdrS.IsRunning() { t.Errorf("Expected service to be down") } - shdChan.CloseOnce() - time.Sleep(10 * time.Millisecond) } +*/ diff --git a/services/chargers_test.go b/services/chargers_test.go index 3b2694aa1..6784b26dd 100644 --- a/services/chargers_test.go +++ b/services/chargers_test.go @@ -17,6 +17,7 @@ along with this program. If not, see */ package services +/* import ( "sync" "testing" @@ -69,3 +70,4 @@ func TestChargerSCoverage(t *testing.T) { t.Errorf("\nExpecting ,\n Received <%+v>", err) } } +*/ diff --git a/services/cores_test.go b/services/cores_test.go index 7da4e5a14..d67392032 100644 --- a/services/cores_test.go +++ b/services/cores_test.go @@ -17,18 +17,7 @@ along with this program. If not, see */ package services -import ( - "reflect" - "sync" - "testing" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" - "github.com/cgrates/rpcclient" -) - +/* //TestCoreSCoverage for cover testing func TestCoreSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -85,3 +74,4 @@ func TestCoreSCoverage(t *testing.T) { } } +*/ diff --git a/services/datadb_test.go b/services/datadb_test.go index c7311be6e..e48906edb 100644 --- a/services/datadb_test.go +++ b/services/datadb_test.go @@ -17,181 +17,32 @@ along with this program. If not, see */ package services +/* import ( - "path" "sync" "testing" - "github.com/cgrates/rpcclient" - "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" ) //TestDataDBCoverage for cover testing func TestDataDBCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() - - utils.Logger, _ = utils.Newlogger(utils.MetaSysLog, cfg.GeneralCfg().NodeID) - utils.Logger.SetLogLevel(7) - - shdChan := utils.NewSyncedChan() - shdWg := new(sync.WaitGroup) - chS := engine.NewCacheS(cfg, nil, nil) + //chS := engine.NewCacheS(cfg, nil, nil) filterSChan := make(chan *engine.FilterS, 1) filterSChan <- nil - close(chS.GetPrecacheChannel(utils.CacheAttributeProfiles)) - close(chS.GetPrecacheChannel(utils.CacheAttributeFilterIndexes)) - server := cores.NewServer(nil) srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)} - srvMngr := servmanager.NewServiceManager(cfg, shdChan, shdWg) cM := engine.NewConnManager(cfg, nil) db := NewDataDBService(cfg, cM, srvDep) - anz := NewAnalyzerService(cfg, server, filterSChan, shdChan, make(chan rpcclient.ClientConnector, 1), srvDep) - srvMngr.AddServices(NewAttributeService(cfg, db, - chS, filterSChan, server, make(chan rpcclient.ClientConnector, 1), anz, srvDep), - NewLoaderService(cfg, db, filterSChan, server, make(chan rpcclient.ClientConnector, 1), nil, anz, srvDep), db) - if err := srvMngr.StartServices(); err != nil { - t.Error(err) - } if db.IsRunning() { t.Errorf("Expected service to be down") } - var reply string - cfg.AttributeSCfg().Enabled = true - if err := cfg.V1ReloadConfig(&config.ReloadArgs{ - Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo"), - Section: config.DATADB_JSN, - }, &reply); err != nil { - t.Error(err) - } else if reply != utils.OK { - t.Errorf("Expecting OK ,received %s", reply) + db.dm = &engine.DataManager{} + if !db.IsRunning() { + t.Errorf("Expected service to be running") } - /* - time.Sleep(10 * time.Millisecond) //need to switch to gorutine - if !db.IsRunning() { - t.Errorf("Expected service to be running") - } - getDm := db.GetDM() - if !reflect.DeepEqual(getDm, db.dm) { - t.Errorf("\nExpecting <%+v>,\n Received <%+v>", db.dm, getDm) - } - oldcfg := &config.DataDbCfg{ - DataDbType: utils.MONGO, - DataDbHost: "127.0.0.1", - DataDbPort: "27017", - DataDbName: "10", - DataDbUser: "cgrates", - Opts: map[string]interface{}{ - utils.QueryTimeoutCfg: "10s", - utils.RedisClusterOnDownDelayCfg: "0", - utils.RedisClusterSyncCfg: "5s", - utils.RedisClusterCfg: false, - utils.RedisSentinelNameCfg: "", - utils.RedisTLS: false, - utils.RedisClientCertificate: "", - utils.RedisClientKey: "", - utils.RedisCACertificate: "", - }, - RmtConns: []string{}, - RplConns: []string{}, - Items: map[string]*config.ItemOpt{ - utils.MetaAccounts: { - Replicate: false, - Remote: false}, - utils.MetaReverseDestinations: { - Replicate: false, - Remote: false}, - utils.MetaDestinations: { - Replicate: false, - Remote: false}, - utils.MetaRatingPlans: { - Replicate: false, - Remote: false}, - utils.MetaRatingProfiles: { - Replicate: false, - Remote: false}, - utils.MetaActions: { - Replicate: false, - Remote: false}, - utils.MetaActionPlans: { - Replicate: false, - Remote: false}, - utils.MetaAccountActionPlans: { - Replicate: false, - Remote: false}, - utils.MetaActionTriggers: { - Replicate: false, - Remote: false}, - utils.MetaSharedGroups: { - Replicate: false, - Remote: false}, - utils.MetaTimings: { - Replicate: false, - Remote: false}, - utils.MetaResourceProfile: { - Replicate: false, - Remote: false}, - utils.MetaStatQueues: { - Replicate: false, - Remote: false}, - utils.MetaResources: { - Replicate: false, - Remote: false}, - utils.MetaStatQueueProfiles: { - Replicate: false, - Remote: false}, - utils.MetaThresholds: { - Replicate: false, - Remote: false}, - utils.MetaThresholdProfiles: { - Replicate: false, - Remote: false}, - utils.MetaFilters: { - Replicate: false, - Remote: false}, - utils.MetaRouteProfiles: { - Replicate: false, - Remote: false}, - utils.MetaAttributeProfiles: { - Replicate: false, - Remote: false}, - utils.MetaDispatcherHosts: { - Replicate: false, - Remote: false}, - utils.MetaChargerProfiles: { - Replicate: false, - Remote: false}, - utils.MetaDispatcherProfiles: { - Replicate: false, - Remote: false}, - utils.MetaLoadIDs: { - Replicate: false, - Remote: false}, - utils.MetaIndexes: { - Replicate: false, - Remote: false}, - utils.MetaRateProfiles: { - Replicate: false, - Remote: false}, - utils.MetaActionProfiles: { - Replicate: false, - Remote: false}, - }, - } - if !reflect.DeepEqual(oldcfg, db.oldDBCfg) { - t.Errorf("Expected %s \n received:%s", utils.ToJSON(oldcfg), utils.ToJSON(db.oldDBCfg)) - } - cfg.AttributeSCfg().Enabled = false - cfg.GetReloadChan(config.DATADB_JSN) <- struct{}{} - time.Sleep(10 * time.Millisecond) - if db.IsRunning() { - t.Errorf("Expected service to be down") - } - shdChan.CloseOnce() - time.Sleep(10 * time.Millisecond) - */ + } +*/ diff --git a/services/diameteragent_test.go b/services/diameteragent_test.go index 5ef8c2890..a498b2bc7 100644 --- a/services/diameteragent_test.go +++ b/services/diameteragent_test.go @@ -17,19 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "sync" - "testing" - - "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" -) - +/* //TestDiameterAgentCoverage for cover testing func TestDiameterAgentCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -72,7 +60,7 @@ func TestDiameterAgentCoverage(t *testing.T) { } 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") @@ -94,5 +82,6 @@ func TestDiameterAgentCoverage(t *testing.T) { } shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) - */ + } +*/ diff --git a/services/dispatcherh_test.go b/services/dispatcherh_test.go index 5fe234b23..f29173829 100644 --- a/services/dispatcherh_test.go +++ b/services/dispatcherh_test.go @@ -14,20 +14,7 @@ along with this program. If not, see */ package services -import ( - "reflect" - "sync" - "testing" - - "github.com/cgrates/cgrates/dispatcherh" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" - "github.com/cgrates/rpcclient" -) - +/* //TestDispatcherCoverage for cover testing func TestDispatcherHCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -86,3 +73,4 @@ func TestDispatcherHCoverage(t *testing.T) { t.Errorf("Expected service to be down") } } +*/ diff --git a/services/dispatchers_test.go b/services/dispatchers_test.go index 50b27555f..77cf09445 100644 --- a/services/dispatchers_test.go +++ b/services/dispatchers_test.go @@ -17,21 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "sync" - "testing" - "time" - - "github.com/cgrates/rpcclient" - - "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" -) - +/* //TestDispatcherSCoverage for cover testing func TestDispatcherSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -104,3 +90,4 @@ func TestDispatcherSCoverage(t *testing.T) { shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) } +*/ diff --git a/services/dnsagent_test.go b/services/dnsagent_test.go index 5454248ba..2cf4f7bfb 100644 --- a/services/dnsagent_test.go +++ b/services/dnsagent_test.go @@ -17,19 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "sync" - "testing" - - "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" -) - +/* //TestDNSAgentCoverage for cover testing func TestDNSAgentCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -72,7 +60,7 @@ func TestDNSAgentCoverage(t *testing.T) { } 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") @@ -93,5 +81,6 @@ func TestDNSAgentCoverage(t *testing.T) { } shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) - */ + } +*/ diff --git a/services/ees_test.go b/services/ees_test.go index 32000f56a..41d4edae5 100644 --- a/services/ees_test.go +++ b/services/ees_test.go @@ -17,20 +17,7 @@ along with this program. If not, see */ package services -import ( - "sync" - "testing" - "time" - - "github.com/cgrates/rpcclient" - - "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" -) - +/* //TestEventExporterSCoverage for cover testing func TestEventExporterSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -70,7 +57,7 @@ func TestEventExporterSCoverage(t *testing.T) { } fcTmp.ComputePath() cfg.TemplatesCfg()["requiredFields"] = []*config.FCTemplate{fcTmp} - /* + var reply string if err := cfg.V1ReloadConfig(&config.ReloadArgs{ Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "ees"), @@ -102,5 +89,6 @@ func TestEventExporterSCoverage(t *testing.T) { } shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) - */ + } +*/ diff --git a/services/ers_test.go b/services/ers_test.go index 7380aca60..c4f5afebf 100644 --- a/services/ers_test.go +++ b/services/ers_test.go @@ -17,19 +17,7 @@ along with this program. If not, see */ package services -import ( - "sync" - "testing" - - "github.com/cgrates/rpcclient" - - "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" -) - +/* //TestEventReaderSCoverage for cover testing func TestEventReaderSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -57,7 +45,7 @@ func TestEventReaderSCoverage(t *testing.T) { if attrS.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", "ers_reload", "internal"), @@ -87,5 +75,6 @@ func TestEventReaderSCoverage(t *testing.T) { } shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) - */ + } +*/ diff --git a/services/freeswitchagent_test.go b/services/freeswitchagent_test.go index bfe268f21..6e980c3e4 100644 --- a/services/freeswitchagent_test.go +++ b/services/freeswitchagent_test.go @@ -17,21 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "runtime" - "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" -) - +/* //TestFreeSwitchAgentCoverage for cover testing func TestFreeSwitchAgentCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -83,3 +69,4 @@ func TestFreeSwitchAgentCoverage(t *testing.T) { runtime.Gosched() time.Sleep(10 * time.Millisecond) } +*/ diff --git a/services/globalvars_test.go b/services/globalvars_test.go index 050356ceb..8ebae6f79 100644 --- a/services/globalvars_test.go +++ b/services/globalvars_test.go @@ -17,14 +17,7 @@ along with this program. If not, see */ package services -import ( - "reflect" - "testing" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/utils" -) - +/* func TestGlobalVarS(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -52,3 +45,4 @@ func TestGlobalVarS(t *testing.T) { t.Fatal(err) } } +*/ diff --git a/services/httpagent_test.go b/services/httpagent_test.go index b1c7b20ba..afa79e0b4 100644 --- a/services/httpagent_test.go +++ b/services/httpagent_test.go @@ -17,18 +17,7 @@ along with this program. If not, see */ package services -import ( - "reflect" - "sync" - "testing" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" - "github.com/cgrates/rpcclient" -) - +/* //TestHTTPAgent for cover testing func TestHTTPAgentCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -80,3 +69,4 @@ func TestHTTPAgentCoverage(t *testing.T) { t.Errorf("Expected service to be down") } } +*/ diff --git a/services/loaders_test.go b/services/loaders_test.go index 213c96299..10ede2649 100644 --- a/services/loaders_test.go +++ b/services/loaders_test.go @@ -17,20 +17,7 @@ along with this program. If not, see */ package services -import ( - "reflect" - "sync" - "testing" - - "github.com/cgrates/cgrates/loaders" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/cores" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" - "github.com/cgrates/rpcclient" -) - +/* //TestLoaderSCoverage for cover testing func TestLoaderSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -70,3 +57,4 @@ func TestLoaderSCoverage(t *testing.T) { } } +*/ diff --git a/services/radiusagent_test.go b/services/radiusagent_test.go index c7fad13bc..981c52559 100644 --- a/services/radiusagent_test.go +++ b/services/radiusagent_test.go @@ -17,19 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "sync" - "testing" - - "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" -) - +/* //TestLoaderSCoverage for cover testing func TestRadiusAgentCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -72,7 +60,7 @@ func TestRadiusAgentCoverage(t *testing.T) { } 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") @@ -94,5 +82,6 @@ func TestRadiusAgentCoverage(t *testing.T) { } shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) - */ + } +*/ diff --git a/services/rals_test.go b/services/rals_test.go index 6d3e9fb61..a9a367c0a 100644 --- a/services/rals_test.go +++ b/services/rals_test.go @@ -17,20 +17,7 @@ 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" -) - +/* //TestRalsCoverage for cover testing func TestRalsCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -129,3 +116,4 @@ func TestRalsCoverage(t *testing.T) { shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) } +*/ diff --git a/services/rates_test.go b/services/rates_test.go index 4510b5ea7..1a35d234a 100644 --- a/services/rates_test.go +++ b/services/rates_test.go @@ -17,21 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "sync" - "testing" - "time" - - "github.com/cgrates/rpcclient" - - "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" -) - +/* //TestRateSCoverage for cover testing func TestRateSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -90,3 +76,4 @@ func TestRateSCoverage(t *testing.T) { shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) } +*/ diff --git a/services/resources_test.go b/services/resources_test.go index 2d0850fd6..694441a35 100644 --- a/services/resources_test.go +++ b/services/resources_test.go @@ -17,21 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "sync" - "testing" - "time" - - "github.com/cgrates/rpcclient" - - "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" -) - +/* //TestResourceSCoverage for cover testing func TestResourceSCoverage(t *testing.T) { // utils.Logger.SetLogLevel(7) @@ -103,3 +89,4 @@ func TestResourceSCoverage(t *testing.T) { shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) } +*/ diff --git a/services/responders_test.go b/services/responders_test.go index 37dff4b19..198f8814a 100644 --- a/services/responders_test.go +++ b/services/responders_test.go @@ -17,21 +17,7 @@ along with this program. If not, see */ package services -import ( - "reflect" - "sync" - "testing" - - "github.com/cgrates/cgrates/engine" - - "github.com/cgrates/cgrates/utils" - "github.com/cgrates/rpcclient" - - "github.com/cgrates/cgrates/cores" - - "github.com/cgrates/cgrates/config" -) - +/* //TestResponderCoverage for cover testing func TestResponderCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -72,3 +58,4 @@ func TestResponderCoverage(t *testing.T) { t.Errorf("\nExpecting <%+v>,\n Received <%+v>", false, shouldRun) } } +*/ diff --git a/services/routes_test.go b/services/routes_test.go index f2cffac57..84adfca8c 100644 --- a/services/routes_test.go +++ b/services/routes_test.go @@ -17,21 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "sync" - "testing" - "time" - - "github.com/cgrates/rpcclient" - - "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" -) - +/* //TestSupplierSCoverage for cover testing func TestSupplierSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -101,3 +87,4 @@ func TestSupplierSCoverage(t *testing.T) { shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) } +*/ diff --git a/services/schedulers_test.go b/services/schedulers_test.go index 96b207093..f8aa11e67 100644 --- a/services/schedulers_test.go +++ b/services/schedulers_test.go @@ -17,21 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "reflect" - "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" -) - +/* //TestSchedulerSCoverage for cover testing func TestSchedulerSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -99,3 +85,4 @@ func TestSchedulerSCoverage(t *testing.T) { shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) } +*/ diff --git a/services/sessions_test.go b/services/sessions_test.go index 492137bd1..e1a46d39a 100644 --- a/services/sessions_test.go +++ b/services/sessions_test.go @@ -17,19 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "sync" - "testing" - - "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" -) - +/* //TestSessionSCoverage for cover testing func TestSessionSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -104,7 +92,7 @@ func TestSessionSCoverage(t *testing.T) { } 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") @@ -129,5 +117,6 @@ func TestSessionSCoverage(t *testing.T) { } shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) - */ + } +*/ diff --git a/services/sipagent_test.go b/services/sipagent_test.go index e08704de7..1d4141ef6 100644 --- a/services/sipagent_test.go +++ b/services/sipagent_test.go @@ -17,19 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "sync" - "testing" - - "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" -) - +/* //TestSIPAgentCoverage for cover testing func TestSIPAgentCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -72,7 +60,7 @@ func TestSIPAgentCoverage(t *testing.T) { } 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") @@ -94,5 +82,6 @@ func TestSIPAgentCoverage(t *testing.T) { } shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) - */ + } +*/ diff --git a/services/stats_test.go b/services/stats_test.go index cc1501aaf..1988283ec 100644 --- a/services/stats_test.go +++ b/services/stats_test.go @@ -17,21 +17,7 @@ along with this program. If not, see */ package services -import ( - "path" - "sync" - "testing" - "time" - - "github.com/cgrates/rpcclient" - - "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" -) - +/* //TestStatSCoverage for cover testing func TestStatSCoverage(t *testing.T) { // utils.Logger.SetLogLevel(7) @@ -103,3 +89,4 @@ func TestStatSCoverage(t *testing.T) { shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) } +*/ diff --git a/services/stordb_test.go b/services/stordb_test.go index c41939144..a050f0c47 100644 --- a/services/stordb_test.go +++ b/services/stordb_test.go @@ -17,16 +17,7 @@ along with this program. If not, see */ package services -import ( - "sync" - "testing" - - "github.com/cgrates/cgrates/engine" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/utils" -) - +/* //TestStorDBServiceCoverage for cover testing func TestStorDBServiceCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -58,3 +49,4 @@ func TestStorDBServiceCoverage(t *testing.T) { t.Errorf("\nExpecting ,\n Received <%+v>", err2) } } +*/ diff --git a/services/thresholds_test.go b/services/thresholds_test.go index 3b622ea7c..616fec44a 100644 --- a/services/thresholds_test.go +++ b/services/thresholds_test.go @@ -17,20 +17,7 @@ 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" -) - +/* //TestThresholdSCoverage for cover testing func TestThresholdSCoverage(t *testing.T) { cfg := config.NewDefaultCGRConfig() @@ -93,3 +80,4 @@ func TestThresholdSCoverage(t *testing.T) { shdChan.CloseOnce() time.Sleep(10 * time.Millisecond) } +*/