mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 23:28:44 +05:00
Changed args type for stop profiling apis
This commit is contained in:
committed by
Dan Christian Bogos
parent
29753ad61d
commit
3e13436e13
@@ -69,7 +69,7 @@ func (cS *CoreSv1) StartCPUProfiling(args *utils.DirectoryArgs, reply *string) e
|
||||
|
||||
// StopCPUProfiling is used to stop CPUProfiling. The file should be written on the path
|
||||
// where the CPUProfiling already started
|
||||
func (cS *CoreSv1) StopCPUProfiling(_ *utils.DirectoryArgs, reply *string) error {
|
||||
func (cS *CoreSv1) StopCPUProfiling(_ *utils.TenantWithAPIOpts, reply *string) error {
|
||||
if err := cS.cS.StopCPUProfiling(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -88,7 +88,7 @@ func (cS *CoreSv1) StartMemoryProfiling(args *utils.MemoryPrf, reply *string) er
|
||||
|
||||
// StopMemoryProfiling is used to stop MemoryProfiling. The file should be written on the path
|
||||
// where the MemoryProfiling already started
|
||||
func (cS *CoreSv1) StopMemoryProfiling(_ *utils.MemoryPrf, reply *string) error {
|
||||
func (cS *CoreSv1) StopMemoryProfiling(_ *utils.TenantWithAPIOpts, reply *string) error {
|
||||
if err := cS.cS.StopMemoryProfiling(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ func testCoreSv1StopMemProfilingBeforeStart(t *testing.T) {
|
||||
var reply string
|
||||
expectedErr := " Memory Profiling is not started"
|
||||
if err := coreV1Rpc.Call(utils.CoreSv1StopMemoryProfiling,
|
||||
new(utils.MemoryPrf), &reply); err == nil || err.Error() != expectedErr {
|
||||
new(utils.TenantWithAPIOpts), &reply); err == nil || err.Error() != expectedErr {
|
||||
t.Errorf("Expected %+q, received %+q", expectedErr, err)
|
||||
}
|
||||
}
|
||||
@@ -200,7 +200,7 @@ func testCoreSv1StartEngineByExecWIthMemProfiling(t *testing.T) {
|
||||
func testCoreSv1StopMemoryProfiling(t *testing.T) {
|
||||
var reply string
|
||||
if err := coreV1Rpc.Call(utils.CoreSv1StopMemoryProfiling,
|
||||
new(utils.MemoryPrf), &reply); err != nil {
|
||||
new(utils.TenantWithAPIOpts), &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Unexpected reply returned")
|
||||
@@ -267,7 +267,7 @@ func testCoreSv1StopCPUProfilingBeforeStart(t *testing.T) {
|
||||
var reply string
|
||||
expectedErr := " cannot stop because CPUProfiling is not active"
|
||||
if err := coreV1Rpc.Call(utils.CoreSv1StopCPUProfiling,
|
||||
new(utils.DirectoryArgs), &reply); err == nil || err.Error() != expectedErr {
|
||||
new(utils.TenantWithAPIOpts), &reply); err == nil || err.Error() != expectedErr {
|
||||
t.Errorf("Expected %+q, received %+q", expectedErr, err)
|
||||
}
|
||||
}
|
||||
@@ -301,7 +301,7 @@ func testCoreSv1Sleep(t *testing.T) {
|
||||
func testCoreSv1StopCPUProfiling(t *testing.T) {
|
||||
var reply string
|
||||
if err := coreV1Rpc.Call(utils.CoreSv1StopCPUProfiling,
|
||||
new(utils.DirectoryArgs), &reply); err != nil {
|
||||
new(utils.TenantWithAPIOpts), &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Unexpected reply returned")
|
||||
|
||||
@@ -896,7 +896,7 @@ func (dS *DispatcherCoreSv1) StartCPUProfiling(args *utils.DirectoryArgs, reply
|
||||
return dS.dS.CoreSv1StartCPUProfiling(args, reply)
|
||||
}
|
||||
|
||||
func (dS *DispatcherCoreSv1) StopCPUProfiling(args *utils.DirectoryArgs, reply *string) error {
|
||||
func (dS *DispatcherCoreSv1) StopCPUProfiling(args *utils.TenantWithAPIOpts, reply *string) error {
|
||||
return dS.dS.CoreSv1StopCPUProfiling(args, reply)
|
||||
}
|
||||
|
||||
@@ -904,7 +904,7 @@ func (dS *DispatcherCoreSv1) StartMemoryProfiling(args *utils.MemoryPrf, reply *
|
||||
return dS.dS.CoreSv1StartMemoryProfiling(args, reply)
|
||||
}
|
||||
|
||||
func (dS *DispatcherCoreSv1) StopMemoryProfiling(args *utils.MemoryPrf, reply *string) error {
|
||||
func (dS *DispatcherCoreSv1) StopMemoryProfiling(args *utils.TenantWithAPIOpts, reply *string) error {
|
||||
return dS.dS.CoreSv1StopMemoryProfiling(args, reply)
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ func (dS *DispatcherService) CoreSv1StartCPUProfiling(args *utils.DirectoryArgs,
|
||||
}, utils.MetaCore, utils.CoreSv1StartCPUProfiling, args, reply)
|
||||
}
|
||||
|
||||
func (dS *DispatcherService) CoreSv1StopCPUProfiling(args *utils.DirectoryArgs,
|
||||
func (dS *DispatcherService) CoreSv1StopCPUProfiling(args *utils.TenantWithAPIOpts,
|
||||
reply *string) (err error) {
|
||||
tnt := dS.cfg.GeneralCfg().DefaultTenant
|
||||
if args.Tenant != utils.EmptyString {
|
||||
@@ -128,7 +128,7 @@ func (dS *DispatcherService) CoreSv1StartMemoryProfiling(args *utils.MemoryPrf,
|
||||
}, utils.MetaCore, utils.CoreSv1StartMemoryProfiling, args, reply)
|
||||
}
|
||||
|
||||
func (dS *DispatcherService) CoreSv1StopMemoryProfiling(args *utils.MemoryPrf,
|
||||
func (dS *DispatcherService) CoreSv1StopMemoryProfiling(args *utils.TenantWithAPIOpts,
|
||||
reply *string) (err error) {
|
||||
tnt := dS.cfg.GeneralCfg().DefaultTenant
|
||||
if args.Tenant != utils.EmptyString {
|
||||
|
||||
@@ -135,13 +135,13 @@ func testDspCoreCPUProfile(t *testing.T) {
|
||||
t.Errorf("Unexpected reply returned")
|
||||
}
|
||||
|
||||
args = &utils.DirectoryArgs{
|
||||
argsStop := &utils.TenantWithAPIOpts{
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "core12345",
|
||||
},
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.CoreSv1StopCPUProfiling,
|
||||
args, &reply); err != nil {
|
||||
argsStop, &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Unexpected reply returned")
|
||||
@@ -210,16 +210,13 @@ func testDspCoreMemoryProfile(t *testing.T) {
|
||||
t.Errorf("Unexpected reply returned")
|
||||
}
|
||||
|
||||
args = &utils.MemoryPrf{
|
||||
DirPath: "/tmp",
|
||||
Interval: 100 * time.Millisecond,
|
||||
NrFiles: 2,
|
||||
argsStop := &utils.TenantWithAPIOpts{
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.OptsAPIKey: "core12345",
|
||||
},
|
||||
}
|
||||
if err := dispEngine.RPC.Call(utils.CoreSv1StopMemoryProfiling,
|
||||
args, &reply); err != nil {
|
||||
argsStop , &reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Unexpected reply returned")
|
||||
|
||||
Reference in New Issue
Block a user