mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Still trying to reproduce spikes
This commit is contained in:
committed by
Dan Christian Bogos
parent
1ecf6f4030
commit
cb4593d188
@@ -24,6 +24,7 @@ package general_tests
|
||||
import (
|
||||
"fmt"
|
||||
"net/rpc"
|
||||
"os/exec"
|
||||
"path"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -46,10 +47,11 @@ var (
|
||||
testSesPItResetDataDB,
|
||||
testSesPItResetStorDB,
|
||||
testSesPItStartEngine,
|
||||
// testSesPItStartEngineWithProfiling,
|
||||
testSesPItRPCConn,
|
||||
testSesPItBenchmark,
|
||||
// testSesPItCheckAccounts,
|
||||
testSesPItStopCgrEngine,
|
||||
// testSesPItStopCgrEngine,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -96,6 +98,13 @@ func testSesPItStartEngine(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func testSesPItStartEngineWithProfiling(t *testing.T) {
|
||||
engine := exec.Command("cgr-engine", "-config_path", fmt.Sprintf("/usr/share/cgrates/conf/samples/%s", sesPCfgDir), "-cpuprof_dir=~/prof/")
|
||||
if err := engine.Start(); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
|
||||
func testSesPItRPCConn(t *testing.T) {
|
||||
var err error
|
||||
sesPRPC, err = newRPCClient(sesPCfg.ListenCfg())
|
||||
@@ -148,7 +157,7 @@ func setAccBalance(acc string) (err error) {
|
||||
|
||||
func initSes(n int) (err error) {
|
||||
var accIDs []string
|
||||
for i := 0; i < 100; i++ {
|
||||
for i := 0; i < n; i++ {
|
||||
accIDs = append(accIDs, fmt.Sprintf("acc%d", i))
|
||||
}
|
||||
_, err = getAccounts(accIDs)
|
||||
@@ -183,7 +192,7 @@ func initSes(n int) (err error) {
|
||||
|
||||
for i := 0; i < n; i++ {
|
||||
initArgs.CGREvent.Event[utils.AccountField] = accIDs[i]
|
||||
initArgs.CGREvent.Event[utils.OriginID] = accIDs[i]
|
||||
initArgs.CGREvent.Event[utils.OriginID] = utils.UUIDSha1Prefix()
|
||||
if err = sesPRPC.Call(utils.SessionSv1InitiateSession,
|
||||
initArgs, &initRpl); err != nil {
|
||||
return
|
||||
@@ -195,6 +204,7 @@ func initSes(n int) (err error) {
|
||||
func testSesPItBenchmark(t *testing.T) {
|
||||
// add 2 charger profiles
|
||||
var reply string
|
||||
n := 100
|
||||
args := &v1.ChargerWithAPIOpts{
|
||||
ChargerProfile: &engine.ChargerProfile{
|
||||
Tenant: "cgrates.org",
|
||||
@@ -228,11 +238,11 @@ func testSesPItBenchmark(t *testing.T) {
|
||||
|
||||
////////// charger profiles set
|
||||
|
||||
if err := setAccounts(t, 100); err != nil {
|
||||
if err := setAccounts(t, n); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
if err := initSes(100); err != nil {
|
||||
if err := initSes(n); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
var statusRpl map[string]interface{}
|
||||
|
||||
Reference in New Issue
Block a user