LIttle fix for MemProf final file

This commit is contained in:
porosnicuadrian
2021-07-08 10:45:18 +03:00
committed by Dan Christian Bogos
parent 2aeacca908
commit 89c6fc81c9
5 changed files with 10 additions and 9 deletions

View File

@@ -58,7 +58,6 @@ var (
testCoreItStopCPUProfiling,
//status api
testCoreItStatus,
testCoreItKillEngine,
//engine separate with memory
@@ -85,6 +84,7 @@ var (
testCoreItSleep,
testCoreItStopMemoryProfiling,
testCoreItKillEngine,
testCoreItCheckFinalMemProfiling,
}
)

View File

@@ -29,7 +29,7 @@ import (
func TestCoreSStatus(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
caps := engine.NewCaps(2, utils.MetaTopUp)
coreService := cores.NewCoreService(cfg, caps, nil, make(chan struct{}), nil, nil, nil)
coreService := cores.NewCoreService(cfg, caps, nil, utils.EmptyString, make(chan struct{}), nil, nil, nil)
cS := NewCoreSv1(coreService)
arg := &utils.TenantWithAPIOpts{
Tenant: "cgrates.org",
@@ -44,7 +44,7 @@ func TestCoreSStatus(t *testing.T) {
func TestCoreSSleep(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
caps := engine.NewCaps(2, utils.MetaTopUp)
coreService := cores.NewCoreService(cfg, caps, nil, make(chan struct{}), nil, nil, nil)
coreService := cores.NewCoreService(cfg, caps, nil, utils.EmptyString, make(chan struct{}), nil, nil, nil)
cS := NewCoreSv1(coreService)
arg := &utils.DurationArgs{
Duration: 1 * time.Millisecond,
@@ -61,7 +61,7 @@ func TestCoreSShutdown(t *testing.T) {
cfg := config.NewDefaultCGRConfig()
caps := engine.NewCaps(2, utils.MetaTopUp)
shdChan := utils.NewSyncedChan()
coreService := cores.NewCoreService(cfg, caps, nil, make(chan struct{}), nil, nil, shdChan)
coreService := cores.NewCoreService(cfg, caps, nil, utils.EmptyString, make(chan struct{}), nil, nil, shdChan)
cS := NewCoreSv1(coreService)
arg := &utils.CGREvent{}
var reply string

View File

@@ -41,9 +41,10 @@ func TestNewCoreService(t *testing.T) {
stopMemPrf: stopchan,
cfg: cfgDflt,
CapsStats: sts,
fileMEM: "/tmp",
shdChan: shdChan,
}
rcv := NewCoreService(cfgDflt, caps, nil, stopMemChan, nil, stopchan, shdChan)
rcv := NewCoreService(cfgDflt, caps, nil, "/tmp", stopMemChan, nil, stopchan, shdChan)
if !reflect.DeepEqual(expected, rcv) {
t.Errorf("Expected %+v, received %+v", utils.ToJSON(expected), utils.ToJSON(rcv))
}
@@ -59,7 +60,7 @@ func TestCoreServiceStatus(t *testing.T) {
stopChan := make(chan struct{}, 1)
shdChan := utils.NewSyncedChan()
cores := NewCoreService(cfgDflt, caps, nil, nil, nil, stopChan, shdChan)
cores := NewCoreService(cfgDflt, caps, nil, "/tmp", nil, nil, stopChan, shdChan)
args := &utils.TenantWithAPIOpts{
Tenant: "cgrates.org",
APIOpts: map[string]interface{}{},

View File

@@ -34,7 +34,7 @@ import (
// NewCoreService returns the Core Service
func NewCoreService(cfg *config.CGRConfig, caps *engine.Caps, server *cores.Server,
internalCoreSChan chan birpc.ClientConnector, anz *AnalyzerService,
fileCpu io.Closer, shdWg *sync.WaitGroup, stopMemPrf chan struct{},
fileCpu io.Closer, fileMEM string, shdWg *sync.WaitGroup, stopMemPrf chan struct{},
shdChan *utils.SyncedChan, srvDep map[string]*sync.WaitGroup) *CoreService {
return &CoreService{
shdChan: shdChan,
@@ -80,7 +80,7 @@ func (cS *CoreService) Start() (err error) {
defer cS.Unlock()
utils.Logger.Info(fmt.Sprintf("<%s> starting <%s> subsystem", utils.CoreS, utils.CoreS))
cS.stopChan = make(chan struct{})
cS.cS = cores.NewCoreService(cS.cfg, cS.caps, cS.fileCpu, cS.stopChan, cS.shdWg, cS.stopMemPrf, cS.shdChan)
cS.cS = cores.NewCoreService(cS.cfg, cS.caps, cS.fileCpu, cS.fileMem, cS.stopChan, cS.shdWg, cS.stopMemPrf, cS.shdChan)
cS.rpc = apis.NewCoreSv1(cS.cS)
srv, _ := birpc.NewService(cS.rpc, utils.EmptyString, false)
if !cS.cfg.DispatcherSCfg().Enabled {

View File

@@ -41,7 +41,7 @@ func TestCoreSCoverage(t *testing.T) {
srvDep := map[string]*sync.WaitGroup{utils.DataDB: new(sync.WaitGroup)}
anz := NewAnalyzerService(cfg, server, filterSChan, shdChan, make(chan birpc.ClientConnector, 1), srvDep)
srv := NewCoreService(cfg, caps, server,
internalCoreSChan, anz, nil, nil, nil, shdChan, srvDep)
internalCoreSChan, anz, nil, utils.EmptyString, nil, nil, shdChan, srvDep)
if srv == nil {
t.Errorf("\nExpecting <nil>,\n Received <%+v>", utils.ToJSON(srv))
}