mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-22 15:48:44 +05:00
Updated routes code + tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
739190d08f
commit
458d66d08f
@@ -853,8 +853,9 @@ func TestTPFilterAsTPFilter3(t *testing.T) {
|
||||
}
|
||||
|
||||
rcvTPs := FilterMdls(tps).AsTPFilter()
|
||||
sort.Strings(rcvTPs[0].Filters[0].Values)
|
||||
sort.Strings(eTPs[0].Filters[0].Values)
|
||||
sort.Slice(rcvTPs, func(i, j int) bool {
|
||||
return rcvTPs[i].Tenant > rcvTPs[j].Tenant
|
||||
})
|
||||
if !reflect.DeepEqual(eTPs, rcvTPs) {
|
||||
t.Errorf("Expecting: %+v \n ,Received: %+v", utils.ToJSON(eTPs), utils.ToJSON(rcvTPs))
|
||||
}
|
||||
|
||||
@@ -388,13 +388,11 @@ func (rpS *RouteS) sortedRoutesForEvent(ctx *context.Context, tnt string, args *
|
||||
prfCount := len(rPrfs) // if the option is not present return for all profiles
|
||||
var prfCountOpt *int
|
||||
if prfCountOpt, err = GetIntPointerOpts(ctx, tnt, args, rpS.fltrS, rpS.cfg.RouteSCfg().Opts.ProfileCount,
|
||||
utils.OptsRoutesProfileCount); err != nil {
|
||||
if err != utils.ErrNotFound { // if the error is NOT_FOUND, it means that in opts or config, countProfiles field is not defined, so we will get just 1 profile
|
||||
return
|
||||
}
|
||||
prfCountOpt = utils.IntPointer(1)
|
||||
utils.OptsRoutesProfileCount); err != nil && err != utils.ErrNotFound {
|
||||
// if the error is NOT_FOUND, it means that in opts or config, countProfiles field is not defined
|
||||
return
|
||||
}
|
||||
if prfCountOpt != nil || prfCount > *prfCountOpt { // it has the option and is smaller that the current number of profiles
|
||||
if prfCountOpt != nil && prfCount > *prfCountOpt { // it has the option and is smaller that the current number of profiles
|
||||
prfCount = *prfCountOpt
|
||||
}
|
||||
var extraOpts *optsGetRoutes
|
||||
|
||||
Reference in New Issue
Block a user