diff --git a/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json b/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json index 92ca09e4c..94b0a24e2 100644 --- a/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json +++ b/data/tutorials/kamevapi/cgrates/etc/cgrates/cgrates.json @@ -79,7 +79,7 @@ {"address": "127.0.0.1:2012", "transport": "*json"}, ], "debit_interval": "5s", - "channel_sync_interval":"7s", + "channel_sync_interval":"5m", }, @@ -134,4 +134,4 @@ }, -} \ No newline at end of file +} diff --git a/engine/rateinterval.go b/engine/rateinterval.go index c84a586c8..49d85fc02 100644 --- a/engine/rateinterval.go +++ b/engine/rateinterval.go @@ -294,7 +294,7 @@ func (pg RateGroups) Equals(oRG RateGroups) bool { return false } for i := range pg { - if !pg[0].Equal(oRG[i]) { + if !pg[i].Equal(oRG[i]) { return false } } diff --git a/engine/rateinterval_test.go b/engine/rateinterval_test.go index 072b5f97c..7aa8def3f 100644 --- a/engine/rateinterval_test.go +++ b/engine/rateinterval_test.go @@ -383,6 +383,68 @@ func TestRateIntervalCost(t *testing.T) { } } +func TestRateGroupsEquals(t *testing.T) { + rg1 := RateGroups{ + &Rate{ + GroupIntervalStart: time.Duration(0), + Value: 0.1, + RateIncrement: time.Minute, + RateUnit: 60 * time.Second, + }, + &Rate{ + GroupIntervalStart: time.Duration(60 * time.Second), + Value: 0.05, + RateIncrement: time.Second, + RateUnit: time.Second, + }, + } + rg2 := RateGroups{ + &Rate{ + GroupIntervalStart: time.Duration(0), + Value: 0.1, + RateIncrement: time.Minute, + RateUnit: 60 * time.Second, + }, + &Rate{ + GroupIntervalStart: time.Duration(60 * time.Second), + Value: 0.05, + RateIncrement: time.Second, + RateUnit: time.Second, + }, + } + if !rg1.Equals(rg2) { + t.Error("not equal") + } + rg2 = RateGroups{ + &Rate{ + GroupIntervalStart: time.Duration(0), + Value: 0.1, + RateIncrement: time.Minute, + RateUnit: 60 * time.Second, + }, + &Rate{ + GroupIntervalStart: time.Duration(60 * time.Second), + Value: 0.3, + RateIncrement: time.Second, + RateUnit: time.Second, + }, + } + if rg1.Equals(rg2) { + t.Error("equals") + } + rg2 = RateGroups{ + &Rate{ + GroupIntervalStart: time.Duration(0), + Value: 0.1, + RateIncrement: time.Minute, + RateUnit: 60 * time.Second, + }, + } + if rg1.Equals(rg2) { + t.Error("equals") + } +} + /*********************************Benchmarks**************************************/ func BenchmarkRateIntervalContainsDate(b *testing.B) {