mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-17 14:19:54 +05:00
Integration test for sessions replication updated with config session_replication_conns
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
"sessions": {
|
||||
"enabled": true, // starts SessionManager service: <true|false>
|
||||
"listen_bijson": "127.0.0.1:22014", // address where to listen for bidirectional JSON-RPC requests
|
||||
"sessions_replication_conns": [
|
||||
"session_replication_conns": [
|
||||
{"address": "127.0.0.1:2012", "transport": "*json"},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -82,11 +82,11 @@ func TestSMGBiRPCStartEngine(t *testing.T) {
|
||||
func TestSMGBiRPCApierRpcConn(t *testing.T) {
|
||||
time.Sleep(time.Duration(1 * time.Second))
|
||||
clntHandlers := map[string]interface{}{"SMGClientV1.DisconnectSession": handleDisconnectSession}
|
||||
if _, err = utils.NewBiJSONrpcClient(smgBiRPCCfg.SMGConfig.ListenBijson,
|
||||
if _, err = utils.NewBiJSONrpcClient(smgBiRPCCfg.SessionSCfg().ListenBijson,
|
||||
clntHandlers); err != nil { // First attempt is to make sure multiple clients are supported
|
||||
t.Fatal(err)
|
||||
}
|
||||
if smgBiRPC, err = utils.NewBiJSONrpcClient(smgBiRPCCfg.SMGConfig.ListenBijson,
|
||||
if smgBiRPC, err = utils.NewBiJSONrpcClient(smgBiRPCCfg.SessionSCfg().ListenBijson,
|
||||
clntHandlers); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -160,7 +160,8 @@ func TestSMGRplcUpdate(t *testing.T) {
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Wait for the sessions to be populated
|
||||
var aSessions []*ActiveSession
|
||||
if err := smgRplcSlvRPC.Call("SMGenericV1.GetActiveSessions", map[string]string{utils.OriginID: "123451"}, &aSessions); err != nil {
|
||||
if err := smgRplcSlvRPC.Call("SMGenericV1.GetActiveSessions",
|
||||
map[string]string{utils.OriginID: "123451"}, &aSessions); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(aSessions) != 1 {
|
||||
t.Errorf("Unexpected number of sessions received: %+v", aSessions)
|
||||
@@ -169,16 +170,20 @@ func TestSMGRplcUpdate(t *testing.T) {
|
||||
}
|
||||
var pSessions []*ActiveSession
|
||||
// Make sure we don't have passive session on active host
|
||||
if err := smgRplcSlvRPC.Call("SMGenericV1.GetPassiveSessions", nil, &pSessions); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
if err := smgRplcSlvRPC.Call("SMGenericV1.GetPassiveSessions", nil,
|
||||
&pSessions); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
}
|
||||
// Master should not longer have activeSession
|
||||
if err := smgRplcMstrRPC.Call("SMGenericV1.GetActiveSessions", map[string]string{utils.OriginID: "123451"}, &aSessions); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
if err := smgRplcMstrRPC.Call("SMGenericV1.GetActiveSessions",
|
||||
map[string]string{utils.OriginID: "123451"}, &aSessions); err == nil ||
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err)
|
||||
}
|
||||
cgrID := smgEv.GetCGRID(utils.META_DEFAULT)
|
||||
// Make sure session was replicated
|
||||
if err := smgRplcMstrRPC.Call("SMGenericV1.GetPassiveSessions", nil, &pSessions); err != nil {
|
||||
if err := smgRplcMstrRPC.Call("SMGenericV1.GetPassiveSessions",
|
||||
nil, &pSessions); err != nil {
|
||||
t.Error(err)
|
||||
} else if len(pSessions) != 1 {
|
||||
t.Errorf("PassiveSessions: %+v", pSessions)
|
||||
|
||||
Reference in New Issue
Block a user