mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
IMproved sipatcher test cases and cache conn bug
This commit is contained in:
@@ -665,7 +665,9 @@ func TestLibDispatcherLoadDispatcherCacheError4(t *testing.T) {
|
||||
cacheInit := engine.Cache
|
||||
cfg := config.NewDefaultCGRConfig()
|
||||
cfg.CacheCfg().ReplicationConns = []string{"con"}
|
||||
cfg.CacheCfg().RemoteConns = []string{"con1"}
|
||||
cfg.CacheCfg().Partitions[utils.CacheDispatcherRoutes].Replicate = true
|
||||
cfg.CacheCfg().Partitions[utils.CacheDispatcherRoutes].Remote = true
|
||||
cfg.RPCConns()["con"] = &config.RPCConn{
|
||||
Strategy: "",
|
||||
PoolSize: 0,
|
||||
@@ -678,8 +680,20 @@ func TestLibDispatcherLoadDispatcherCacheError4(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}
|
||||
rpcCl := map[string]chan rpcclient.ClientConnector{}
|
||||
connMng := engine.NewConnManager(cfg, rpcCl)
|
||||
cfg.RPCConns()["con1"] = &config.RPCConn{
|
||||
Strategy: "*first",
|
||||
PoolSize: 0,
|
||||
Conns: []*config.RemoteHost{
|
||||
{
|
||||
ID: "conn_internal",
|
||||
Address: "*internal",
|
||||
Transport: "",
|
||||
TLS: false,
|
||||
},
|
||||
},
|
||||
}
|
||||
//rpcCl := map[string]chan rpcclient.ClientConnector{}
|
||||
connMng := engine.NewConnManager(cfg, nil)
|
||||
dm := engine.NewDataManager(nil, nil, connMng)
|
||||
|
||||
newCache := engine.NewCacheS(cfg, dm, nil)
|
||||
@@ -722,7 +736,7 @@ func TestLibDispatcherLoadDispatcherCacheError4(t *testing.T) {
|
||||
sorter: new(noSort),
|
||||
}
|
||||
err := wgDsp.Dispatch(dm, nil, nil, "testTENANT", "testID", &DispatcherRoute{}, utils.AttributeSv1Ping, &utils.CGREvent{}, &wgDsp)
|
||||
expected := "DISCONNECTED"
|
||||
expected := "UNSUPPORTED_SERVICE_METHOD"
|
||||
if err == nil || err.Error() != expected {
|
||||
t.Errorf("\nExpected <%+v>, \nReceived <%+v>", expected, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user