mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Tests in services
This commit is contained in:
committed by
Dan Christian Bogos
parent
25b2fdb6ec
commit
3b7c390602
@@ -92,7 +92,6 @@ func TestFreeSwitchAgentReload(t *testing.T) {
|
||||
}
|
||||
|
||||
srv.(*FreeswitchAgent).fS = agents.NewFSsessions(agentCfg, "", nil)
|
||||
|
||||
err := srv.Reload()
|
||||
if err != nil {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
|
||||
|
||||
@@ -66,6 +66,7 @@ func TestKamailioAgentReload(t *testing.T) {
|
||||
if err := srvMngr.StartServices(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if srv.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
@@ -78,6 +79,9 @@ func TestKamailioAgentReload(t *testing.T) {
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Expecting OK ,received %s", reply)
|
||||
}
|
||||
|
||||
runtime.Gosched()
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
kaCfg := &config.KamAgentCfg{
|
||||
Enabled: true,
|
||||
SessionSConns: []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaSessionS)},
|
||||
@@ -88,13 +92,13 @@ func TestKamailioAgentReload(t *testing.T) {
|
||||
|
||||
srv.(*KamailioAgent).kam = agents.NewKamailioAgent(kaCfg, nil, "")
|
||||
|
||||
srv.Reload()
|
||||
runtime.Gosched()
|
||||
err := srv.Reload()
|
||||
if err != nil {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", nil, err)
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond) //need to switch to gorutine
|
||||
// the engine should be stoped as we could not connect to kamailio
|
||||
if srv.IsRunning() {
|
||||
t.Errorf("Expected service to be down")
|
||||
}
|
||||
|
||||
shdChan.CloseOnce()
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
|
||||
@@ -110,6 +110,7 @@ func TestSessionSReload(t *testing.T) {
|
||||
if !srv.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
if !db.IsRunning() {
|
||||
t.Errorf("Expected service to be running")
|
||||
}
|
||||
|
||||
@@ -122,7 +122,10 @@ func TestStorDBReload(t *testing.T) {
|
||||
if err := stordb.Reload(); err != nil {
|
||||
t.Errorf("\nExpecting <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
|
||||
err := stordb.Start()
|
||||
if err != utils.ErrServiceAlreadyRunning {
|
||||
t.Errorf("\nExpecting <%+v>,\n Received <%+v>", utils.ErrServiceAlreadyRunning, err)
|
||||
}
|
||||
if err := stordb.Reload(); err != nil {
|
||||
t.Errorf("\nExpecting <nil>,\n Received <%+v>", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user