From 2831111cf8522a749ce075666fedea7c1f65f7e3 Mon Sep 17 00:00:00 2001 From: porosnicuadrian Date: Tue, 16 Feb 2021 12:01:09 +0200 Subject: [PATCH] Updated Weight fields name in integration tests --- apier/v1/cache_replication_it_test.go | 8 +- apier/v1/cost_bench_it_test.go | 10 +- apier/v1/full_remote_it_test.go | 8 +- apier/v1/rateprofiles_it_test.go | 239 ++++++++++++++++++-------- apier/v1/remote_it_test.go | 44 +++-- apier/v1/replicate_it_test.go | 44 +++-- apier/v1/tprateprofiles_it_test.go | 20 +-- dispatchers/rates_it_test.go | 12 +- dispatchers/replicator_it_test.go | 28 ++- migrator/rateprofiles_it_test.go | 25 ++- migrator/tp_rate_profiles_it_test.go | 6 +- 11 files changed, 297 insertions(+), 147 deletions(-) diff --git a/apier/v1/cache_replication_it_test.go b/apier/v1/cache_replication_it_test.go index 2d781841f..99d2087f8 100644 --- a/apier/v1/cache_replication_it_test.go +++ b/apier/v1/cache_replication_it_test.go @@ -192,8 +192,12 @@ func testCacheSReplicateProcessRateProfile(t *testing.T) { t.Error(err) } rate1 := &engine.Rate{ - ID: "RT_ALWAYS", - Weight: 0, + ID: "RT_ALWAYS", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * *", IntervalRates: []*engine.IntervalRate{ { diff --git a/apier/v1/cost_bench_it_test.go b/apier/v1/cost_bench_it_test.go index 50ad0f373..c986cf6d6 100644 --- a/apier/v1/cost_bench_it_test.go +++ b/apier/v1/cost_bench_it_test.go @@ -100,11 +100,11 @@ func testCostBenchSetRateProfile(b *testing.B) { APIRateProfile: &engine.APIRateProfile{ ID: "DefaultRate", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 10, + Weights: ";10", Rates: map[string]*engine.APIRate{ "RATE1": &engine.APIRate{ ID: "RATE1", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * *", IntervalRates: []*engine.APIIntervalRate{ { @@ -137,7 +137,7 @@ func testCostBenchSetRateProfile(b *testing.B) { func testCostBenchSetRateProfile2(b *testing.B) { rate1 := &engine.APIRate{ ID: "RATE1", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * *", IntervalRates: []*engine.APIIntervalRate{ { @@ -156,7 +156,7 @@ func testCostBenchSetRateProfile2(b *testing.B) { } rtChristmas := &engine.APIRate{ ID: "RT_CHRISTMAS", - Weight: 30, + Weights: ";30", ActivationTimes: "* * 24 12 *", IntervalRates: []*engine.APIIntervalRate{{ IntervalStart: "0", @@ -170,7 +170,7 @@ func testCostBenchSetRateProfile2(b *testing.B) { APIRateProfile: &engine.APIRateProfile{ ID: "RateChristmas", FilterIDs: []string{"*string:~*req.Subject:1010"}, - Weight: 50, + Weights: ";50", Rates: map[string]*engine.APIRate{ "RATE1": rate1, "RATE_CHRISTMAS": rtChristmas, diff --git a/apier/v1/full_remote_it_test.go b/apier/v1/full_remote_it_test.go index 2737d005a..886070c9a 100644 --- a/apier/v1/full_remote_it_test.go +++ b/apier/v1/full_remote_it_test.go @@ -611,22 +611,22 @@ func testFullRemoteITRate(t *testing.T) { Tenant: "cgrates.org", ID: "RP1", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, + Weights: ";0", MaxCostStrategy: "*free", Rates: map[string]*engine.APIRate{ "RT_WEEK": { ID: "RT_WEEK", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * 1-5", }, "RT_WEEKEND": { ID: "RT_WEEKEND", - Weight: 10, + Weights: ";10", ActivationTimes: "* * * * 0,6", }, "RT_CHRISTMAS": { ID: "RT_CHRISTMAS", - Weight: 30, + Weights: ";30", ActivationTimes: "* * 24 12 *", }, }, diff --git a/apier/v1/rateprofiles_it_test.go b/apier/v1/rateprofiles_it_test.go index 004f32aea..3c4199035 100644 --- a/apier/v1/rateprofiles_it_test.go +++ b/apier/v1/rateprofiles_it_test.go @@ -157,17 +157,25 @@ func testV1RatePrfVerifyRateProfile(t *testing.T) { t.Error(err) } rPrf := &engine.RateProfile{ - Tenant: "cgrates.org", - ID: "RP1", - FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, + Tenant: "cgrates.org", + ID: "RP1", + FilterIDs: []string{"*string:~*req.Subject:1001"}, + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, MinCost: utils.NewDecimal(1, 1), MaxCost: utils.NewDecimal(6, 1), MaxCostStrategy: "*free", Rates: map[string]*engine.Rate{ "RT_WEEK": { - ID: "RT_WEEK", - Weight: 0, + ID: "RT_WEEK", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * 1-5", IntervalRates: []*engine.IntervalRate{ { @@ -185,8 +193,12 @@ func testV1RatePrfVerifyRateProfile(t *testing.T) { }, }, "RT_WEEKEND": { - ID: "RT_WEEKEND", - Weight: 10, + ID: "RT_WEEKEND", + Weights: utils.DynamicWeights{ + { + Weight: 10, + }, + }, ActivationTimes: "* * * * 0,6", IntervalRates: []*engine.IntervalRate{ { @@ -198,8 +210,12 @@ func testV1RatePrfVerifyRateProfile(t *testing.T) { }, }, "RT_CHRISTMAS": { - ID: "RT_CHRISTMAS", - Weight: 30, + ID: "RT_CHRISTMAS", + Weights: utils.DynamicWeights{ + { + Weight: 30, + }, + }, ActivationTimes: "* * 24 12 *", IntervalRates: []*engine.IntervalRate{ { @@ -230,15 +246,23 @@ func testV1RatePrfRemoveRateProfile(t *testing.T) { func testV1RatePrfSetRateProfileRates(t *testing.T) { rPrf := &engine.RateProfile{ - Tenant: "cgrates.org", - ID: "RP1", - FilterIDs: []string{"*wrong:inline"}, - Weight: 0, + Tenant: "cgrates.org", + ID: "RP1", + FilterIDs: []string{"*wrong:inline"}, + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, MaxCostStrategy: "*free", Rates: map[string]*engine.Rate{ "RT_WEEK": { - ID: "RT_WEEK", - Weight: 0, + ID: "RT_WEEK", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * 1-5", IntervalRates: []*engine.IntervalRate{ { @@ -255,12 +279,12 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) { Tenant: "cgrates.org", ID: "RP1", FilterIDs: []string{"*wrong:inline"}, - Weight: 0, + Weights: ";0", MaxCostStrategy: "*free", Rates: map[string]*engine.APIRate{ "RT_WEEK": { ID: "RT_WEEK", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * 1-5", IntervalRates: []*engine.APIIntervalRate{ { @@ -296,7 +320,7 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) { Rates: map[string]*engine.APIRate{ "RT_WEEK": { ID: "RT_WEEK", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * 1-5", IntervalRates: []*engine.APIIntervalRate{ { @@ -309,7 +333,7 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) { }, "RT_WEEKEND": { ID: "RT_WEEKEND", - Weight: 10, + Weights: ";10", ActivationTimes: "* * * * 0,6", IntervalRates: []*engine.APIIntervalRate{ { @@ -319,7 +343,7 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) { }, "RT_CHRISTMAS": { ID: "RT_CHRISTMAS", - Weight: 30, + Weights: ";30", ActivationTimes: "* * 24 12 *", IntervalRates: []*engine.APIIntervalRate{ { @@ -355,13 +379,20 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) { Tenant: "cgrates.org", ID: "RP1", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, - + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, MaxCostStrategy: "*free", Rates: map[string]*engine.Rate{ "RT_WEEK": { - ID: "RT_WEEK", - Weight: 0, + ID: "RT_WEEK", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * 1-5", IntervalRates: []*engine.IntervalRate{ { @@ -373,8 +404,12 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) { }, }, "RT_WEEKEND": { - ID: "RT_WEEKEND", - Weight: 10, + ID: "RT_WEEKEND", + Weights: utils.DynamicWeights{ + { + Weight: 10, + }, + }, ActivationTimes: "* * * * 0,6", IntervalRates: []*engine.IntervalRate{ { @@ -383,8 +418,12 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) { }, }, "RT_CHRISTMAS": { - ID: "RT_CHRISTMAS", - Weight: 30, + ID: "RT_CHRISTMAS", + Weights: utils.DynamicWeights{ + { + Weight: 30, + }, + }, ActivationTimes: "* * 24 12 *", IntervalRates: []*engine.IntervalRate{ { @@ -406,16 +445,15 @@ func testV1RatePrfSetRateProfileRates(t *testing.T) { func testV1RatePrfRemoveRateProfileRates(t *testing.T) { apiRPrf := &engine.APIRateProfile{ - Tenant: "cgrates.org", - ID: "SpecialRate", - FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, - + Tenant: "cgrates.org", + ID: "SpecialRate", + FilterIDs: []string{"*string:~*req.Subject:1001"}, + Weights: ";0", MaxCostStrategy: "*free", Rates: map[string]*engine.APIRate{ "RT_WEEK": { ID: "RT_WEEK", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * 1-5", IntervalRates: []*engine.APIIntervalRate{ { @@ -428,7 +466,7 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) { }, "RT_WEEKEND": { ID: "RT_WEEKEND", - Weight: 10, + Weights: ";10", ActivationTimes: "* * * * 0,6", IntervalRates: []*engine.APIIntervalRate{ { @@ -438,7 +476,7 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) { }, "RT_CHRISTMAS": { ID: "RT_CHRISTMAS", - Weight: 30, + Weights: ";30", ActivationTimes: "* * 24 12 *", IntervalRates: []*engine.APIIntervalRate{ { @@ -474,13 +512,20 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) { Tenant: "cgrates.org", ID: "SpecialRate", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, - + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, MaxCostStrategy: "*free", Rates: map[string]*engine.Rate{ "RT_WEEK": { - ID: "RT_WEEK", - Weight: 0, + ID: "RT_WEEK", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * 1-5", IntervalRates: []*engine.IntervalRate{ { @@ -492,8 +537,12 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) { }, }, "RT_CHRISTMAS": { - ID: "RT_CHRISTMAS", - Weight: 30, + ID: "RT_CHRISTMAS", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * 24 12 *", IntervalRates: []*engine.IntervalRate{ { @@ -526,8 +575,11 @@ func testV1RatePrfRemoveRateProfileRates(t *testing.T) { Tenant: "cgrates.org", ID: "SpecialRate", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, - + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, MaxCostStrategy: "*free", Rates: map[string]*engine.Rate{}, } @@ -560,13 +612,20 @@ func testV1RateGetRemoveRateProfileWithoutTenant(t *testing.T) { rateProfile := &engine.RateProfile{ ID: "RPWithoutTenant", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, - + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, MaxCostStrategy: "*free", Rates: map[string]*engine.Rate{ "RT_WEEK": { - ID: "RT_WEEK", - Weight: 0, + ID: "RT_WEEK", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * 1-5", IntervalRates: []*engine.IntervalRate{ { @@ -584,12 +643,12 @@ func testV1RateGetRemoveRateProfileWithoutTenant(t *testing.T) { APIRateProfile: &engine.APIRateProfile{ ID: "RPWithoutTenant", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, + Weights: ";0", MaxCostStrategy: "*free", Rates: map[string]*engine.APIRate{ "RT_WEEK": { ID: "RT_WEEK", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * 1-5", IntervalRates: []*engine.APIIntervalRate{ { @@ -674,24 +733,40 @@ func testV1RatePrfGetRateProfileIDsCount(t *testing.T) { func testV1RatePrfGetRateProfileRatesWithoutTenant(t *testing.T) { rPrf := &engine.RateProfile{ - ID: "SpecialRate", - FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, + ID: "SpecialRate", + FilterIDs: []string{"*string:~*req.Subject:1001"}, + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, MaxCostStrategy: "*free", Rates: map[string]*engine.Rate{ "RT_WEEK": { - ID: "RT_WEEK", - Weight: 0, + ID: "RT_WEEK", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * 1-5", }, "RT_WEEKEND": { - ID: "RT_WEEKEND", - Weight: 10, + ID: "RT_WEEKEND", + Weights: utils.DynamicWeights{ + { + Weight: 10, + }, + }, ActivationTimes: "* * * * 0,6", }, "RT_CHRISTMAS": { - ID: "RT_CHRISTMAS", - Weight: 30, + ID: "RT_CHRISTMAS", + Weights: utils.DynamicWeights{ + { + Weight: 30, + }, + }, ActivationTimes: "* * 24 12 *", }, }, @@ -701,22 +776,22 @@ func testV1RatePrfGetRateProfileRatesWithoutTenant(t *testing.T) { APIRateProfile: &engine.APIRateProfile{ ID: "SpecialRate", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, + Weights: ";0", MaxCostStrategy: "*free", Rates: map[string]*engine.APIRate{ "RT_WEEK": { ID: "RT_WEEK", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * 1-5", }, "RT_WEEKEND": { ID: "RT_WEEKEND", - Weight: 10, + Weights: ";10", ActivationTimes: "* * * * 0,6", }, "RT_CHRISTMAS": { ID: "RT_CHRISTMAS", - Weight: 30, + Weights: ";30", ActivationTimes: "* * 24 12 *", }, }, @@ -766,8 +841,12 @@ func testV1RateCostForEventWithDefault(t *testing.T) { t.Error(err) } rate1 := &engine.Rate{ - ID: "RATE1", - Weight: 0, + ID: "RATE1", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * *", IntervalRates: []*engine.IntervalRate{ { @@ -789,11 +868,11 @@ func testV1RateCostForEventWithDefault(t *testing.T) { APIRateProfile: &engine.APIRateProfile{ ID: "DefaultRate", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 10, + Weights: ";0", Rates: map[string]*engine.APIRate{ "RATE1": &engine.APIRate{ ID: "RATE1", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * *", IntervalRates: []*engine.APIIntervalRate{ { @@ -877,8 +956,12 @@ func testV1RateCostForEventWithUsage(t *testing.T) { }, } rate1 := &engine.Rate{ - ID: "RATE1", - Weight: 0, + ID: "RATE1", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * *", IntervalRates: []*engine.IntervalRate{ { @@ -1003,8 +1086,12 @@ func testV1RateCostForEventWithStartTime(t *testing.T) { t.Error(err) } rate1 := &engine.Rate{ - ID: "RATE1", - Weight: 0, + ID: "RATE1", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * *", IntervalRates: []*engine.IntervalRate{ { @@ -1123,8 +1210,12 @@ func testV1RateCostForEventWithOpts(t *testing.T) { }, } rate1 := &engine.Rate{ - ID: "RATE1", - Weight: 0, + ID: "RATE1", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * *", IntervalRates: []*engine.IntervalRate{ { diff --git a/apier/v1/remote_it_test.go b/apier/v1/remote_it_test.go index 417da0292..ffe3ff9e4 100644 --- a/apier/v1/remote_it_test.go +++ b/apier/v1/remote_it_test.go @@ -682,25 +682,41 @@ func testInternalRemoteITGetRateProfile(t *testing.T) { } rPrf := &engine.RateProfile{ - Tenant: "cgrates.org", - ID: "RP1", - FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, + Tenant: "cgrates.org", + ID: "RP1", + FilterIDs: []string{"*string:~*req.Subject:1001"}, + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, MaxCostStrategy: "*free", Rates: map[string]*engine.Rate{ "RT_WEEK": { - ID: "RT_WEEK", - Weight: 0, + ID: "RT_WEEK", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * 1-5", }, "RT_WEEKEND": { - ID: "RT_WEEKEND", - Weight: 10, + ID: "RT_WEEKEND", + Weights: utils.DynamicWeights{ + { + Weight: 10, + }, + }, ActivationTimes: "* * * * 0,6", }, "RT_CHRISTMAS": { - ID: "RT_CHRISTMAS", - Weight: 30, + ID: "RT_CHRISTMAS", + Weights: utils.DynamicWeights{ + { + Weight: 30, + }, + }, ActivationTimes: "* * 24 12 *", }, }, @@ -711,22 +727,22 @@ func testInternalRemoteITGetRateProfile(t *testing.T) { Tenant: "cgrates.org", ID: "RP1", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, + Weights: ";0", MaxCostStrategy: "*free", Rates: map[string]*engine.APIRate{ "RT_WEEK": { ID: "RT_WEEK", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * 1-5", }, "RT_WEEKEND": { ID: "RT_WEEKEND", - Weight: 10, + Weights: ";10", ActivationTimes: "* * * * 0,6", }, "RT_CHRISTMAS": { ID: "RT_CHRISTMAS", - Weight: 30, + Weights: ";30", ActivationTimes: "* * 24 12 *", }, }, diff --git a/apier/v1/replicate_it_test.go b/apier/v1/replicate_it_test.go index df07c2a21..5b2033d14 100644 --- a/apier/v1/replicate_it_test.go +++ b/apier/v1/replicate_it_test.go @@ -1338,25 +1338,41 @@ func testInternalReplicateITThreshold(t *testing.T) { func testInternalReplicateITRateProfile(t *testing.T) { //set rPrf := &engine.RateProfile{ - Tenant: "cgrates.org", - ID: "RP1", - FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, + Tenant: "cgrates.org", + ID: "RP1", + FilterIDs: []string{"*string:~*req.Subject:1001"}, + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, MaxCostStrategy: "*free", Rates: map[string]*engine.Rate{ "RT_WEEK": { - ID: "RT_WEEK", - Weight: 0, + ID: "RT_WEEK", + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, ActivationTimes: "* * * * 1-5", }, "RT_WEEKEND": { - ID: "RT_WEEKEND", - Weight: 10, + ID: "RT_WEEKEND", + Weights: utils.DynamicWeights{ + { + Weight: 10, + }, + }, ActivationTimes: "* * * * 0,6", }, "RT_CHRISTMAS": { - ID: "RT_CHRISTMAS", - Weight: 30, + ID: "RT_CHRISTMAS", + Weights: utils.DynamicWeights{ + { + Weight: 30, + }, + }, ActivationTimes: "* * 24 12 *", }, }, @@ -1366,22 +1382,22 @@ func testInternalReplicateITRateProfile(t *testing.T) { Tenant: "cgrates.org", ID: "RP1", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, + Weights: ";0", MaxCostStrategy: "*free", Rates: map[string]*engine.APIRate{ "RT_WEEK": { ID: "RT_WEEK", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * 1-5", }, "RT_WEEKEND": { ID: "RT_WEEKEND", - Weight: 10, + Weights: ";10", ActivationTimes: "* * * * 0,6", }, "RT_CHRISTMAS": { ID: "RT_CHRISTMAS", - Weight: 30, + Weights: ";30", ActivationTimes: "* * 24 12 *", }, }, diff --git a/apier/v1/tprateprofiles_it_test.go b/apier/v1/tprateprofiles_it_test.go index f440bcf01..45f3a1a3e 100644 --- a/apier/v1/tprateprofiles_it_test.go +++ b/apier/v1/tprateprofiles_it_test.go @@ -121,15 +121,15 @@ func testTPRatePrfGetTPRatePrfBeforeSet(t *testing.T) { func testTPRatePrfSetTPRatePrf(t *testing.T) { tpRatePrf = &utils.TPRateProfile{ - TPid: "TP1", - Tenant: "cgrates.org", - ID: "RT_SPECIAL_1002", - Weight: 10, + TPid: "TP1", + Tenant: "cgrates.org", + ID: "RT_SPECIAL_1002", + Weights: ";10", Rates: map[string]*utils.TPRate{ "RT_ALWAYS": { ID: "RT_ALWAYS", FilterIDs: []string{"* * * * *"}, - Weight: 0, + Weights: ";0", Blocker: false, IntervalRates: []*utils.TPIntervalRate{ { @@ -178,7 +178,7 @@ func testTPRatePrfUpdateTPRatePrf(t *testing.T) { "RT_ALWAYS": { ID: "RT_ALWAYS", FilterIDs: []string{"* * * * *"}, - Weight: 0, + Weights: ";0", Blocker: false, IntervalRates: []*utils.TPIntervalRate{ { @@ -201,10 +201,10 @@ func testTPRatePrfUpdateTPRatePrf(t *testing.T) { func testTPRatePrfGetTPRatePrfAfterUpdate(t *testing.T) { var reply *utils.TPRateProfile revTPRatePrf := &utils.TPRateProfile{ - TPid: "TP1", - Tenant: "cgrates.org", - ID: "RT_SPECIAL_1002", - Weight: 10, + TPid: "TP1", + Tenant: "cgrates.org", + ID: "RT_SPECIAL_1002", + Weights: ";10", } if err := tpRatePrfRPC.Call(utils.APIerSv1GetTPRateProfile, diff --git a/dispatchers/rates_it_test.go b/dispatchers/rates_it_test.go index 4f6e617c8..600e2abf0 100644 --- a/dispatchers/rates_it_test.go +++ b/dispatchers/rates_it_test.go @@ -87,11 +87,11 @@ func testDspRPrfCostForEvent(t *testing.T) { ID: "DefaultRate", Tenant: "cgrates.org", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 10, + Weights: ";10", Rates: map[string]*engine.APIRate{ "RT_WEEK": { ID: "RT_WEEK", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * *", IntervalRates: []*engine.APIIntervalRate{ { @@ -157,13 +157,13 @@ func testDspRPrfCostForEvent(t *testing.T) { func testDspRPrfCostForEventWithoutFilters(t *testing.T) { rPrf := &engine.APIRateProfile{ - ID: "ID_RP", - Tenant: "cgrates.org", - Weight: 10, + ID: "ID_RP", + Tenant: "cgrates.org", + Weights: ";10", Rates: map[string]*engine.APIRate{ "RT_WEEK": { ID: "RT_WEEK", - Weight: 0, + Weights: ";0", ActivationTimes: "* * * * *", IntervalRates: []*engine.APIIntervalRate{ { diff --git a/dispatchers/replicator_it_test.go b/dispatchers/replicator_it_test.go index a6e1baf08..761d929c4 100644 --- a/dispatchers/replicator_it_test.go +++ b/dispatchers/replicator_it_test.go @@ -1472,23 +1472,35 @@ func testDspRplRateProfile(t *testing.T) { var replyStr string rPrf := &engine.RateProfileWithOpts{ RateProfile: &engine.RateProfile{ - Tenant: "cgrates.org", - ID: "RP1", - FilterIDs: []string{"*string:~*req.Subject:1001", "*string:~*req.Subject:1002"}, - Weight: 0, + Tenant: "cgrates.org", + ID: "RP1", + FilterIDs: []string{"*string:~*req.Subject:1001", "*string:~*req.Subject:1002"}, + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, MaxCostStrategy: "*free", Rates: map[string]*engine.Rate{ "FIRST_GI": { ID: "FIRST_GI", FilterIDs: []string{"*gi:~*req.Usage:0"}, - Weight: 0, - Blocker: false, + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, + Blocker: false, }, "SECOND_GI": { ID: "SECOND_GI", FilterIDs: []string{"*gi:~*req.Usage:1m"}, - Weight: 10, - Blocker: false, + Weights: utils.DynamicWeights{ + { + Weight: 10, + }, + }, + Blocker: false, }, }, }, diff --git a/migrator/rateprofiles_it_test.go b/migrator/rateprofiles_it_test.go index 2731f7e82..aa22315a5 100644 --- a/migrator/rateprofiles_it_test.go +++ b/migrator/rateprofiles_it_test.go @@ -186,10 +186,14 @@ func testRatePrfITMigrateAndMove(t *testing.T) { t.Error(err) } rPrf := &engine.RateProfile{ - Tenant: "cgrates.org", - ID: "RP1", - FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, + Tenant: "cgrates.org", + ID: "RP1", + FilterIDs: []string{"*string:~*req.Subject:1001"}, + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, MinCost: utils.NewDecimal(1, 1), MaxCost: utils.NewDecimal(6, 1), MaxCostStrategy: "*free", @@ -197,8 +201,11 @@ func testRatePrfITMigrateAndMove(t *testing.T) { "FIRST_GI": { ID: "FIRST_GI", FilterIDs: []string{"*gi:~*req.Usage:0"}, - Weight: 0, - + Weights: utils.DynamicWeights{ + { + Weight: 0, + }, + }, IntervalRates: []*engine.IntervalRate{ { RecurrentFee: utils.NewDecimal(12, 2), @@ -211,7 +218,11 @@ func testRatePrfITMigrateAndMove(t *testing.T) { "SECOND_GI": { ID: "SECOND_GI", FilterIDs: []string{"*gi:~*req.Usage:1m"}, - Weight: 10, + Weights: utils.DynamicWeights{ + { + Weight: 10, + }, + }, IntervalRates: []*engine.IntervalRate{ { RecurrentFee: utils.NewDecimal(6, 2), diff --git a/migrator/tp_rate_profiles_it_test.go b/migrator/tp_rate_profiles_it_test.go index 4cf9853e4..b7f75cf22 100644 --- a/migrator/tp_rate_profiles_it_test.go +++ b/migrator/tp_rate_profiles_it_test.go @@ -108,7 +108,7 @@ func testTPRateProfilePopulate(t *testing.T) { Tenant: "cgrates.org", ID: "RP1", FilterIDs: []string{"*string:~*req.Subject:1001"}, - Weight: 0, + Weights: ";0", MinCost: 0.1, MaxCost: 0.6, MaxCostStrategy: "*free", @@ -116,7 +116,7 @@ func testTPRateProfilePopulate(t *testing.T) { "FIRST_GI": { ID: "FIRST_GI", FilterIDs: []string{"*gi:~*req.Usage:0"}, - Weight: 0, + Weights: ";0", IntervalRates: []*utils.TPIntervalRate{ { RecurrentFee: 0.12, @@ -129,7 +129,7 @@ func testTPRateProfilePopulate(t *testing.T) { "SECOND_GI": { ID: "SECOND_GI", FilterIDs: []string{"*gi:~*req.Usage:1m"}, - Weight: 10, + Weights: ";10", IntervalRates: []*utils.TPIntervalRate{ { RecurrentFee: 0.06,