mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-21 23:28:44 +05:00
Merge fixes
This commit is contained in:
@@ -253,14 +253,15 @@ func testV1FIdxComputeThresholdsIndexes(t *testing.T) {
|
||||
tenant := "cgrates.org"
|
||||
var reply2 string
|
||||
emptySlice := []string{}
|
||||
if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes, utils.ArgsComputeFilterIndexes{
|
||||
Tenant: tenant,
|
||||
ThresholdIDs: nil,
|
||||
AttributeIDs: &emptySlice,
|
||||
ResourceIDs: &emptySlice,
|
||||
StatIDs: &emptySlice,
|
||||
SupplierIDs: &emptySlice,
|
||||
}, &reply2); err != nil {
|
||||
if err := tFIdxRpc.Call(utils.ApierV1ComputeFilterIndexes,
|
||||
utils.ArgsComputeFilterIndexes{
|
||||
Tenant: tenant,
|
||||
ThresholdIDs: nil,
|
||||
AttributeIDs: &emptySlice,
|
||||
ResourceIDs: &emptySlice,
|
||||
StatIDs: &emptySlice,
|
||||
SupplierIDs: &emptySlice,
|
||||
}, &reply2); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
if reply2 != utils.OK {
|
||||
|
||||
@@ -755,45 +755,34 @@ func testITTestStoreFilterIndexesWithTransID2(t *testing.T) {
|
||||
"RL2": true,
|
||||
},
|
||||
}
|
||||
transID := "transaction1"
|
||||
if err := dataManager.SetFilterIndexes(
|
||||
utils.PrefixToIndexCache[utils.ResourceProfilesPrefix], "cgrates.org",
|
||||
idxes, false, "transaction1"); err != nil {
|
||||
idxes, false, transID); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
/* #FixMe: add transactionID to GetFilterIndexes so we can check the content of temporary key
|
||||
if rcv, err := dataManager.GetFilterIndexes(
|
||||
utils.TEMP_DESTINATION_PREFIX+utils.PrefixToIndexCache[utils.ResourceProfilesPrefix],
|
||||
utils.ConcatenatedKey("cgrates.org", transID),
|
||||
MetaString, nil); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(idxes, rcv) {
|
||||
t.Errorf("Expecting: %+v, received: %+v", idxes, rcv)
|
||||
}
|
||||
*/
|
||||
//commit transaction
|
||||
if err := dataManager.SetFilterIndexes(
|
||||
utils.PrefixToIndexCache[utils.ResourceProfilesPrefix], "cgrates.org",
|
||||
idxes, true, "transaction1"); err != nil {
|
||||
idxes, true, transID); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
idxes = map[string]utils.StringMap{
|
||||
"*string:Account:1001": utils.StringMap{
|
||||
"RL1": true,
|
||||
},
|
||||
"*string:Account:1002": utils.StringMap{
|
||||
"RL1": true,
|
||||
"RL2": true,
|
||||
},
|
||||
"*string:Account:dan": utils.StringMap{
|
||||
"RL2": true,
|
||||
},
|
||||
"*string:Subject:dan": utils.StringMap{
|
||||
"RL2": true,
|
||||
"RL3": true,
|
||||
},
|
||||
utils.ConcatenatedKey(utils.MetaDefault,
|
||||
utils.ANY, utils.ANY): utils.StringMap{
|
||||
"RL4": true,
|
||||
"RL5": true,
|
||||
},
|
||||
"*string:Event:Event1": utils.StringMap{
|
||||
"RL1": true,
|
||||
},
|
||||
"*string:Event:Event2": utils.StringMap{
|
||||
"RL1": true,
|
||||
"RL2": true,
|
||||
},
|
||||
//verify if old key was deleted
|
||||
if _, err := dataManager.GetFilterIndexes(
|
||||
"tmp_"+utils.PrefixToIndexCache[utils.ResourceProfilesPrefix],
|
||||
utils.ConcatenatedKey("cgrates.org", transID),
|
||||
MetaString, nil); err != utils.ErrNotFound {
|
||||
t.Error(err)
|
||||
}
|
||||
//verify new key and check if data was moved
|
||||
if rcv, err := dataManager.GetFilterIndexes(
|
||||
|
||||
@@ -255,6 +255,7 @@ func (rs Resources) allocateResource(ru *ResourceUsage, dryRun bool) (alcMessage
|
||||
r.removeExpiredUnits()
|
||||
if _, hasID := r.Usages[ru.ID]; hasID { // update
|
||||
r.clearUsage(ru.ID)
|
||||
}
|
||||
if r.rPrf == nil {
|
||||
return "", fmt.Errorf("empty configuration for resourceID: %s", r.TenantID())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user