mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Fixed the missing values on cache constants
This commit is contained in:
committed by
Dan Christian Bogos
parent
b6bcdae579
commit
69d696ee49
@@ -337,8 +337,8 @@ func (adms *AdminSv1) ComputeFilterIndexes(cntxt *context.Context, args *utils.A
|
||||
return nil, e
|
||||
}
|
||||
fltrIDs := make([]string, len(acnts.FilterIDs))
|
||||
for i, fltr := range acnts.FilterIDs {
|
||||
fltrIDs[i] = fltr
|
||||
for i, fltr := range acnts.FilterIDs {
|
||||
fltrIDs[i] = fltr
|
||||
}
|
||||
return &fltrIDs, nil
|
||||
}, nil); err != nil && err != utils.ErrNotFound {
|
||||
@@ -610,12 +610,12 @@ func (adms *AdminSv1) ComputeFilterIndexIDs(cntxt *context.Context, args *utils.
|
||||
for i, fltr := range acc.FilterIDs {
|
||||
fltrIDs[i] = fltr
|
||||
}
|
||||
return &fltrIDs, nil
|
||||
return &fltrIDs, nil
|
||||
}, nil); err != nil && err != utils.ErrNotFound {
|
||||
return utils.APIErrorHandler(err)
|
||||
}
|
||||
if indexes.Size() != 0 {
|
||||
cacheIDs[utils.CacheAccountsFilterIndexes] = indexes.AsSlice()
|
||||
cacheIDs[utils.AccountsFilterIndexIDs] = indexes.AsSlice()
|
||||
}
|
||||
//ActionProfile Indexes
|
||||
if indexes, err = engine.ComputeIndexes(cntxt, adms.dm, tnt, utils.EmptyString, utils.CacheActionProfilesFilterIndexes,
|
||||
|
||||
@@ -310,8 +310,8 @@ func testV1FIdxSetAttributeSMoreFltrsMoreIndexing(t *testing.T) {
|
||||
// update our Attribute with our filters
|
||||
attrPrf := &engine.APIAttributeProfileWithAPIOpts{
|
||||
APIAttributeProfile: &engine.APIAttributeProfile{
|
||||
Tenant: utils.CGRateSorg,
|
||||
ID: "TEST_ATTRIBUTES_IT_TEST",
|
||||
Tenant: utils.CGRateSorg,
|
||||
ID: "TEST_ATTRIBUTES_IT_TEST",
|
||||
FilterIDs: []string{"fltr_for_attr", "fltr_for_attr2",
|
||||
"fltr_for_attr3", "*string:~*opts.*context:*sessions"},
|
||||
Attributes: []*engine.ExternalAttribute{
|
||||
@@ -644,16 +644,16 @@ func testV1FIdxSetAccountWithFltr(t *testing.T) {
|
||||
//we will set an Account with our filter and check the indexes
|
||||
accPrf := &APIAccountWithAPIOpts{
|
||||
APIAccount: &utils.APIAccount{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ACCOUNT_FILTER_INDEXES",
|
||||
Weights: ";0",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ACCOUNT_FILTER_INDEXES",
|
||||
Weights: ";0",
|
||||
FilterIDs: []string{"fltr_for_attr", "*string:~*opts.*context:*sessions"},
|
||||
Balances: map[string]*utils.APIBalance{
|
||||
"AbstractBalance1": {
|
||||
ID: "AbstractBalance1",
|
||||
ID: "AbstractBalance1",
|
||||
Weights: ";15",
|
||||
Type: utils.MetaAbstract,
|
||||
Units: float64(40*time.Second),
|
||||
Type: utils.MetaAbstract,
|
||||
Units: float64(40 * time.Second),
|
||||
CostIncrements: []*utils.APICostIncrement{
|
||||
{
|
||||
Increment: utils.Float64Pointer(float64(time.Second)),
|
||||
@@ -770,17 +770,17 @@ func testVF1FIdxSetAccountMoreFltrsMoreIndexing(t *testing.T) {
|
||||
// update our Account with our filters
|
||||
accPrf := &APIAccountWithAPIOpts{
|
||||
APIAccount: &utils.APIAccount{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ACCOUNT_FILTER_INDEXES",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ACCOUNT_FILTER_INDEXES",
|
||||
Weights: ";0",
|
||||
FilterIDs: []string{"fltr_for_attr", "fltr_for_attr2",
|
||||
"fltr_for_attr3", "*string:~*opts.*context:*sessions"},
|
||||
Balances: map[string]*utils.APIBalance{
|
||||
"AbstractBalance1": {
|
||||
ID: "AbstractBalance1",
|
||||
ID: "AbstractBalance1",
|
||||
Weights: ";15",
|
||||
Type: utils.MetaAbstract,
|
||||
Units: float64(40*time.Second),
|
||||
Type: utils.MetaAbstract,
|
||||
Units: float64(40 * time.Second),
|
||||
CostIncrements: []*utils.APICostIncrement{
|
||||
{
|
||||
Increment: utils.Float64Pointer(float64(time.Second)),
|
||||
@@ -882,32 +882,32 @@ func testV1FIdxAccountsMoreProfilesForFilters(t *testing.T) {
|
||||
// more accounts with our filters
|
||||
accPrf2 := &APIAccountWithAPIOpts{
|
||||
APIAccount: &utils.APIAccount{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ACCOUNT_FILTER_INDEXES2",
|
||||
Weights: ";0",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ACCOUNT_FILTER_INDEXES2",
|
||||
Weights: ";0",
|
||||
FilterIDs: []string{"fltr_for_attr2", "fltr_for_attr3"},
|
||||
Balances: map[string]*utils.APIBalance{
|
||||
"ConcreteBalance1": {
|
||||
ID: "ConcreteBalance1",
|
||||
ID: "ConcreteBalance1",
|
||||
Weights: ";15",
|
||||
Type: utils.MetaConcrete,
|
||||
Units: float64(40*time.Second),
|
||||
Type: utils.MetaConcrete,
|
||||
Units: float64(40 * time.Second),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
accPrf3 := &APIAccountWithAPIOpts{
|
||||
APIAccount: &utils.APIAccount{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ACCOUNT_FILTER_INDEXES3",
|
||||
Weights: ";0",
|
||||
Tenant: "cgrates.org",
|
||||
ID: "ACCOUNT_FILTER_INDEXES3",
|
||||
Weights: ";0",
|
||||
FilterIDs: []string{"fltr_for_attr", "*string:~*opts.*context:*sessions"},
|
||||
Balances: map[string]*utils.APIBalance{
|
||||
"ConcreteBalance1": {
|
||||
ID: "ConcreteBalance1",
|
||||
ID: "ConcreteBalance1",
|
||||
Weights: ";15",
|
||||
Type: utils.MetaConcrete,
|
||||
Units: float64(40*time.Second),
|
||||
Type: utils.MetaConcrete,
|
||||
Units: float64(40 * time.Second),
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -929,7 +929,7 @@ func testV1FIdxAccountsMoreProfilesForFilters(t *testing.T) {
|
||||
var replyIdx []string
|
||||
expectedIDx := []string{"*string:*opts.*context:*sessions:ACCOUNT_FILTER_INDEXES",
|
||||
"*string:*opts.*context:*sessions:ACCOUNT_FILTER_INDEXES3",
|
||||
"*prefix:*req.AnswerTime:12:ACCOUNT_FILTER_INDEXES2",
|
||||
"*prefix:*req.AnswerTime:12:ACCOUNT_FILTER_INDEXES2",
|
||||
"*prefix:*req.AnswerTime:33:ACCOUNT_FILTER_INDEXES2",
|
||||
"*prefix:*req.AnswerTime:12:ACCOUNT_FILTER_INDEXES",
|
||||
"*prefix:*req.AnswerTime:33:ACCOUNT_FILTER_INDEXES",
|
||||
@@ -980,7 +980,7 @@ func testV1FIdxAccountSRemoveComputedIndexesIDs(t *testing.T) {
|
||||
if err := tFIdxRpc.Call(context.Background(), utils.AdminSv1ComputeFilterIndexIDs,
|
||||
&utils.ArgsComputeFilterIndexIDs{Tenant: utils.CGRateSorg,
|
||||
AccountIDs: []string{"ACCOUNT_FILTER_INDEXES", "ACCOUNT_FILTER_INDEXES2"}},
|
||||
&reply); err != nil {
|
||||
&reply); err != nil {
|
||||
t.Error(err)
|
||||
} else if reply != utils.OK {
|
||||
t.Error("Unexpected reply returned")
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
"db_port": 27017,
|
||||
},
|
||||
|
||||
|
||||
"stor_db": {
|
||||
"db_type": "mongo",
|
||||
"db_name": "cgrates",
|
||||
|
||||
@@ -55,8 +55,8 @@ var (
|
||||
utils.ChargerProfilePrefix: {},
|
||||
utils.DispatcherProfilePrefix: {},
|
||||
utils.DispatcherHostPrefix: {},
|
||||
utils.AccountFilterIndexPrfx: {},
|
||||
utils.AccountPrefix: {},
|
||||
utils.AccountFilterIndexPrfx: {},
|
||||
utils.AccountPrefix: {},
|
||||
utils.RateProfilePrefix: {},
|
||||
utils.ActionProfilePrefix: {},
|
||||
utils.AttributeFilterIndexes: {},
|
||||
|
||||
@@ -73,7 +73,7 @@ func TestChargersmatchingChargerProfilesForEventErrPass(t *testing.T) {
|
||||
}
|
||||
|
||||
experr := utils.ErrNotImplemented
|
||||
rcv, err := cS.matchingChargerProfilesForEvent(context.Background(), cgrEv.Tenant, cgrEv)
|
||||
rcv, err := cS.matchingChargerProfilesForEvent(context.Background(), cgrEv.Tenant, cgrEv)
|
||||
|
||||
if err == nil || err != experr {
|
||||
t.Errorf("\nexpected: <%+v>, \nreceived: <%+v>", experr, err)
|
||||
|
||||
@@ -124,6 +124,7 @@ var (
|
||||
CacheRateProfiles: CacheRateProfilesFilterIndexes,
|
||||
CacheActionProfiles: CacheActionProfilesFilterIndexes,
|
||||
CacheFilters: CacheReverseFilterIndexes,
|
||||
CacheAccounts: CacheAccountsFilterIndexes,
|
||||
// CacheRates: CacheRateFilterIndexes,
|
||||
}
|
||||
|
||||
@@ -162,6 +163,7 @@ var (
|
||||
DispatcherHostIDs: DispatcherHostPrefix,
|
||||
RateProfileIDs: RateProfilePrefix,
|
||||
ActionProfileIDs: ActionProfilePrefix,
|
||||
AccountIDs: AccountPrefix,
|
||||
|
||||
AttributeFilterIndexIDs: AttributeFilterIndexes,
|
||||
ResourceFilterIndexIDs: ResourceFilterIndexes,
|
||||
@@ -193,6 +195,7 @@ var (
|
||||
DispatcherHostIDs: CacheDispatcherHosts,
|
||||
RateProfileIDs: CacheRateProfiles,
|
||||
ActionProfileIDs: CacheActionProfiles,
|
||||
AccountIDs: CacheAccounts,
|
||||
|
||||
AttributeFilterIndexIDs: CacheAttributeFilterIndexes,
|
||||
ResourceFilterIndexIDs: CacheResourceFilterIndexes,
|
||||
|
||||
Reference in New Issue
Block a user