mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Revise config reload tests in services
A time.Sleep() of 10 milliseconds has been added after starting the services in order to wait for the goroutine that handles reloads to get instantiated. This solves the occasional deadlock that happens when a reload signal is sent to a subsystem that requires storDB before sending it to storDB itself. One consequence of waiting is that where we previously expected the DataDB service to not be running yet, now it has enough time.
This commit is contained in:
committed by
Dan Christian Bogos
parent
8a18eb87ec
commit
0473e66555
@@ -66,14 +66,15 @@ func TestApiersReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if apiSv1.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
if apiSv2.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
if db.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
if stordb.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
|
||||
@@ -59,6 +59,7 @@ func TestAttributeSReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if attrS.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
|
||||
@@ -79,11 +79,12 @@ func TestCdrsReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if cdrS.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
if db.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
if stordb.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
|
||||
@@ -61,11 +61,12 @@ func TestChargerSReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if chrS.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
if db.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
var reply string
|
||||
if err = cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithArgDispatcher{
|
||||
|
||||
@@ -58,6 +58,7 @@ func TestDataDBReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if db.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
|
||||
@@ -63,11 +63,12 @@ func TestDispatcherSReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if srv.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
if db.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
var reply string
|
||||
if err = cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithArgDispatcher{
|
||||
|
||||
@@ -60,6 +60,7 @@ func TestDNSAgentReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if srv.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ func TestEventReaderSReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if attrS.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
|
||||
@@ -75,11 +75,12 @@ func TestRalsReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if ralS.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
if db.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
if stordb.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
|
||||
@@ -63,11 +63,12 @@ func TestResourceSReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if reS.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
if db.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
var reply string
|
||||
if err = cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithArgDispatcher{
|
||||
|
||||
@@ -54,6 +54,7 @@ func TestSchedulerSReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if schS.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
|
||||
@@ -86,14 +86,15 @@ func TestSessionSReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if srv.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
if db.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
if stordb.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
if !stordb.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
var reply string
|
||||
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithArgDispatcher{
|
||||
|
||||
@@ -63,11 +63,12 @@ func TestStatSReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if sS.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
if db.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
var reply string
|
||||
if err = cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithArgDispatcher{
|
||||
|
||||
@@ -61,11 +61,12 @@ func TestSupplierSReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if supS.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
if db.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
var reply string
|
||||
if err := cfg.V1ReloadConfigFromPath(&config.ConfigReloadWithArgDispatcher{
|
||||
|
||||
@@ -57,6 +57,7 @@ func TestThresholdSReload(t *testing.T) {
|
||||
if err = srvMngr.StartServices(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if tS.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user