diff --git a/apis/cores_it_test.go b/apis/cores_it_test.go index 149340c0f..02b0d5dea 100644 --- a/apis/cores_it_test.go +++ b/apis/cores_it_test.go @@ -58,7 +58,6 @@ var ( testCoreItStopCPUProfiling, //status api testCoreItStatus, - testCoreItKillEngine, //engine separate with memory @@ -85,6 +84,7 @@ var ( testCoreItSleep, testCoreItStopMemoryProfiling, testCoreItKillEngine, + testCoreItCheckFinalMemProfiling, } ) diff --git a/apis/cores_test.go b/apis/cores_test.go index 82fe8f058..c64418ecf 100644 --- a/apis/cores_test.go +++ b/apis/cores_test.go @@ -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 diff --git a/cores/core_test.go b/cores/core_test.go index 17ffd1795..6830f743b 100644 --- a/cores/core_test.go +++ b/cores/core_test.go @@ -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{}{}, diff --git a/services/cores.go b/services/cores.go index 1fb2eb45f..09440bccc 100644 --- a/services/cores.go +++ b/services/cores.go @@ -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 { diff --git a/services/cores_test.go b/services/cores_test.go index 57cc29e21..61c820d0e 100644 --- a/services/cores_test.go +++ b/services/cores_test.go @@ -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 ,\n Received <%+v>", utils.ToJSON(srv)) }