diff --git a/engine/ratingplan.go b/engine/ratingplan.go index c0606e347..2ec961205 100644 --- a/engine/ratingplan.go +++ b/engine/ratingplan.go @@ -160,6 +160,9 @@ func (rp *RatingPlan) areRatesSane() bool { if math.Mod(nextRate.GroupIntervalStart.Seconds(), rate.RateIncrement.Seconds()) != 0 { return false } + if rate.RateUnit == 0 || rate.RateIncrement == 0 { + return false + } } } } diff --git a/engine/ratingplan_test.go b/engine/ratingplan_test.go index 6286a1c52..21ec37a98 100644 --- a/engine/ratingplan_test.go +++ b/engine/ratingplan_test.go @@ -380,10 +380,12 @@ func TestRatingPlanSaneRatingsGoot(t *testing.T) { &Rate{ GroupIntervalStart: 60 * time.Second, RateIncrement: 30 * time.Second, + RateUnit: 1 * time.Second, }, &Rate{ GroupIntervalStart: 0 * time.Second, RateIncrement: 30 * time.Second, + RateUnit: 1 * time.Second, }, }, },