mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-22 07:38:45 +05:00
Update integration test for Route with RateProfile
This commit is contained in:
committed by
Dan Christian Bogos
parent
58e00909c7
commit
3cde559ced
@@ -39,7 +39,7 @@ var (
|
||||
testV1RouteSWithRateSRpcConn,
|
||||
testV1RouteSWithRateSFromFolder,
|
||||
testV1RouteSWithRateSGetRoutes,
|
||||
//testV1RouteSWithRateSAccountWithRateProfile, //need to be discussed
|
||||
testV1RouteSWithRateSAccountWithRateProfile, //need to be discussed
|
||||
testV1RouteSWithRateSStopEngine,
|
||||
}
|
||||
)
|
||||
@@ -165,7 +165,6 @@ func testV1RouteSWithRateSGetRoutes(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func testV1RouteSWithRateSAccountWithRateProfile(t *testing.T) {
|
||||
routePrf = &RouteWithCache{
|
||||
RouteProfile: &engine.RouteProfile{
|
||||
@@ -250,10 +249,10 @@ func testV1RouteSWithRateSAccountWithRateProfile(t *testing.T) {
|
||||
{
|
||||
RouteID: "RouteWithAccAndRatePrf",
|
||||
SortingData: map[string]interface{}{
|
||||
utils.Account: "AccWithVoice",
|
||||
"Cost": 0.0,
|
||||
"MaxUsage": 30000000000.0,
|
||||
utils.Weight: 20.0,
|
||||
utils.Account: "AccWithVoice",
|
||||
utils.Cost: 0.0,
|
||||
utils.CapMaxUsage: 30000000000.0,
|
||||
utils.Weight: 20.0,
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -302,8 +301,8 @@ func testV1RouteSWithRateSAccountWithRateProfile(t *testing.T) {
|
||||
RouteID: "RouteWithAccAndRatePrf",
|
||||
SortingData: map[string]interface{}{
|
||||
utils.Account: "AccWithVoice",
|
||||
"Cost": 0.6,
|
||||
"MaxUsage": 30000000000.0,
|
||||
utils.Cost: 0.6,
|
||||
utils.CapMaxUsage: 30000000000.0,
|
||||
utils.RateProfileMatched: "RT_ANY2CNT_SEC",
|
||||
utils.Weight: 20.0,
|
||||
},
|
||||
@@ -311,7 +310,7 @@ func testV1RouteSWithRateSAccountWithRateProfile(t *testing.T) {
|
||||
{
|
||||
RouteID: "RouteWithRP",
|
||||
SortingData: map[string]interface{}{
|
||||
"Cost": 0.6,
|
||||
utils.Cost: 0.6,
|
||||
utils.RateProfileMatched: "RT_ANY1CNT_SEC",
|
||||
utils.Weight: 10.0,
|
||||
},
|
||||
@@ -363,7 +362,7 @@ func testV1RouteSWithRateSAccountWithRateProfile(t *testing.T) {
|
||||
SortingData: map[string]interface{}{
|
||||
utils.Account: "AccWithVoice",
|
||||
utils.Cost: 0.62,
|
||||
"MaxUsage": 30000000000.0,
|
||||
utils.CapMaxUsage: 30000000000.0,
|
||||
utils.RateProfileMatched: "RT_ANY2CNT_SEC",
|
||||
utils.Weight: 20.0,
|
||||
},
|
||||
@@ -380,7 +379,6 @@ func testV1RouteSWithRateSAccountWithRateProfile(t *testing.T) {
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
func testV1RouteSWithRateSStopEngine(t *testing.T) {
|
||||
if err := engine.KillEngine(100); err != nil {
|
||||
|
||||
2
data/tariffplans/routes_with_rates/DestinationRates.csv
Normal file
2
data/tariffplans/routes_with_rates/DestinationRates.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
#Id,DestinationId,RatesTag,RoundingMethod,RoundingDecimals,MaxCost,MaxCostStrategy
|
||||
DR_ANY_1CNT,*any,RT_1CNT,*up,5,0,
|
||||
|
2
data/tariffplans/routes_with_rates/Rates.csv
Normal file
2
data/tariffplans/routes_with_rates/Rates.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
#Id,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart
|
||||
RT_1CNT,0,0.01,60s,1s,0s
|
||||
|
2
data/tariffplans/routes_with_rates/RatingPlans.csv
Normal file
2
data/tariffplans/routes_with_rates/RatingPlans.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
#Id,DestinationRatesId,TimingTag,Weight
|
||||
RP_TESTIT1,DR_ANY_1CNT,*any,10
|
||||
|
2
data/tariffplans/routes_with_rates/RatingProfiles.csv
Normal file
2
data/tariffplans/routes_with_rates/RatingProfiles.csv
Normal file
@@ -0,0 +1,2 @@
|
||||
#Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject
|
||||
cgrates.org,*routes,*any,2018-01-01T00:00:00Z,RP_TESTIT1,
|
||||
|
@@ -262,8 +262,8 @@ func (rpS *RouteService) costForEvent(ev *utils.CGREvent,
|
||||
}
|
||||
if usage > accountMaxUsage {
|
||||
// remain usage needs to be covered by rating plans
|
||||
if len(rpIDs) == 0 {
|
||||
return nil, fmt.Errorf("no rating plans defined for remaining usage")
|
||||
if len(rpIDs) == 0 && len(rtPrfIDs) == 0 {
|
||||
return nil, fmt.Errorf("no rating plans or rate profiles defined for remaining usage")
|
||||
}
|
||||
// update the setup time and the usage
|
||||
sTime = sTime.Add(accountMaxUsage)
|
||||
@@ -278,7 +278,7 @@ func (rpS *RouteService) costForEvent(ev *utils.CGREvent,
|
||||
|
||||
if accountMaxUsage == 0 || accountMaxUsage < initialUsage {
|
||||
var rateRply RateProfileCost
|
||||
if len(rpS.cgrcfg.RouteSCfg().RateSConns) != 0 && len(rtPrfIDs) != 0 {
|
||||
if len(rpS.cgrcfg.RouteSCfg().RateSConns) != 0 {
|
||||
if err := rpS.connMgr.Call(rpS.cgrcfg.RouteSCfg().RateSConns, nil, utils.RateSv1CostForEvent,
|
||||
&utils.ArgsCostForEvent{
|
||||
RateProfileIDs: rtPrfIDs,
|
||||
|
||||
Reference in New Issue
Block a user