mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Merge branch 'master' of https://github.com/cgrates/cgrates
This commit is contained in:
@@ -53,9 +53,9 @@ var (
|
||||
dbdata_encoding = flag.String("dbdata_encoding", cgrConfig.DBDataEncoding, "The encoding used to store object data in strings.")
|
||||
raterAddress = flag.String("rater_address", "", "Rater address for remote tests. Empty for internal rater.")
|
||||
tor = flag.String("tor", "call", "The type of record to use in queries.")
|
||||
tenant = flag.String("tenant", "call", "The type of record to use in queries.")
|
||||
tenant = flag.String("tenant", "cgrates.org", "The type of record to use in queries.")
|
||||
subject = flag.String("subject", "1001", "The rating subject to use in queries.")
|
||||
destination = flag.String("destination", "+4986517174963", "The destination to use in queries.")
|
||||
destination = flag.String("destination", "1002", "The destination to use in queries.")
|
||||
|
||||
nilDuration = time.Duration(0)
|
||||
)
|
||||
@@ -150,8 +150,8 @@ func main() {
|
||||
defer pprof.StopCPUProfile()
|
||||
}
|
||||
cd := &engine.CallDescriptor{
|
||||
TimeStart: time.Date(2013, time.December, 13, 22, 30, 0, 0, time.UTC),
|
||||
TimeEnd: time.Date(2013, time.December, 13, 22, 31, 0, 0, time.UTC),
|
||||
TimeStart: time.Date(2014, time.December, 11, 55, 30, 0, 0, time.UTC),
|
||||
TimeEnd: time.Date(2014, time.December, 11, 55, 31, 0, 0, time.UTC),
|
||||
CallDuration: 60 * time.Second,
|
||||
Direction: "*out",
|
||||
TOR: *tor,
|
||||
|
||||
@@ -47,9 +47,9 @@ cd = {"Direction":"*out",
|
||||
"TOR":"call",
|
||||
"Tenant": "cgrates.org",
|
||||
"Subject": "1001",
|
||||
"Destination": "+49",
|
||||
"TimeStart": "2013-08-07T17:30:00Z",
|
||||
"TimeEnd": "2013-08-07T18:30:00Z",
|
||||
"Destination": "1002",
|
||||
"TimeStart": "2014-04-03T11:12:23.190554134+02:00",
|
||||
"TimeEnd": "2014-04-03T11:13:23.190554134+02:00",
|
||||
"CallDuration": 60000000000,
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ cd = {"Direction":"*out",
|
||||
|
||||
start_time = time.time()
|
||||
i = 0
|
||||
runs = 1e5
|
||||
runs = 5e5
|
||||
result = ""
|
||||
for i in range(int(runs) + 1):
|
||||
result = rpc.call("Responder.GetCost", cd)
|
||||
|
||||
@@ -58,8 +58,8 @@ const (
|
||||
DEBIT = "*debit"
|
||||
RESET_COUNTER = "*reset_counter"
|
||||
RESET_COUNTERS = "*reset_counters"
|
||||
ENABLE_USER = "*enable_user"
|
||||
DISABLE_USER = "*disable_user"
|
||||
ENABLE_ACCOUNT = "*enable_account"
|
||||
DISABLE_ACCOUNT = "*disable_account"
|
||||
CALL_URL = "*call_url"
|
||||
CALL_URL_ASYNC = "*call_url_async"
|
||||
MAIL_ASYNC = "*mail_async"
|
||||
@@ -90,9 +90,9 @@ func getActionFunc(typ string) (actionTypeFunc, bool) {
|
||||
return resetCounterAction, true
|
||||
case RESET_COUNTERS:
|
||||
return resetCountersAction, true
|
||||
case ENABLE_USER:
|
||||
case ENABLE_ACCOUNT:
|
||||
return enableUserAction, true
|
||||
case DISABLE_USER:
|
||||
case DISABLE_ACCOUNT:
|
||||
return disableUserAction, true
|
||||
case CALL_URL:
|
||||
return callUrl, true
|
||||
|
||||
@@ -575,7 +575,7 @@ func TestMaxDebitZeroDefinedRate(t *testing.T) {
|
||||
cd1 := &CallDescriptor{
|
||||
Direction: "*out",
|
||||
TOR: "call",
|
||||
Tenant: "cgrates.directvoip.co.uk",
|
||||
Tenant: "cgrates.org",
|
||||
Subject: "12345",
|
||||
Account: "12345",
|
||||
Destination: "447956",
|
||||
@@ -603,7 +603,7 @@ func TestMaxDebitZeroDefinedRateOnlyMinutes(t *testing.T) {
|
||||
cd1 := &CallDescriptor{
|
||||
Direction: "*out",
|
||||
TOR: "call",
|
||||
Tenant: "cgrates.directvoip.co.uk",
|
||||
Tenant: "cgrates.org",
|
||||
Subject: "12345",
|
||||
Account: "12345",
|
||||
Destination: "447956",
|
||||
@@ -613,7 +613,7 @@ func TestMaxDebitZeroDefinedRateOnlyMinutes(t *testing.T) {
|
||||
CallDuration: 0}
|
||||
cc, err := cd1.MaxDebit()
|
||||
if err != nil {
|
||||
t.Error("Error maxdebiting: ", err)
|
||||
t.Fatal("Error maxdebiting: ", err)
|
||||
}
|
||||
if cc.GetDuration() != 40*time.Second {
|
||||
t.Error("Error obtaining max debit duration: ", cc.GetDuration())
|
||||
@@ -623,7 +623,29 @@ func TestMaxDebitZeroDefinedRateOnlyMinutes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************** BENCHMARKS ***************************************/
|
||||
func TestMaxDebitConsumesMinutes(t *testing.T) {
|
||||
ap, _ := accountingStorage.GetActionTimings("TOPUP10_AT")
|
||||
for _, at := range ap {
|
||||
at.Execute()
|
||||
}
|
||||
cd1 := &CallDescriptor{
|
||||
Direction: "*out",
|
||||
TOR: "call",
|
||||
Tenant: "cgrates.org",
|
||||
Subject: "12345",
|
||||
Account: "12345",
|
||||
Destination: "447956",
|
||||
TimeStart: time.Date(2014, 3, 4, 6, 0, 0, 0, time.UTC),
|
||||
TimeEnd: time.Date(2014, 3, 4, 6, 0, 5, 0, time.UTC),
|
||||
LoopIndex: 0,
|
||||
CallDuration: 0}
|
||||
cd1.MaxDebit()
|
||||
if cd1.account.BalanceMap[MINUTES+OUTBOUND][0].Value != 20 {
|
||||
t.Error("Error using minutes: ", cd1.account.BalanceMap[MINUTES+OUTBOUND][0].Value)
|
||||
}
|
||||
}
|
||||
|
||||
/*************** BENCHMARKS ********************/
|
||||
func BenchmarkStorageGetting(b *testing.B) {
|
||||
b.StopTimer()
|
||||
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
|
||||
|
||||
@@ -118,8 +118,8 @@ vdf,0,*out,fallback1,2013-11-18T13:45:00Z,G,fallback2
|
||||
vdf,0,*out,fallback1,2013-11-18T13:46:00Z,G,fallback2
|
||||
vdf,0,*out,fallback1,2013-11-18T13:47:00Z,G,fallback2
|
||||
vdf,0,*out,fallback2,2013-11-18T13:45:00Z,R,rif
|
||||
cgrates.directvoip.co.uk,call,*out,*any,2013-01-06T00:00:00Z,RP_UK,
|
||||
cgrates.directvoip.co.uk,call,*out,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,
|
||||
cgrates.org,call,*out,*any,2013-01-06T00:00:00Z,RP_UK,
|
||||
cgrates.org,call,*out,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,
|
||||
`
|
||||
sharedGroups = `
|
||||
SG1,*any,*lowest,
|
||||
@@ -157,7 +157,7 @@ STANDARD_TRIGGERS,*monetary,*out,*max_counter,5,FS_USERS,LOG_WARNING,10
|
||||
`
|
||||
accountActions = `
|
||||
vdf,minitsboy;a1;a2,*out,MORE_MINUTES,STANDARD_TRIGGER
|
||||
cgrates.directvoip.co.uk,12345,*out,TOPUP10_AT,STANDARD_TRIGGERS
|
||||
cgrates.org,12345,*out,TOPUP10_AT,STANDARD_TRIGGERS
|
||||
vdf,empty0,*out,TOPUP_SHARED0_AT,
|
||||
vdf,empty10,*out,TOPUP_SHARED10_AT,
|
||||
vdf,emptyX,*out,TOPUP_EMPTY_AT,
|
||||
|
||||
Reference in New Issue
Block a user