mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Update integration test
This commit is contained in:
committed by
Dan Christian Bogos
parent
d081229d0d
commit
4643ff8f15
@@ -100,7 +100,7 @@ func TestSMGV1CacheStats(t *testing.T) {
|
||||
t.Error(reply)
|
||||
}
|
||||
var rcvStats *utils.CacheStats
|
||||
expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 9,
|
||||
expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 10,
|
||||
Actions: 9, ActionPlans: 4, AccountActionPlans: 5, SharedGroups: 1, DerivedChargers: 1,
|
||||
LcrProfiles: 5, CdrStats: 6, Users: 3, Aliases: 1, ReverseAliases: 2, ResourceProfiles: 3, Resources: 3, StatQueues: 0,
|
||||
StatQueueProfiles: 0, Thresholds: 7, ThresholdProfiles: 7, Filters: 15}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#Id,ActionsId,TimingId,Weight
|
||||
PACKAGE_1,LOG,*asap,10
|
||||
PACKAGE_1,LOG,FIRST_OF_YEAR_2020,10
|
||||
PACKAGE_2,LOG,FIRST_OF_YEAR_2020,10
|
||||
PACKAGE_2,LOG,FIRST_OF_YEAR_2020,10
|
||||
|
||||
|
@@ -1 +1,2 @@
|
||||
LOG,*log,,,,,,,,,,,,,,false,false,10
|
||||
#ActionsId[0],Action[1],ExtraParameters[2],Filter[3],BalanceId[4],BalanceType[5],Directions[6],Categories[7],DestinationIds[8],RatingSubject[9],SharedGroup[10],ExpiryTime[11],TimingIds[12],Units[13],BalanceWeight[14],BalanceBlocker[15],BalanceDisabled[16],Weight[17]
|
||||
LOG,*log,,,,,,,,,,,,,,false,false,10
|
||||
|
||||
|
@@ -1 +1,2 @@
|
||||
#Id,DestinationId,RatesTag,RoundingMethod,RoundingDecimals,MaxCost,MaxCostStrategy
|
||||
DR_DATA1,*any,RT_DATA1,*up,5,,
|
||||
|
||||
|
@@ -1 +1,2 @@
|
||||
#Id,DestinationRatesId,TimingTag,Weight
|
||||
RP_DATA1,DR_DATA1,*any,10
|
||||
|
||||
|
@@ -1 +1,2 @@
|
||||
#Direction,Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject,CdrStatQueueIds
|
||||
*out,cgrates.org,data1,rpdata1,2015-01-01T00:00:00Z,RP_DATA1,,
|
||||
|
||||
|
@@ -1 +1,2 @@
|
||||
FIRST_OF_YEAR_2020,2020,1,1,*any,00:00:00
|
||||
#Tag,Years,Months,MonthDays,WeekDays,Time
|
||||
FIRST_OF_YEAR_2020,2020,1,1,*any,00:00:00
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
#ActionsId[0],Action[1],ExtraParameters[2],Filter[3],BalanceId[4],BalanceType[5],Directions[6],Categories[7],DestinationIds[8],RatingSubject[9],SharedGroup[10],ExpiryTime[11],TimingIds[12],Units[13],BalanceWeight[14],BalanceBlocker[15],BalanceDisabled[16],Weight[17]
|
||||
TOPUP_RST_10,*topup_reset,,,,*monetary,*out,,*any,,,*unlimited,,10,10,false,false,10
|
||||
TOPUP_RST_5,*topup_reset,,,,*monetary,*out,,*any,,,*unlimited,,5,20,false,false,10
|
||||
TOPUP_RST_5,*topup_reset,,,,*voice,*out,,DST_1002,SPECIAL_1002,,*unlimited,,90,20,false,false,10
|
||||
TOPUP_120_DST1003,*topup_reset,,,,*voice,*out,,DST_1003,,,*unlimited,,120,20,false,false,10
|
||||
TOPUP_RST_5,*topup_reset,,,,*voice,*out,,DST_1002,SPECIAL_1002,,*unlimited,,90s,20,false,false,10
|
||||
TOPUP_120_DST1003,*topup_reset,,,,*voice,*out,,DST_1003,,,*unlimited,,120s,20,false,false,10
|
||||
TOPUP_RST_SHARED_5,*topup,,,,*monetary,*out,,*any,,SHARED_A,*unlimited,,5,10,false,false,10
|
||||
SHARED_A_0,*topup_reset,,,,*monetary,*out,,*any,,SHARED_A,*unlimited,,0,10,false,false,10
|
||||
TOPUP_RST_DATA_100,*topup_reset,,,,*data,*out,,*any,,,*unlimited,,102400,10,false,false,10
|
||||
|
||||
|
@@ -148,7 +148,7 @@ func TestA1itDataSession1(t *testing.T) {
|
||||
var maxUsage float64
|
||||
if err := a1rpc.Call(utils.SMGenericV2InitiateSession, smgEv, &maxUsage); err != nil {
|
||||
t.Error(err)
|
||||
} else if maxUsage != 0.000010240 {
|
||||
} else if maxUsage != 10240 {
|
||||
t.Error("Received: ", maxUsage)
|
||||
}
|
||||
smgEv = sessionmanager.SMGenericEvent{
|
||||
@@ -174,7 +174,7 @@ func TestA1itDataSession1(t *testing.T) {
|
||||
if err := a1rpc.Call(utils.SMGenericV2UpdateSession,
|
||||
smgEv, &maxUsage); err != nil {
|
||||
t.Error(err)
|
||||
} else if maxUsage != 0.002097152 {
|
||||
} else if maxUsage != 2097152 {
|
||||
t.Error("Bad max usage: ", maxUsage)
|
||||
}
|
||||
smgEv = sessionmanager.SMGenericEvent{
|
||||
|
||||
@@ -43,7 +43,7 @@ func TestAcntActsLoadCsv(t *testing.T) {
|
||||
ratingProfiles := ``
|
||||
sharedGroups := ``
|
||||
lcrs := ``
|
||||
actions := `TOPUP10_AC,*topup_reset,,,,*voice,*out,,*any,,,*unlimited,,10,10,false,false,10
|
||||
actions := `TOPUP10_AC,*topup_reset,,,,*voice,*out,,*any,,,*unlimited,,10s,10,false,false,10
|
||||
DISABLE_ACNT,*disable_account,,,,,,,,,,,,,,false,false,10
|
||||
ENABLE_ACNT,*enable_account,,,,,,,,,,,,,,false,false,10`
|
||||
actionPlans := `TOPUP10_AT,TOPUP10_AC,ASAP,10`
|
||||
|
||||
@@ -98,7 +98,7 @@ func TestTutSMGCacheStats(t *testing.T) {
|
||||
t.Error(reply)
|
||||
}
|
||||
var rcvStats *utils.CacheStats
|
||||
expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 9,
|
||||
expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 10,
|
||||
Actions: 9, ActionPlans: 4, AccountActionPlans: 5, SharedGroups: 1, DerivedChargers: 1, LcrProfiles: 5,
|
||||
CdrStats: 6, Users: 3, Aliases: 1, ReverseAliases: 2, ResourceProfiles: 3, Resources: 3, StatQueues: 0,
|
||||
StatQueueProfiles: 0, Thresholds: 7, ThresholdProfiles: 7, Filters: 15}
|
||||
|
||||
@@ -102,7 +102,7 @@ func TestTutITCacheStats(t *testing.T) {
|
||||
t.Error(reply)
|
||||
}
|
||||
var rcvStats *utils.CacheStats
|
||||
expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 9,
|
||||
expectedStats := &utils.CacheStats{Destinations: 5, ReverseDestinations: 7, RatingPlans: 4, RatingProfiles: 10,
|
||||
Actions: 9, ActionPlans: 4, AccountActionPlans: 5, SharedGroups: 1, DerivedChargers: 1, LcrProfiles: 5,
|
||||
CdrStats: 6, Users: 3, Aliases: 1, ReverseAliases: 2, ResourceProfiles: 3, Resources: 3, StatQueues: 0,
|
||||
StatQueueProfiles: 0, Thresholds: 7, ThresholdProfiles: 7, Filters: 15}
|
||||
|
||||
@@ -176,7 +176,7 @@ func TestSMGVoiceVoiceRefund(t *testing.T) {
|
||||
}
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
eAcntVal := 120.0
|
||||
eAcntVal := 120.0 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
@@ -202,7 +202,7 @@ func TestSMGVoiceVoiceRefund(t *testing.T) {
|
||||
if err = smgRPC.Call("SMGenericV1.TerminateSession", smgEv, &rpl); err != nil || rpl != utils.OK {
|
||||
t.Error(err)
|
||||
}
|
||||
eAcntVal = 150.0
|
||||
eAcntVal = 150.0 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
@@ -242,7 +242,7 @@ func TestSMGVoiceMixedRefund(t *testing.T) {
|
||||
}
|
||||
//var acnt *engine.Account
|
||||
//attrs := &utils.AttrGetAccount{Tenant: "cgrates.org", Account: "1001"}
|
||||
eVoiceVal := 90.0
|
||||
eVoiceVal := 90.0 * float64(time.Second)
|
||||
eMoneyVal := 8.7399
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
@@ -269,7 +269,7 @@ func TestSMGVoiceMixedRefund(t *testing.T) {
|
||||
if err = smgRPC.Call("SMGenericV1.TerminateSession", smgEv, &rpl); err != nil || rpl != utils.OK {
|
||||
t.Error(err)
|
||||
}
|
||||
eVoiceVal = 90.0
|
||||
eVoiceVal = 90.0 * float64(time.Second)
|
||||
eMoneyVal = 8.79
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
@@ -677,7 +677,7 @@ func TestSMGVoiceSessionTTL(t *testing.T) {
|
||||
|
||||
func TestSMGVoiceSessionTTLWithRelocate(t *testing.T) {
|
||||
attrSetBalance := utils.AttrSetBalance{Tenant: "cgrates.org", Account: "TestTTLWithRelocate", BalanceType: utils.VOICE, BalanceID: utils.StringPointer("TestTTLWithRelocate"),
|
||||
Value: utils.Float64Pointer(300), RatingSubject: utils.StringPointer("*zero50ms")}
|
||||
Value: utils.Float64Pointer(300 * float64(time.Second)), RatingSubject: utils.StringPointer("*zero50ms")}
|
||||
var reply string
|
||||
if err := smgRPC.Call("ApierV2.SetBalance", attrSetBalance, &reply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -686,7 +686,7 @@ func TestSMGVoiceSessionTTLWithRelocate(t *testing.T) {
|
||||
}
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: attrSetBalance.Tenant, Account: attrSetBalance.Account}
|
||||
eAcntVal := 300.0
|
||||
eAcntVal := 300.0 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
@@ -724,7 +724,7 @@ func TestSMGVoiceSessionTTLWithRelocate(t *testing.T) {
|
||||
} else if aSessions[0].Usage != time.Duration(120)*time.Second {
|
||||
t.Errorf("Expecting 2m, received usage: %v", aSessions[0].Usage)
|
||||
}
|
||||
eAcntVal = 180.0
|
||||
eAcntVal = 180.0 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
@@ -762,7 +762,7 @@ func TestSMGVoiceSessionTTLWithRelocate(t *testing.T) {
|
||||
} else if aSessions[0].Usage != time.Duration(150)*time.Second {
|
||||
t.Errorf("Expecting 2m30s, received usage: %v", aSessions[0].Usage)
|
||||
}
|
||||
eAcntVal = 150.0
|
||||
eAcntVal = 150.0 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
@@ -771,7 +771,7 @@ func TestSMGVoiceSessionTTLWithRelocate(t *testing.T) {
|
||||
}
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
eAcntVal = 149.95
|
||||
eAcntVal = 149.95 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
@@ -802,7 +802,7 @@ func TestSMGVoiceSessionTTLWithRelocate(t *testing.T) {
|
||||
func TestSMGVoiceRelocateWithOriginIDPrefix(t *testing.T) {
|
||||
attrSetBalance := utils.AttrSetBalance{Tenant: "cgrates.org", Account: "TestRelocateWithOriginIDPrefix",
|
||||
BalanceType: utils.VOICE, BalanceID: utils.StringPointer("TestRelocateWithOriginIDPrefix"),
|
||||
Value: utils.Float64Pointer(300), RatingSubject: utils.StringPointer("*zero1s")}
|
||||
Value: utils.Float64Pointer(300 * float64(time.Second)), RatingSubject: utils.StringPointer("*zero1s")}
|
||||
var reply string
|
||||
if err := smgRPC.Call("ApierV2.SetBalance", attrSetBalance, &reply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -811,7 +811,7 @@ func TestSMGVoiceRelocateWithOriginIDPrefix(t *testing.T) {
|
||||
}
|
||||
var acnt *engine.Account
|
||||
attrs := &utils.AttrGetAccount{Tenant: attrSetBalance.Tenant, Account: attrSetBalance.Account}
|
||||
eAcntVal := 300.0
|
||||
eAcntVal := 300.0 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
@@ -849,7 +849,7 @@ func TestSMGVoiceRelocateWithOriginIDPrefix(t *testing.T) {
|
||||
} else if aSessions[0].Usage != time.Duration(120)*time.Second {
|
||||
t.Errorf("Expecting 2m, received usage: %v", aSessions[0].Usage)
|
||||
}
|
||||
eAcntVal = 180.0
|
||||
eAcntVal = 180.0 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
@@ -885,7 +885,7 @@ func TestSMGVoiceRelocateWithOriginIDPrefix(t *testing.T) {
|
||||
} else if aSessions[0].Usage != time.Duration(150)*time.Second {
|
||||
t.Errorf("Expecting 2m30s, received usage: %v", aSessions[0].Usage)
|
||||
}
|
||||
eAcntVal = 150.0
|
||||
eAcntVal = 150.0 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
@@ -913,7 +913,7 @@ func TestSMGVoiceRelocateWithOriginIDPrefix(t *testing.T) {
|
||||
utils.ACCID: "12372-1"}, &aSessions); err == nil || err.Error() != utils.ErrNotFound.Error() {
|
||||
t.Error(err, aSessions)
|
||||
}
|
||||
eAcntVal = 240
|
||||
eAcntVal = 240 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
|
||||
@@ -111,7 +111,7 @@ func TestSMGBiRPCSessionAutomaticDisconnects(t *testing.T) {
|
||||
Account: "TestSMGBiRPCSessionAutomaticDisconnects",
|
||||
BalanceType: utils.VOICE,
|
||||
BalanceID: utils.StringPointer("TestSMGBiRPCSessionAutomaticDisconnects"),
|
||||
Value: utils.Float64Pointer(0.01),
|
||||
Value: utils.Float64Pointer(0.01 * float64(time.Second)),
|
||||
RatingSubject: utils.StringPointer("*zero1ms")}
|
||||
var reply string
|
||||
if err := smgRPC.Call("ApierV2.SetBalance", attrSetBalance, &reply); err != nil {
|
||||
@@ -122,7 +122,7 @@ func TestSMGBiRPCSessionAutomaticDisconnects(t *testing.T) {
|
||||
var acnt *engine.Account
|
||||
attrGetAcnt := &utils.AttrGetAccount{Tenant: attrSetBalance.Tenant,
|
||||
Account: attrSetBalance.Account}
|
||||
eAcntVal := 0.01
|
||||
eAcntVal := 0.01 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrGetAcnt, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
@@ -195,7 +195,7 @@ func TestSMGBiRPCSessionAutomaticDisconnects(t *testing.T) {
|
||||
|
||||
func TestSMGBiRPCSessionOriginatorTerminate(t *testing.T) {
|
||||
attrSetBalance := utils.AttrSetBalance{Tenant: "cgrates.org", Account: "TestSMGBiRPCSessionOriginatorTerminate", BalanceType: utils.VOICE, BalanceID: utils.StringPointer("TestSMGBiRPCSessionOriginatorTerminate"),
|
||||
Value: utils.Float64Pointer(1), RatingSubject: utils.StringPointer("*zero1ms")}
|
||||
Value: utils.Float64Pointer(1 * float64(time.Second)), RatingSubject: utils.StringPointer("*zero1ms")}
|
||||
var reply string
|
||||
if err := smgRPC.Call("ApierV2.SetBalance", attrSetBalance, &reply); err != nil {
|
||||
t.Error(err)
|
||||
@@ -204,7 +204,7 @@ func TestSMGBiRPCSessionOriginatorTerminate(t *testing.T) {
|
||||
}
|
||||
var acnt *engine.Account
|
||||
attrGetAcnt := &utils.AttrGetAccount{Tenant: attrSetBalance.Tenant, Account: attrSetBalance.Account}
|
||||
eAcntVal := 1.0
|
||||
eAcntVal := 1.0 * float64(time.Second)
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrGetAcnt, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() != eAcntVal {
|
||||
@@ -242,7 +242,7 @@ func TestSMGBiRPCSessionOriginatorTerminate(t *testing.T) {
|
||||
time.Sleep(time.Duration(50 * time.Millisecond)) // Give time for debits to occur
|
||||
if err := smgRPC.Call("ApierV2.GetAccount", attrGetAcnt, &acnt); err != nil {
|
||||
t.Error(err)
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() > 0.995 { // FixMe: should be not 0.93?
|
||||
} else if acnt.BalanceMap[utils.VOICE].GetTotalValue() > 0.995*float64(time.Second) { // FixMe: should be not 0.93?
|
||||
t.Errorf("Balance value: %f", acnt.BalanceMap[utils.VOICE].GetTotalValue())
|
||||
}
|
||||
if err := smgRPC.Call("SMGenericV1.ProcessCDR", smgEv, &reply); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user