Updated Weight fields name in integration tests

This commit is contained in:
porosnicuadrian
2021-02-16 12:01:09 +02:00
committed by Dan Christian Bogos
parent 812db77bd6
commit 2831111cf8
11 changed files with 297 additions and 147 deletions

View File

@@ -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{
{

View File

@@ -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,

View File

@@ -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 *",
},
},

View File

@@ -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{
{

View File

@@ -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 *",
},
},

View File

@@ -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 *",
},
},

View File

@@ -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,

View File

@@ -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{
{

View File

@@ -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,
},
},
},

View File

@@ -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),

View File

@@ -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,