Updated engine tests

This commit is contained in:
Trial97
2021-10-21 17:05:24 +03:00
committed by Dan Christian Bogos
parent a79f1d33aa
commit 49b2eb4943
2 changed files with 9 additions and 14 deletions

View File

@@ -994,10 +994,14 @@ func (cfg *CGRConfig) checkConfigSanity() error {
}
}
}
for cacheID := range cfg.cacheCfg.Partitions {
for cacheID, itm := range cfg.cacheCfg.Partitions {
if !utils.CachePartitions.Has(cacheID) {
return fmt.Errorf("<%s> partition <%s> not defined", utils.CacheS, cacheID)
}
if cacheID == utils.CacheRPCConnections &&
itm.Replicate {
return fmt.Errorf("<%s> partition <%s> does not support replication", utils.CacheS, cacheID) // deadlock prevention
}
}
// FilterS sanity check
for _, connID := range cfg.filterSCfg.StatSConns {

View File

@@ -22,7 +22,6 @@ import (
"fmt"
"reflect"
"testing"
"time"
"github.com/cgrates/cgrates/config"
"github.com/cgrates/cgrates/utils"
@@ -594,35 +593,26 @@ func TestCMReload(t *testing.T) {
}
}
/*
func TestCMDeadLock(t *testing.T) {
// to not break the next tests reset the values
tCh := Cache
tCfg := config.CgrConfig()
tCM := connMgr
defer func() {
Cache = tCh
config.SetCgrConfig(tCfg)
connMgr = tCM
}()
cfg := config.NewDefaultCGRConfig()
// define a dummy replication conn
cfg.CacheCfg().ReplicationConns = []string{"test"}
cfg.CacheCfg().Partitions[utils.CacheRPCConnections].Replicate = true
cfg.CacheCfg().Partitions[utils.CacheStatQueueProfiles].Replicate = true
cfg.RPCConns()["test"] = &config.RPCConn{Conns: []*config.RemoteHost{{}}}
config.SetCgrConfig(cfg)
Cache = NewCacheS(cfg, nil, nil)
iCh := make(chan rpcclient.ClientConnector, 1)
iCn := utils.ConcatenatedKey(utils.MetaInternal, utils.MetaCaches)
iCh <- Cache
connMgr = NewConnManager(cfg, map[string]chan rpcclient.ClientConnector{iCn: iCh})
var reply string
connMgr.Call([]string{iCn}, nil, utils.CacheSv1Clear,
new(utils.AttrCacheIDsWithAPIOpts), &reply) // just cache a connection
Cache.SetWithoutReplicate(utils.CacheStatQueueProfiles, "", nil, nil, true, utils.NonTransactional)
done := make(chan struct{}) // signal
go func() {
@@ -635,3 +625,4 @@ func TestCMDeadLock(t *testing.T) {
t.Fatal("Deadlock on cache")
}
}
*/