mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-16 13:49:53 +05:00
Continuing tests in services
This commit is contained in:
@@ -78,6 +78,14 @@ func TestDiameterAgentReload(t *testing.T) {
|
||||
if !srv.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 <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
cfg.DiameterAgentCfg().Enabled = false
|
||||
cfg.GetReloadChan(config.DA_JSN) <- struct{}{}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
@@ -88,6 +88,14 @@ func TestDispatcherSReload(t *testing.T) {
|
||||
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 <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
cfg.DispatcherSCfg().Enabled = false
|
||||
cfg.GetReloadChan(config.DispatcherSJson) <- struct{}{}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
@@ -78,6 +78,14 @@ func TestDNSAgentReload(t *testing.T) {
|
||||
if !srv.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 <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
cfg.DNSAgentCfg().Enabled = false
|
||||
cfg.GetReloadChan(config.DNSAgentJson) <- struct{}{}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
@@ -96,6 +96,14 @@ func TestEventExporterSReload(t *testing.T) {
|
||||
if !ees.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
err := ees.Start()
|
||||
if err == nil || err != utils.ErrServiceAlreadyRunning {
|
||||
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.ErrServiceAlreadyRunning, err)
|
||||
}
|
||||
err = ees.Reload()
|
||||
if err != nil {
|
||||
t.Errorf("\nExpecting <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
cfg.EEsCfg().Enabled = false
|
||||
cfg.GetReloadChan(config.EEsJson) <- struct{}{}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
@@ -82,6 +82,14 @@ func TestEventReaderSReload(t *testing.T) {
|
||||
if !attrS.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
err := attrS.Start()
|
||||
if err == nil || err != utils.ErrServiceAlreadyRunning {
|
||||
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.ErrServiceAlreadyRunning, err)
|
||||
}
|
||||
err = attrS.Reload()
|
||||
if err != nil {
|
||||
t.Errorf("\nExpecting <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
cfg.ERsCfg().Enabled = false
|
||||
cfg.GetReloadChan(config.ERsJson) <- struct{}{}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
@@ -76,6 +76,7 @@ func TestKamailioAgentReload(t *testing.T) {
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Expecting OK ,received %s", reply)
|
||||
}
|
||||
|
||||
runtime.Gosched()
|
||||
time.Sleep(10 * time.Millisecond) //need to switch to gorutine
|
||||
// the engine should be stoped as we could not connect to kamailio
|
||||
|
||||
@@ -78,6 +78,14 @@ func TestRadiusAgentReload(t *testing.T) {
|
||||
if !srv.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 <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
cfg.RadiusAgentCfg().Enabled = false
|
||||
cfg.GetReloadChan(config.RA_JSN) <- struct{}{}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
@@ -110,13 +110,20 @@ func TestRalsReload(t *testing.T) {
|
||||
if !stordb.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
err := ralS.Start()
|
||||
if err == nil || err != utils.ErrServiceAlreadyRunning {
|
||||
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.ErrServiceAlreadyRunning, err)
|
||||
}
|
||||
err = ralS.Reload()
|
||||
if err != nil {
|
||||
t.Errorf("\nExpecting <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
cfg.RalsCfg().Enabled = false
|
||||
cfg.GetReloadChan(config.RALS_JSN) <- struct{}{}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if ralS.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
|
||||
if resp := ralS.GetResponder(); resp.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
|
||||
@@ -74,6 +74,14 @@ func TestRateSReload(t *testing.T) {
|
||||
if !rS.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
err := rS.Start()
|
||||
if err == nil || err != utils.ErrServiceAlreadyRunning {
|
||||
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.ErrServiceAlreadyRunning, err)
|
||||
}
|
||||
err = rS.Reload()
|
||||
if err != nil {
|
||||
t.Errorf("\nExpecting <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
cfg.RateSCfg().Enabled = false
|
||||
cfg.GetReloadChan(config.RateSJson) <- struct{}{}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
@@ -87,6 +87,14 @@ func TestResourceSReload(t *testing.T) {
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
err := reS.Start()
|
||||
if err == nil || err != utils.ErrServiceAlreadyRunning {
|
||||
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.ErrServiceAlreadyRunning, err)
|
||||
}
|
||||
err = reS.Reload()
|
||||
if err != nil {
|
||||
t.Errorf("\nExpecting <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
cfg.ResourceSCfg().Enabled = false
|
||||
cfg.GetReloadChan(config.RESOURCES_JSON) <- struct{}{}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
@@ -85,6 +85,14 @@ func TestSupplierSReload(t *testing.T) {
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
err := supS.Start()
|
||||
if err == nil || err != utils.ErrServiceAlreadyRunning {
|
||||
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.ErrServiceAlreadyRunning, err)
|
||||
}
|
||||
err = supS.Reload()
|
||||
if err != nil {
|
||||
t.Errorf("\nExpecting <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
cfg.RouteSCfg().Enabled = false
|
||||
cfg.GetReloadChan(config.RouteSJson) <- struct{}{}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
|
||||
Reference in New Issue
Block a user