From 6ed59dafe91bdf933d21257566cf3d1379edb028 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Fri, 12 Jun 2015 21:19:37 +0300 Subject: [PATCH] moved derived charger with passing tests --- apier/v1/accounts_test.go | 5 +++-- apier/v1/aliases.go | 8 ++++---- apier/v1/apier.go | 28 ++++++++++++++-------------- apier/v1/derivedcharging.go | 10 +++++----- apier/v1/derivedcharging_test.go | 7 ++++--- apier/v2/apier.go | 6 +++--- cmd/cgr-engine/cgr-engine.go | 4 ++-- cmd/cgr-tester/cgr-tester.go | 2 +- engine/calldesc_test.go | 4 +++- engine/loader_local_test.go | 19 +++++++++++++++++++ engine/responder_test.go | 6 +++--- engine/storage_redis_local_test.go | 2 +- general_tests/acntacts_test.go | 4 ++-- general_tests/costs1_test.go | 2 +- general_tests/datachrg1_test.go | 2 +- general_tests/ddazmbl1_test.go | 4 ++-- general_tests/ddazmbl2_test.go | 4 ++-- general_tests/ddazmbl3_test.go | 4 ++-- general_tests/smschrg1_test.go | 2 +- 19 files changed, 73 insertions(+), 50 deletions(-) diff --git a/apier/v1/accounts_test.go b/apier/v1/accounts_test.go index b08bf26ba..964c7b8b3 100644 --- a/apier/v1/accounts_test.go +++ b/apier/v1/accounts_test.go @@ -19,10 +19,11 @@ along with this program. If not, see package v1 import ( + "testing" + "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" - "testing" ) var ( @@ -56,7 +57,7 @@ func TestSetAccounts(t *testing.T) { } } noReload := []string{} - apierAcntsAcntStorage.CacheAccounting(nil, noReload, noReload, noReload) + apierAcntsAcntStorage.CacheAccounting(nil, noReload, noReload) } /* diff --git a/apier/v1/aliases.go b/apier/v1/aliases.go index f38b4b165..0ff869316 100644 --- a/apier/v1/aliases.go +++ b/apier/v1/aliases.go @@ -49,7 +49,7 @@ func (self *ApierV1) AddRatingSubjectAliases(attrs AttrAddRatingSubjectAliases, aliasesChanged = append(aliasesChanged, engine.RP_ALIAS_PREFIX+utils.RatingSubjectAliasKey(attrs.Tenant, alias)) } didNotChange := []string{} - if err := self.RatingDb.CacheRating(didNotChange, didNotChange, didNotChange, aliasesChanged, didNotChange); err != nil { + if err := self.RatingDb.CacheRating(didNotChange, didNotChange, didNotChange, aliasesChanged, didNotChange, didNotChange); err != nil { return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error()) } *reply = utils.OK @@ -80,7 +80,7 @@ func (self *ApierV1) RemRatingSubjectAliases(tenantRatingSubject engine.TenantRa return fmt.Errorf("%s:% s", utils.ERR_SERVER_ERROR, err.Error()) } didNotChange := []string{} - if err := self.RatingDb.CacheRating(didNotChange, didNotChange, didNotChange, nil, didNotChange); err != nil { + if err := self.RatingDb.CacheRating(didNotChange, didNotChange, didNotChange, nil, didNotChange, didNotChange); err != nil { return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error()) } *reply = utils.OK @@ -99,7 +99,7 @@ func (self *ApierV1) AddAccountAliases(attrs AttrAddAccountAliases, reply *strin aliasesChanged = append(aliasesChanged, engine.ACC_ALIAS_PREFIX+utils.AccountAliasKey(attrs.Tenant, alias)) } didNotChange := []string{} - if err := self.AccountDb.CacheAccounting(didNotChange, didNotChange, aliasesChanged, didNotChange); err != nil { + if err := self.AccountDb.CacheAccounting(didNotChange, didNotChange, aliasesChanged); err != nil { return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error()) } *reply = utils.OK @@ -130,7 +130,7 @@ func (self *ApierV1) RemAccountAliases(tenantAccount engine.TenantAccount, reply return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error()) } didNotChange := []string{} - if err := self.AccountDb.CacheAccounting(didNotChange, didNotChange, nil, didNotChange); err != nil { + if err := self.AccountDb.CacheAccounting(didNotChange, didNotChange, nil); err != nil { return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error()) } *reply = utils.OK diff --git a/apier/v1/apier.go b/apier/v1/apier.go index b785f6224..2c105f9a2 100644 --- a/apier/v1/apier.go +++ b/apier/v1/apier.go @@ -201,7 +201,7 @@ func (self *ApierV1) LoadDestination(attrs AttrLoadDestination, reply *string) e if len(attrs.DestinationId) == 0 { destIds = nil // Cache all destinations, temporary here until we add ApierV2.LoadDestinations } - if err := self.RatingDb.CacheRating(destIds, didNotChange, didNotChange, didNotChange, didNotChange); err != nil { + if err := self.RatingDb.CacheRating(destIds, didNotChange, didNotChange, didNotChange, didNotChange, didNotChange); err != nil { return err } *reply = OK @@ -224,7 +224,7 @@ func (self *ApierV1) LoadDerivedChargers(attrs utils.TPDerivedChargers, reply *s if len(attrs.Direction) != 0 && len(attrs.Tenant) != 0 && len(attrs.Category) != 0 && len(attrs.Account) != 0 && len(attrs.Subject) != 0 { derivedChargingKeys = []string{engine.DERIVEDCHARGERS_PREFIX + attrs.GetDerivedChargersKey()} } - if err := self.AccountDb.CacheAccounting(didNotChange, didNotChange, didNotChange, derivedChargingKeys); err != nil { + if err := self.RatingDb.CacheRating(didNotChange, didNotChange, didNotChange, didNotChange, didNotChange, derivedChargingKeys); err != nil { return err } *reply = OK @@ -253,7 +253,7 @@ func (self *ApierV1) LoadRatingPlan(attrs AttrLoadRatingPlan, reply *string) err if len(attrs.TPid) != 0 { changedRPlKeys = []string{engine.RATING_PLAN_PREFIX + attrs.RatingPlanId} } - if err := self.RatingDb.CacheRating(nil, changedRPlKeys, didNotChange, didNotChange, didNotChange); err != nil { + if err := self.RatingDb.CacheRating(nil, changedRPlKeys, didNotChange, didNotChange, didNotChange, didNotChange); err != nil { return err } *reply = OK @@ -276,7 +276,7 @@ func (self *ApierV1) LoadRatingProfile(attrs utils.TPRatingProfile, reply *strin if attrs.KeyId() != ":::" { // if has some filters ratingProfile = []string{engine.RATING_PROFILE_PREFIX + attrs.KeyId()} } - if err := self.RatingDb.CacheRating(didNotChange, didNotChange, ratingProfile, didNotChange, didNotChange); err != nil { + if err := self.RatingDb.CacheRating(didNotChange, didNotChange, ratingProfile, didNotChange, didNotChange, didNotChange); err != nil { return err } *reply = OK @@ -303,7 +303,7 @@ func (self *ApierV1) LoadSharedGroup(attrs AttrLoadSharedGroup, reply *string) e if len(attrs.SharedGroupId) != 0 { changedSharedGroup = []string{engine.SHARED_GROUP_PREFIX + attrs.SharedGroupId} } - if err := self.AccountDb.CacheAccounting(didNotChange, changedSharedGroup, didNotChange, didNotChange); err != nil { + if err := self.AccountDb.CacheAccounting(didNotChange, changedSharedGroup, didNotChange); err != nil { return err } *reply = OK @@ -404,10 +404,10 @@ func (self *ApierV1) LoadTariffPlanFromStorDb(attrs AttrLoadTpFromStorDb, reply dcsKeys[idx] = engine.DERIVEDCHARGERS_PREFIX + dc } engine.Logger.Info("ApierV1.LoadTariffPlanFromStorDb, reloading cache.") - if err := self.RatingDb.CacheRating(dstKeys, rpKeys, rpfKeys, rpAlsKeys, lcrKeys); err != nil { + if err := self.RatingDb.CacheRating(dstKeys, rpKeys, rpfKeys, rpAlsKeys, lcrKeys, dcsKeys); err != nil { return err } - if err := self.AccountDb.CacheAccounting(actKeys, shgKeys, accAlsKeys, dcsKeys); err != nil { + if err := self.AccountDb.CacheAccounting(actKeys, shgKeys, accAlsKeys); err != nil { return err } aps, _ := dbReader.GetLoadedIds(engine.ACTION_TIMING_PREFIX) @@ -510,7 +510,7 @@ func (self *ApierV1) SetRatingProfile(attrs AttrSetRatingProfile, reply *string) } //Automatic cache of the newly inserted rating profile didNotChange := []string{} - if err := self.RatingDb.CacheRating(didNotChange, didNotChange, []string{engine.RATING_PROFILE_PREFIX + keyId}, didNotChange, didNotChange); err != nil { + if err := self.RatingDb.CacheRating(didNotChange, didNotChange, []string{engine.RATING_PROFILE_PREFIX + keyId}, didNotChange, didNotChange, didNotChange); err != nil { return err } *reply = OK @@ -563,7 +563,7 @@ func (self *ApierV1) SetActions(attrs utils.AttrSetActions, reply *string) error return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error()) } didNotChange := []string{} - self.AccountDb.CacheAccounting(nil, didNotChange, didNotChange, didNotChange) + self.AccountDb.CacheAccounting(nil, didNotChange, didNotChange) *reply = OK return nil } @@ -819,7 +819,7 @@ func (self *ApierV1) LoadAccountActions(attrs utils.TPAccountActions, reply *str } // ToDo: Get the action keys loaded by dbReader so we reload only these in cache // Need to do it before scheduler otherwise actions to run will be unknown - if err := self.AccountDb.CacheAccounting(nil, nil, nil, []string{}); err != nil { + if err := self.AccountDb.CacheAccounting(nil, nil, nil); err != nil { return err } if self.Sched != nil { @@ -898,10 +898,10 @@ func (self *ApierV1) ReloadCache(attrs utils.ApiReloadCache, reply *string) erro dcsKeys[idx] = engine.DERIVEDCHARGERS_PREFIX + dc } } - if err := self.RatingDb.CacheRating(dstKeys, rpKeys, rpfKeys, rpAlsKeys, lcrKeys); err != nil { + if err := self.RatingDb.CacheRating(dstKeys, rpKeys, rpfKeys, rpAlsKeys, lcrKeys, dcsKeys); err != nil { return err } - if err := self.AccountDb.CacheAccounting(actKeys, shgKeys, accAlsKeys, dcsKeys); err != nil { + if err := self.AccountDb.CacheAccounting(actKeys, shgKeys, accAlsKeys); err != nil { return err } *reply = "OK" @@ -1054,10 +1054,10 @@ func (self *ApierV1) LoadTariffPlanFromFolder(attrs utils.AttrLoadTpFromFolder, } aps, _ := loader.GetLoadedIds(engine.ACTION_TIMING_PREFIX) engine.Logger.Info("ApierV1.LoadTariffPlanFromFolder, reloading cache.") - if err := self.RatingDb.CacheRating(dstKeys, rpKeys, rpfKeys, rpAlsKeys, lcrKeys); err != nil { + if err := self.RatingDb.CacheRating(dstKeys, rpKeys, rpfKeys, rpAlsKeys, lcrKeys, dcsKeys); err != nil { return err } - if err := self.AccountDb.CacheAccounting(actKeys, shgKeys, accAlsKeys, dcsKeys); err != nil { + if err := self.AccountDb.CacheAccounting(actKeys, shgKeys, accAlsKeys); err != nil { return err } if len(aps) != 0 && self.Sched != nil { diff --git a/apier/v1/derivedcharging.go b/apier/v1/derivedcharging.go index 438ee4cbe..41425346c 100644 --- a/apier/v1/derivedcharging.go +++ b/apier/v1/derivedcharging.go @@ -30,7 +30,7 @@ func (self *ApierV1) GetDerivedChargers(attrs utils.AttrDerivedChargers, reply * if missing := utils.MissingStructFields(&attrs, []string{"Tenant", "Direction", "Account", "Subject"}); len(missing) != 0 { return fmt.Errorf("%s:%v", utils.ERR_MANDATORY_IE_MISSING, missing) } - if hDc, err := engine.HandleGetDerivedChargers(self.AccountDb, &attrs); err != nil { + if hDc, err := engine.HandleGetDerivedChargers(self.RatingDb, &attrs); err != nil { return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error()) } else if hDc != nil { *reply = hDc @@ -65,10 +65,10 @@ func (self *ApierV1) SetDerivedChargers(attrs AttrSetDerivedChargers, reply *str } } dcKey := utils.DerivedChargersKey(attrs.Direction, attrs.Tenant, attrs.Category, attrs.Account, attrs.Subject) - if err := self.AccountDb.SetDerivedChargers(dcKey, attrs.DerivedChargers); err != nil { + if err := self.RatingDb.SetDerivedChargers(dcKey, attrs.DerivedChargers); err != nil { return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error()) } - if err := self.AccountDb.CacheAccounting([]string{}, []string{}, []string{}, []string{engine.DERIVEDCHARGERS_PREFIX + dcKey}); err != nil { + if err := self.RatingDb.CacheRating([]string{}, []string{}, []string{}, []string{}, []string{}, []string{engine.DERIVEDCHARGERS_PREFIX + dcKey}); err != nil { return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error()) } *reply = utils.OK @@ -95,12 +95,12 @@ func (self *ApierV1) RemDerivedChargers(attrs AttrRemDerivedChargers, reply *str if len(attrs.Subject) == 0 { attrs.Subject = utils.ANY } - if err := self.AccountDb.SetDerivedChargers(utils.DerivedChargersKey(attrs.Direction, attrs.Tenant, attrs.Category, attrs.Account, attrs.Subject), nil); err != nil { + if err := self.RatingDb.SetDerivedChargers(utils.DerivedChargersKey(attrs.Direction, attrs.Tenant, attrs.Category, attrs.Account, attrs.Subject), nil); err != nil { return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error()) } else { *reply = "OK" } - if err := self.AccountDb.CacheAccounting([]string{}, []string{}, []string{}, nil); err != nil { + if err := self.RatingDb.CacheRating([]string{}, []string{}, []string{}, []string{}, []string{}, nil); err != nil { return fmt.Errorf("%s:%s", utils.ERR_SERVER_ERROR, err.Error()) } return nil diff --git a/apier/v1/derivedcharging_test.go b/apier/v1/derivedcharging_test.go index 518690436..ccbfb5f41 100644 --- a/apier/v1/derivedcharging_test.go +++ b/apier/v1/derivedcharging_test.go @@ -19,11 +19,12 @@ along with this program. If not, see package v1 import ( + "reflect" + "testing" + "github.com/cgrates/cgrates/config" "github.com/cgrates/cgrates/engine" "github.com/cgrates/cgrates/utils" - "reflect" - "testing" ) var apierDcT *ApierV1 @@ -31,7 +32,7 @@ var apierDcT *ApierV1 func init() { dataStorage, _ := engine.NewMapStorage() cfg, _ := config.NewDefaultCGRConfig() - apierDcT = &ApierV1{AccountDb: engine.AccountingStorage(dataStorage), Config: cfg} + apierDcT = &ApierV1{RatingDb: engine.RatingStorage(dataStorage), Config: cfg} } /* diff --git a/apier/v2/apier.go b/apier/v2/apier.go index f1fec78e3..a23400a0c 100644 --- a/apier/v2/apier.go +++ b/apier/v2/apier.go @@ -53,7 +53,7 @@ func (self *ApierV2) LoadRatingProfile(attrs AttrLoadRatingProfile, reply *strin if tpRpf.KeyId() != ":::" { // if has some filters ratingProfile = []string{engine.RATING_PROFILE_PREFIX + tpRpf.KeyId()} } - if err := self.RatingDb.CacheRating(didNotChange, didNotChange, ratingProfile, didNotChange, didNotChange); err != nil { + if err := self.RatingDb.CacheRating(didNotChange, didNotChange, ratingProfile, didNotChange, didNotChange, didNotChange); err != nil { return err } *reply = v1.OK @@ -84,7 +84,7 @@ func (self *ApierV2) LoadAccountActions(attrs AttrLoadAccountActions, reply *str } // ToDo: Get the action keys loaded by dbReader so we reload only these in cache // Need to do it before scheduler otherwise actions to run will be unknown - if err := self.AccountDb.CacheAccounting(nil, nil, nil, []string{}); err != nil { + if err := self.AccountDb.CacheAccounting(nil, nil, nil); err != nil { return err } if self.Sched != nil { @@ -118,7 +118,7 @@ func (self *ApierV2) LoadDerivedChargers(attrs AttrLoadDerivedChargers, reply *s if len(attrs.DerivedChargersId) != 0 { dcsChanged = []string{engine.DERIVEDCHARGERS_PREFIX + attrs.DerivedChargersId} } - if err := self.AccountDb.CacheAccounting(didNotChange, didNotChange, didNotChange, dcsChanged); err != nil { + if err := self.RatingDb.CacheRating(didNotChange, didNotChange, didNotChange, didNotChange, didNotChange, dcsChanged); err != nil { return err } *reply = v1.OK diff --git a/cmd/cgr-engine/cgr-engine.go b/cmd/cgr-engine/cgr-engine.go index e9b53c341..143b090cb 100644 --- a/cmd/cgr-engine/cgr-engine.go +++ b/cmd/cgr-engine/cgr-engine.go @@ -75,12 +75,12 @@ var ( ) func cacheData(ratingDb engine.RatingStorage, accountDb engine.AccountingStorage, doneChan chan struct{}) { - if err := ratingDb.CacheRating(nil, nil, nil, nil, nil); err != nil { + if err := ratingDb.CacheRating(nil, nil, nil, nil, nil, nil); err != nil { engine.Logger.Crit(fmt.Sprintf("Cache rating error: %s", err.Error())) exitChan <- true return } - if err := accountDb.CacheAccounting(nil, nil, nil, nil); err != nil { + if err := accountDb.CacheAccounting(nil, nil, nil); err != nil { engine.Logger.Crit(fmt.Sprintf("Cache accounting error: %s", err.Error())) exitChan <- true return diff --git a/cmd/cgr-tester/cgr-tester.go b/cmd/cgr-tester/cgr-tester.go index 870b4a126..5786f5e48 100644 --- a/cmd/cgr-tester/cgr-tester.go +++ b/cmd/cgr-tester/cgr-tester.go @@ -75,7 +75,7 @@ func durInternalRater(cd *engine.CallDescriptor) (time.Duration, error) { } defer accountDb.Close() engine.SetAccountingStorage(accountDb) - if err := ratingDb.CacheRating(nil, nil, nil, nil, nil); err != nil { + if err := ratingDb.CacheRating(nil, nil, nil, nil, nil, nil); err != nil { return nilDuration, fmt.Errorf("Cache rating error: %s", err.Error()) } log.Printf("Runnning %d cycles...", *runs) diff --git a/engine/calldesc_test.go b/engine/calldesc_test.go index 362692c87..e880b796b 100644 --- a/engine/calldesc_test.go +++ b/engine/calldesc_test.go @@ -34,6 +34,8 @@ var ( func init() { historyScribe, _ = history.NewMockScribe() + ratingStorage.Flush("") + accountingStorage.Flush("") populateDB() } @@ -900,7 +902,7 @@ func TestDebitFromEmptyShare(t *testing.T) { acc, _ := cd.getAccount() balanceMap := acc.BalanceMap[utils.MONETARY+OUTBOUND] if len(balanceMap) != 2 || balanceMap[0].Value != 0 || balanceMap[1].Value != -2.5 { - t.Errorf("Error debiting from empty share: %+v", balanceMap) + t.Errorf("Error debiting from empty share: %+v", balanceMap[1].Value) } } diff --git a/engine/loader_local_test.go b/engine/loader_local_test.go index 11c6ba22b..ad463e620 100644 --- a/engine/loader_local_test.go +++ b/engine/loader_local_test.go @@ -276,6 +276,25 @@ func TestLoadIndividualProfiles(t *testing.T) { } } } + // Load derived chargers + loadId = utils.CSV_LOAD + "_" + TEST_SQL + if derivedChargers, err := storDb.GetTpDerivedChargers(&TpDerivedCharger{Tpid: TEST_SQL, Loadid: loadId}); err != nil { + t.Fatal("Could not retrieve derived chargers, error: ", err.Error()) + } else if len(derivedChargers) == 0 { + t.Fatal("Could not retrieve derived chargers") + } else { + dcs, err := TpDerivedChargers(derivedChargers).GetDerivedChargers() + if err != nil { + t.Fatal("Could not convert derived chargers") + } + for dcId := range dcs { + mdc := &TpDerivedCharger{Tpid: TEST_SQL, Loadid: loadId} + mdc.SetDerivedChargersId(dcId) + if err := loader.LoadDerivedChargersFiltered(mdc, true); err != nil { + t.Fatalf("Could not load derived charger with id: %s, error: %s", dcId, err.Error()) + } + } + } // Load account actions if accountActions, err := storDb.GetTpAccountActions(&TpAccountAction{Tpid: TEST_SQL, Loadid: loadId}); err != nil { t.Fatal("Could not retrieve account action profiles, error: ", err.Error()) diff --git a/engine/responder_test.go b/engine/responder_test.go index d0919ac7e..acada26c3 100644 --- a/engine/responder_test.go +++ b/engine/responder_test.go @@ -44,7 +44,7 @@ func TestResponderGetDerivedChargers(t *testing.T) { if err := ratingStorage.SetDerivedChargers(utils.DerivedChargersKey(utils.OUT, utils.ANY, utils.ANY, utils.ANY, utils.ANY), cfgedDC); err != nil { t.Error(err) } - if err := accountingStorage.CacheAccounting(nil, []string{}, []string{}); err != nil { + if err := ratingStorage.CacheRating([]string{}, []string{}, []string{}, []string{}, []string{}, nil); err != nil { t.Error(err) } var dcs utils.DerivedChargers @@ -149,7 +149,7 @@ func TestGetSessionRuns(t *testing.T) { if err := ratingStorage.SetDerivedChargers(keyCharger1, charger1); err != nil { t.Error("Error on setting DerivedChargers", err.Error()) } - accountingStorage.CacheAccounting(nil, nil, nil) + ratingStorage.CacheRating(nil, nil, nil, nil, nil, nil) sesRuns := make([]*SessionRun, 0) eSRuns := []*SessionRun{ &SessionRun{DerivedCharger: extra1DC, @@ -392,7 +392,7 @@ func TestGetLCR(t *testing.T) { } else if !reflect.DeepEqual(eStLcr.Entry, lcr.Entry) { t.Errorf("Expecting: %+v, received: %+v", eStLcr.Entry, lcr.Entry) } else if !reflect.DeepEqual(eStLcr.SupplierCosts, lcr.SupplierCosts) { - t.Errorf("Expecting: %+v, received: %+v", eStLcr.SupplierCosts[2], lcr.SupplierCosts[2]) + t.Errorf("Expecting: %+v, received: %+v", eStLcr.SupplierCosts[0], lcr.SupplierCosts[0]) } // Test *least_cost strategy here cdLowestCost := &CallDescriptor{ diff --git a/engine/storage_redis_local_test.go b/engine/storage_redis_local_test.go index 9c93b7841..bc9f15518 100644 --- a/engine/storage_redis_local_test.go +++ b/engine/storage_redis_local_test.go @@ -48,7 +48,7 @@ func TestFlush(t *testing.T) { if err := rds.Flush(""); err != nil { t.Error("Failed to Flush redis database", err.Error()) } - rds.CacheAccounting(nil, nil, nil) + rds.CacheRating(nil, nil, nil, nil, nil, nil) } func TestSetGetDerivedCharges(t *testing.T) { diff --git a/general_tests/acntacts_test.go b/general_tests/acntacts_test.go index 841cb6204..2de93d70b 100644 --- a/general_tests/acntacts_test.go +++ b/general_tests/acntacts_test.go @@ -58,8 +58,8 @@ ENABLE_ACNT,*enable_account,,,,,,,,,,,,,10` t.Fatal(err) } csvr.WriteToDatabase(false, false) - ratingDbAcntActs.CacheRating(nil, nil, nil, nil, nil) - acntDbAcntActs.CacheAccounting(nil, nil, nil, nil) + ratingDbAcntActs.CacheRating(nil, nil, nil, nil, nil, nil) + acntDbAcntActs.CacheAccounting(nil, nil, nil) expectAcnt := &engine.Account{Id: "*out:cgrates.org:1"} if acnt, err := acntDbAcntActs.GetAccount("*out:cgrates.org:1"); err != nil { t.Error(err) diff --git a/general_tests/costs1_test.go b/general_tests/costs1_test.go index fb9bcb6df..0f1b300c9 100644 --- a/general_tests/costs1_test.go +++ b/general_tests/costs1_test.go @@ -75,7 +75,7 @@ RP_SMS1,DR_SMS_1,ALWAYS,10` t.Fatal(err) } csvr.WriteToDatabase(false, false) - ratingDb.CacheRating(nil, nil, nil, nil, nil) + ratingDb.CacheRating(nil, nil, nil, nil, nil, nil) if cachedRPlans := cache2go.CountEntries(engine.RATING_PLAN_PREFIX); cachedRPlans != 3 { t.Error("Wrong number of cached rating plans found", cachedRPlans) diff --git a/general_tests/datachrg1_test.go b/general_tests/datachrg1_test.go index 14e6e7cd8..d397751e5 100644 --- a/general_tests/datachrg1_test.go +++ b/general_tests/datachrg1_test.go @@ -62,7 +62,7 @@ RP_DATA1,DR_DATA_2,TM2,10` t.Fatal(err) } csvr.WriteToDatabase(false, false) - ratingDb.CacheRating(nil, nil, nil, nil, nil) + ratingDb.CacheRating(nil, nil, nil, nil, nil, nil) if cachedRPlans := cache2go.CountEntries(engine.RATING_PLAN_PREFIX); cachedRPlans != 1 { t.Error("Wrong number of cached rating plans found", cachedRPlans) diff --git a/general_tests/ddazmbl1_test.go b/general_tests/ddazmbl1_test.go index 957ce6090..18c5f52ac 100644 --- a/general_tests/ddazmbl1_test.go +++ b/general_tests/ddazmbl1_test.go @@ -109,8 +109,8 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10` t.Error("No account saved") } - ratingDb.CacheRating(nil, nil, nil, nil, nil) - acntDb.CacheAccounting(nil, nil, nil, nil) + ratingDb.CacheRating(nil, nil, nil, nil, nil, nil) + acntDb.CacheAccounting(nil, nil, nil) if cachedDests := cache2go.CountEntries(engine.DESTINATION_PREFIX); cachedDests != 2 { t.Error("Wrong number of cached destinations found", cachedDests) diff --git a/general_tests/ddazmbl2_test.go b/general_tests/ddazmbl2_test.go index 708d4fbea..f7c28b934 100644 --- a/general_tests/ddazmbl2_test.go +++ b/general_tests/ddazmbl2_test.go @@ -108,8 +108,8 @@ TOPUP10_AT,TOPUP10_AC1,ASAP,10` } else if acnt == nil { t.Error("No account saved") } - ratingDb2.CacheRating(nil, nil, nil, nil, nil) - acntDb2.CacheAccounting(nil, nil, nil, nil) + ratingDb2.CacheRating(nil, nil, nil, nil, nil, nil) + acntDb2.CacheAccounting(nil, nil, nil) if cachedDests := cache2go.CountEntries(engine.DESTINATION_PREFIX); cachedDests != 2 { t.Error("Wrong number of cached destinations found", cachedDests) } diff --git a/general_tests/ddazmbl3_test.go b/general_tests/ddazmbl3_test.go index ac384fd37..bafd3a45f 100644 --- a/general_tests/ddazmbl3_test.go +++ b/general_tests/ddazmbl3_test.go @@ -106,8 +106,8 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10` } else if acnt == nil { t.Error("No account saved") } - ratingDb3.CacheRating(nil, nil, nil, nil, nil) - acntDb3.CacheAccounting(nil, nil, nil, nil) + ratingDb3.CacheRating(nil, nil, nil, nil, nil, nil) + acntDb3.CacheAccounting(nil, nil, nil) if cachedDests := cache2go.CountEntries(engine.DESTINATION_PREFIX); cachedDests != 2 { t.Error("Wrong number of cached destinations found", cachedDests) } diff --git a/general_tests/smschrg1_test.go b/general_tests/smschrg1_test.go index 7b7829bda..8612d5fb5 100644 --- a/general_tests/smschrg1_test.go +++ b/general_tests/smschrg1_test.go @@ -58,7 +58,7 @@ func TestSMSLoadCsvTpSmsChrg1(t *testing.T) { t.Fatal(err) } csvr.WriteToDatabase(false, false) - ratingDb.CacheRating(nil, nil, nil, nil, nil) + ratingDb.CacheRating(nil, nil, nil, nil, nil, nil) if cachedRPlans := cache2go.CountEntries(engine.RATING_PLAN_PREFIX); cachedRPlans != 1 { t.Error("Wrong number of cached rating plans found", cachedRPlans)