mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Add sanity check for Session Replicate Connection
This commit is contained in:
@@ -56,7 +56,6 @@ const CGRATES_CFG_JSON = `
|
||||
|
||||
"rpc_conns": {
|
||||
"*localhost": {
|
||||
"strategy": "*first",
|
||||
"conns": [{"address": "127.0.0.1:2012", "transport":"*json"}],
|
||||
},
|
||||
}, // rpc connections definitions
|
||||
|
||||
@@ -358,7 +358,7 @@ func TestCGRConfigReloadSessionS(t *testing.T) {
|
||||
AttrSConns: []string{utils.MetaLocalHost},
|
||||
CDRsConns: []string{utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCDRs)},
|
||||
|
||||
ReplicationConns: []*RemoteHost{},
|
||||
ReplicationConns: []string{},
|
||||
MaxCallDuration: 3 * time.Hour,
|
||||
SessionIndexes: utils.NewStringMap(),
|
||||
ClientProtocol: 1,
|
||||
|
||||
@@ -207,6 +207,11 @@ func (cfg *CGRConfig) checkConfigSanity() error {
|
||||
return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SessionS, connID)
|
||||
}
|
||||
}
|
||||
for _, connID := range cfg.sessionSCfg.ReplicationConns {
|
||||
if _, has := cfg.rpcConns[connID]; !has {
|
||||
return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SessionS, connID)
|
||||
}
|
||||
}
|
||||
if cfg.cacheCfg[utils.CacheClosedSessions].Limit == 0 {
|
||||
return fmt.Errorf("<%s> %s needs to be != 0, received: %d", utils.CacheS, utils.CacheClosedSessions, cfg.cacheCfg[utils.CacheClosedSessions].Limit)
|
||||
}
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
"strategy": "*first",
|
||||
"conns": [{"address": "127.0.0.1:6012", "transport":"*json"}],
|
||||
},
|
||||
"rplConn": {
|
||||
"strategy": "*broadcast_sync",
|
||||
"conns": [{"address": "127.0.0.1:7012", "transport":"*json"}],
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"conns": [{"address": "127.0.0.1:22012", "transport":"*json"}],
|
||||
},
|
||||
"rplConn": {
|
||||
"strategy": "*broadcast_sync",
|
||||
"strategy": "*broadcast",
|
||||
"conns": [{"address": "127.0.0.1:2012", "transport": "*json"}],
|
||||
}
|
||||
},
|
||||
|
||||
@@ -28,7 +28,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/config"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
@@ -705,12 +704,7 @@ func testDspSessionReplicate(t *testing.T) {
|
||||
ArgsReplicateSessions: sessions.ArgsReplicateSessions{
|
||||
CGRID: "c87609aa1cb6e9529ab1836cfeeebaab7aa7ebaf",
|
||||
Passive: false,
|
||||
Connections: []*config.RemoteHost{
|
||||
&config.RemoteHost{
|
||||
Address: "127.0.0.1:7012",
|
||||
Transport: utils.MetaJSON,
|
||||
},
|
||||
},
|
||||
ConnIDs: []string{"rplConn"},
|
||||
},
|
||||
}, &reply); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user