mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-22 07:38:45 +05:00
Add integration test for routes with rates with empty rate profile ids
This commit is contained in:
committed by
Dan Christian Bogos
parent
3cde559ced
commit
78ee2c1ea5
@@ -41,11 +41,11 @@ func (hcs *HightCostSorter) SortRoutes(prflID string, routes []*Route,
|
||||
Sorting: hcs.sorting,
|
||||
SortedRoutes: make([]*SortedRoute, 0)}
|
||||
for _, route := range routes {
|
||||
if len(route.RatingPlanIDs) == 0 && len(route.AccountIDs) == 0 && len(route.RateProfileIDs) == 0 {
|
||||
if len(route.RatingPlanIDs) == 0 && len(route.AccountIDs) == 0 && len(hcs.rS.cgrcfg.RouteSCfg().RateSConns) == 0 {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<%s> supplier: <%s> - empty RatingPlanIDs or AccountIDs or RateProfileIDs",
|
||||
fmt.Sprintf("<%s> supplier: <%s> - empty RatingPlanIDs or AccountIDs or no connection with rateS",
|
||||
utils.RouteS, route.ID))
|
||||
return nil, utils.NewErrMandatoryIeMissing("RatingPlanIDs or AccountIDs or RateProfileIDs")
|
||||
return nil, utils.NewErrMandatoryIeMissing("RatingPlanIDs or AccountIDs or connection with rateS")
|
||||
}
|
||||
if srtSpl, pass, err := hcs.rS.populateSortingData(ev, route, extraOpts); err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -41,11 +41,11 @@ func (lcs *LeastCostSorter) SortRoutes(prflID string, routes []*Route,
|
||||
Sorting: lcs.sorting,
|
||||
SortedRoutes: make([]*SortedRoute, 0)}
|
||||
for _, s := range routes {
|
||||
if len(s.RatingPlanIDs) == 0 && len(s.AccountIDs) == 0 && len(s.RateProfileIDs) == 0 {
|
||||
if len(s.RatingPlanIDs) == 0 && len(s.AccountIDs) == 0 && len(lcs.rS.cgrcfg.RouteSCfg().RateSConns) == 0 {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<%s> supplier: <%s> - empty RatingPlanIDs or AccountIDs or RateProfileIDs",
|
||||
fmt.Sprintf("<%s> supplier: <%s> - empty RatingPlanIDs or AccountIDs or no connection with RateS",
|
||||
utils.RouteS, s.ID))
|
||||
return nil, utils.NewErrMandatoryIeMissing("RatingPlanIDs or AccountIDs or RateProfileIDs")
|
||||
return nil, utils.NewErrMandatoryIeMissing("RatingPlanIDs or AccountIDs or connection with RateS")
|
||||
}
|
||||
if srtSpl, pass, err := lcs.rS.populateSortingData(ev, s, extraOpts); err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -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 && len(rtPrfIDs) == 0 {
|
||||
return nil, fmt.Errorf("no rating plans or rate profiles defined for remaining usage")
|
||||
if len(rpIDs) == 0 && len(rpS.cgrcfg.RouteSCfg().RateSConns) == 0 {
|
||||
return nil, fmt.Errorf("no rating plans or no connection to RateS defined for remaining usage")
|
||||
}
|
||||
// update the setup time and the usage
|
||||
sTime = sTime.Add(accountMaxUsage)
|
||||
@@ -420,7 +420,7 @@ func (rpS *RouteService) populateSortingData(ev *utils.CGREvent, route *Route,
|
||||
RouteParameters: route.RouteParameters,
|
||||
}
|
||||
//calculate costData if we have fields
|
||||
if len(route.AccountIDs) != 0 || len(route.RatingPlanIDs) != 0 || len(route.RateProfileIDs) != 0 {
|
||||
if len(route.AccountIDs) != 0 || len(route.RatingPlanIDs) != 0 || len(rpS.cgrcfg.RouteSCfg().RateSConns) != 0 {
|
||||
costData, err := rpS.costForEvent(ev, route.AccountIDs, route.RatingPlanIDs, route.RateProfileIDs)
|
||||
if err != nil {
|
||||
if extraOpts.ignoreErrors {
|
||||
|
||||
Reference in New Issue
Block a user