moved derived charger with passing tests

This commit is contained in:
Radu Ioan Fericean
2015-06-12 21:19:37 +03:00
parent b02843d324
commit 6ed59dafe9
19 changed files with 73 additions and 50 deletions

View File

@@ -19,10 +19,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
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)
}
/*

View File

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

View File

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

View File

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

View File

@@ -19,11 +19,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
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}
}
/*

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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