From 583e9dbd67e7992df92dd7ef0f68f9a7bbb24864 Mon Sep 17 00:00:00 2001 From: porosnicuadrian Date: Mon, 12 Oct 2020 16:31:59 +0300 Subject: [PATCH] Updated methods and tests for attributes.go with default tenant value --- apier/v1/attributes.go | 13 ++- apier/v1/attributes_it_test.go | 160 +++++++++++++++++++++++---------- engine/attributes.go | 32 ++++--- engine/z_attributes_test.go | 32 +++---- 4 files changed, 159 insertions(+), 78 deletions(-) diff --git a/apier/v1/attributes.go b/apier/v1/attributes.go index 2f04b6584..da5060c17 100644 --- a/apier/v1/attributes.go +++ b/apier/v1/attributes.go @@ -27,11 +27,15 @@ import ( // GetAttributeProfile returns an Attribute Profile func (apierSv1 *APIerSv1) GetAttributeProfile(arg *utils.TenantIDWithOpts, reply *engine.AttributeProfile) (err error) { - if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing + if missing := utils.MissingStructFields(arg, []string{utils.ID}); len(missing) != 0 { //Params missing return utils.NewErrMandatoryIeMissing(missing...) } + tnt := arg.Tenant + if tnt == utils.EmptyString { + tnt = apierSv1.Config.GeneralCfg().DefaultTenant + } var alsPrf *engine.AttributeProfile - if alsPrf, err = apierSv1.DataManager.GetAttributeProfile(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil { + if alsPrf, err = apierSv1.DataManager.GetAttributeProfile(tnt, arg.ID, true, true, utils.NonTransactional); err != nil { if err.Error() != utils.ErrNotFound.Error() { err = utils.NewErrServerError(err) } @@ -91,9 +95,12 @@ type AttributeWithCache struct { //SetAttributeProfile add/update a new Attribute Profile func (apierSv1 *APIerSv1) SetAttributeProfile(alsWrp *AttributeWithCache, reply *string) error { - if missing := utils.MissingStructFields(alsWrp.AttributeProfile, []string{utils.Tenant, utils.ID, utils.Attributes}); len(missing) != 0 { + if missing := utils.MissingStructFields(alsWrp.AttributeProfile, []string{utils.ID, utils.Attributes}); len(missing) != 0 { return utils.NewErrMandatoryIeMissing(missing...) } + if alsWrp.Tenant == utils.EmptyString { + alsWrp.Tenant = apierSv1.Config.GeneralCfg().DefaultTenant + } for _, attr := range alsWrp.Attributes { if attr.Path == utils.EmptyString { return utils.NewErrMandatoryIeMissing("Path") diff --git a/apier/v1/attributes_it_test.go b/apier/v1/attributes_it_test.go index 7bf257e42..ec29f638b 100644 --- a/apier/v1/attributes_it_test.go +++ b/apier/v1/attributes_it_test.go @@ -73,6 +73,8 @@ var ( testAttributeSProcessWithMultipleRuns2, testAttributeSGetAttributeProfileIDsCount, testAttributeSSetAttributeWithEmptyPath, + testAttributeSSetAlsPrfWithoutTenant, + testAttributeSRmvAlsPrfWithoutTenant, testAttributeSKillEngine, //start test for cache options testAttributeSInitCfg, @@ -184,43 +186,51 @@ func testAttributeSGetAttributeForEvent(t *testing.T) { }, } - eAttrPrf := &AttributeWithCache{ - AttributeProfile: &engine.AttributeProfile{ - Tenant: ev.Tenant, - ID: "ATTR_1", - FilterIDs: []string{"*string:~*req.Account:1007"}, - Contexts: []string{utils.MetaSessionS, utils.MetaCDRs}, - ActivationInterval: &utils.ActivationInterval{ - ActivationTime: time.Date(2014, 1, 14, 0, 0, 0, 0, time.UTC)}, - Attributes: []*engine.Attribute{ - { - Path: utils.MetaReq + utils.NestingSep + utils.Account, - Value: config.NewRSRParsersMustCompile("1001", utils.INFIELD_SEP), - }, - { - Path: utils.MetaReq + utils.NestingSep + utils.Subject, - Value: config.NewRSRParsersMustCompile("1001", utils.INFIELD_SEP), - }, + eAttrPrf := &engine.AttributeProfile{ + Tenant: ev.Tenant, + ID: "ATTR_1", + FilterIDs: []string{"*string:~*req.Account:1007"}, + Contexts: []string{utils.MetaCDRs, utils.MetaSessionS}, + ActivationInterval: &utils.ActivationInterval{ + ActivationTime: time.Date(2014, 1, 14, 0, 0, 0, 0, time.UTC)}, + Attributes: []*engine.Attribute{ + { + Path: utils.MetaReq + utils.NestingSep + utils.Account, + Value: config.NewRSRParsersMustCompile("1001", utils.INFIELD_SEP), + Type: utils.META_CONSTANT, + FilterIDs: []string{}, + }, + { + Path: utils.MetaReq + utils.NestingSep + utils.Subject, + Value: config.NewRSRParsersMustCompile("1001", utils.INFIELD_SEP), + Type: utils.META_CONSTANT, + FilterIDs: []string{}, }, - Weight: 10.0, }, + Weight: 10.0, } eAttrPrf.Compile() var attrReply *engine.AttributeProfile if err := attrSRPC.Call(utils.AttributeSv1GetAttributeForEvent, ev, &attrReply); err != nil { - t.Error(err) - } - if attrReply == nil { - t.Errorf("Expecting attrReply to not be nil") - // attrReply shoud not be nil so exit function - // to avoid nil segmentation fault; - // if this happens try to run this test manualy - return + t.Fatal(err) } attrReply.Compile() // Populate private variables in RSRParsers - if !reflect.DeepEqual(eAttrPrf.Attributes[0].Value[0], attrReply.Attributes[0].Value[0]) { - t.Errorf("Expecting: %+v, received: %+v", eAttrPrf.Attributes[0].Value[0], attrReply.Attributes[0].Value[0]) + sort.Strings(attrReply.Contexts) + if !reflect.DeepEqual(eAttrPrf, attrReply) { + t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(eAttrPrf), utils.ToJSON(attrReply)) + } + + ev.Tenant = utils.EmptyString + ev.ID = "randomID" + if err := attrSRPC.Call(utils.AttributeSv1GetAttributeForEvent, + ev, &attrReply); err != nil { + t.Fatal(err) + } + attrReply.Compile() // Populate private variables in RSRParsers + sort.Strings(attrReply.Contexts) + if !reflect.DeepEqual(eAttrPrf, attrReply) { + t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(eAttrPrf), utils.ToJSON(attrReply)) } } @@ -352,8 +362,8 @@ func testAttributeSProcessEvent(t *testing.T) { } eRply := &engine.AttrSProcessEventReply{ MatchedProfiles: []string{"ATTR_1"}, - AlteredFields: []string{utils.MetaReq + utils.NestingSep + utils.Subject, - utils.MetaReq + utils.NestingSep + utils.Account}, + AlteredFields: []string{utils.MetaReq + utils.NestingSep + utils.Account, + utils.MetaReq + utils.NestingSep + utils.Subject}, CGREventWithOpts: &utils.CGREventWithOpts{ CGREvent: &utils.CGREvent{ Tenant: "cgrates.org", @@ -366,28 +376,22 @@ func testAttributeSProcessEvent(t *testing.T) { }, }, } - eRply2 := &engine.AttrSProcessEventReply{ - MatchedProfiles: []string{"ATTR_1"}, - AlteredFields: []string{utils.MetaReq + utils.NestingSep + utils.Account, - utils.MetaReq + utils.NestingSep + utils.Subject}, - CGREventWithOpts: &utils.CGREventWithOpts{ - CGREvent: &utils.CGREvent{ - Tenant: "cgrates.org", - ID: "testAttributeSProcessEvent", - Event: map[string]interface{}{ - utils.Account: "1001", - utils.Subject: "1001", - "Destination": "+491511231234", - }, - }, - }, - } var rplyEv engine.AttrSProcessEventReply if err := attrSRPC.Call(utils.AttributeSv1ProcessEvent, ev, &rplyEv); err != nil { t.Error(err) - } else if !reflect.DeepEqual(eRply, &rplyEv) && - !reflect.DeepEqual(eRply2, &rplyEv) { // second for reversed order of attributes + } else if sort.Strings(eRply.AlteredFields); !reflect.DeepEqual(eRply, &rplyEv) { // second for reversed order of attributes + t.Errorf("Expecting: %s, received: %s", + utils.ToJSON(eRply), utils.ToJSON(rplyEv)) + } + + ev.Tenant = "" + ev.ID = "randomID" + eRply.ID = "randomID" + if err := attrSRPC.Call(utils.AttributeSv1ProcessEvent, + ev, &rplyEv); err != nil { + t.Error(err) + } else if sort.Strings(eRply.AlteredFields); !reflect.DeepEqual(eRply, &rplyEv) { // second for reversed order of attributes t.Errorf("Expecting: %s, received: %s", utils.ToJSON(eRply), utils.ToJSON(rplyEv)) } @@ -1291,6 +1295,12 @@ func testAttributeSProcessWithMultipleRuns2(t *testing.T) { func testAttributeSGetAttributeProfileIDsCount(t *testing.T) { var reply int + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDsCount, + &utils.TenantWithOpts{}, &reply); err != nil { + t.Error(err) + } else if reply != 7 { + t.Errorf("Expecting: 7, received: %+v", reply) + } if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfileIDsCount, &utils.TenantWithOpts{Tenant: "cgrates.org"}, &reply); err != nil { t.Error(err) @@ -1865,3 +1875,57 @@ func testAttributeSCacheOpts(t *testing.T) { t.Error("Unexpected reply returned", result) } } + +func testAttributeSSetAlsPrfWithoutTenant(t *testing.T) { + var reply string + alsPrf = &AttributeWithCache{ + AttributeProfile: &engine.AttributeProfile{ + ID: "ApierTest1", + Contexts: []string{utils.MetaSessionS, utils.MetaCDRs}, + FilterIDs: []string{"FLTR_ACNT_dan", "FLTR_DST_DE"}, + ActivationInterval: &utils.ActivationInterval{ + ActivationTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC), + ExpiryTime: time.Date(2014, 7, 14, 14, 35, 0, 0, time.UTC), + }, + Attributes: []*engine.Attribute{ + { + Path: utils.MetaReq + utils.NestingSep + "FL1", + Value: config.NewRSRParsersMustCompile("Al1", utils.INFIELD_SEP), + }, + }, + Weight: 20, + }, + } + alsPrf.Compile() + if err := attrSRPC.Call(utils.APIerSv1SetAttributeProfile, alsPrf, &reply); err != nil { + t.Error(err) + } else if reply != utils.OK { + t.Error("Unexpected reply returned", reply) + } + alsPrf.AttributeProfile.Tenant = "cgrates.org" + var result *engine.AttributeProfile + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, + utils.TenantIDWithOpts{TenantID: &utils.TenantID{ID: "ApierTest1"}}, + &result); err != nil { + t.Error(err) + } else if result.Compile(); !reflect.DeepEqual(alsPrf.AttributeProfile, result) { + t.Errorf("Expected %+v, received %+v", utils.ToJSON(alsPrf.AttributeProfile), utils.ToJSON(result)) + } +} + +func testAttributeSRmvAlsPrfWithoutTenant(t *testing.T) { + var reply string + if err := attrSRPC.Call(utils.APIerSv1RemoveAttributeProfile, + &utils.TenantIDWithCache{ID: "ApierTest1"}, + &reply); err != nil { + t.Error(err) + } else if reply != utils.OK { + t.Error("Unexpected reply returned", reply) + } + var result *engine.AttributeProfile + if err := attrSRPC.Call(utils.APIerSv1GetAttributeProfile, + &utils.TenantIDWithOpts{TenantID: &utils.TenantID{ID: "ApierTest1"}}, + &result); err == nil || err.Error() != utils.ErrNotFound.Error() { + t.Error(err) + } +} diff --git a/engine/attributes.go b/engine/attributes.go index 35399c8e1..58a46a6e6 100644 --- a/engine/attributes.go +++ b/engine/attributes.go @@ -61,14 +61,14 @@ func (alS *AttributeService) Shutdown() (err error) { return } -// matchingAttributeProfilesForEvent returns ordered list of matching resources which are active by the time of the call -func (alS *AttributeService) attributeProfileForEvent(args *AttrArgsProcessEvent, evNm utils.MapStorage, lastID string) (matchAttrPrfl *AttributeProfile, err error) { +// attributeProfileForEvent returns the matching attribute +func (alS *AttributeService) attributeProfileForEvent(tnt string, args *AttrArgsProcessEvent, evNm utils.MapStorage, lastID string) (matchAttrPrfl *AttributeProfile, err error) { var attrIDs []string contextVal := utils.MetaDefault if args.Context != nil && *args.Context != "" { contextVal = *args.Context } - attrIdxKey := utils.ConcatenatedKey(args.Tenant, contextVal) + attrIdxKey := utils.ConcatenatedKey(tnt, contextVal) if len(args.AttributeIDs) != 0 { attrIDs = args.AttributeIDs } else { @@ -89,7 +89,7 @@ func (alS *AttributeService) attributeProfileForEvent(args *AttrArgsProcessEvent alS.cgrcfg.AttributeSCfg().PrefixIndexedFields, alS.cgrcfg.AttributeSCfg().SuffixIndexedFields, alS.dm, utils.CacheAttributeFilterIndexes, - utils.ConcatenatedKey(args.Tenant, utils.META_ANY), + utils.ConcatenatedKey(tnt, utils.META_ANY), alS.cgrcfg.AttributeSCfg().IndexedSelects, alS.cgrcfg.AttributeSCfg().NestedFields); err != nil { return nil, err @@ -98,7 +98,7 @@ func (alS *AttributeService) attributeProfileForEvent(args *AttrArgsProcessEvent attrIDs = aPrflIDs.AsSlice() } for _, apID := range attrIDs { - aPrfl, err := alS.dm.GetAttributeProfile(args.Tenant, apID, true, true, utils.NonTransactional) + aPrfl, err := alS.dm.GetAttributeProfile(tnt, apID, true, true, utils.NonTransactional) if err != nil { if err == utils.ErrNotFound { continue @@ -113,7 +113,7 @@ func (alS *AttributeService) attributeProfileForEvent(args *AttrArgsProcessEvent !aPrfl.ActivationInterval.IsActiveAtTime(*args.Time) { // not active continue } - if pass, err := alS.filterS.Pass(args.Tenant, aPrfl.FilterIDs, + if pass, err := alS.filterS.Pass(tnt, aPrfl.FilterIDs, evNm); err != nil { return nil, err } else if !pass { @@ -205,10 +205,10 @@ func (attr *AttrArgsProcessEvent) Clone() *AttrArgsProcessEvent { } // processEvent will match event with attribute profile and do the necessary replacements -func (alS *AttributeService) processEvent(args *AttrArgsProcessEvent, evNm utils.MapStorage, dynDP utils.DataProvider, lastID string) ( +func (alS *AttributeService) processEvent(tnt string, args *AttrArgsProcessEvent, evNm utils.MapStorage, dynDP utils.DataProvider, lastID string) ( rply *AttrSProcessEventReply, err error) { var attrPrf *AttributeProfile - if attrPrf, err = alS.attributeProfileForEvent(args, evNm, lastID); err != nil { + if attrPrf, err = alS.attributeProfileForEvent(tnt, args, evNm, lastID); err != nil { return } rply = &AttrSProcessEventReply{ @@ -219,11 +219,12 @@ func (alS *AttributeService) processEvent(args *AttrArgsProcessEvent, evNm utils }, blocker: attrPrf.Blocker, } + rply.Tenant = tnt for _, attribute := range attrPrf.Attributes { //in case that we have filter for attribute send them to FilterS to be processed if len(attribute.FilterIDs) != 0 { var pass bool - if pass, err = alS.filterS.Pass(args.Tenant, attribute.FilterIDs, + if pass, err = alS.filterS.Pass(tnt, attribute.FilterIDs, evNm); err != nil { return } else if !pass { @@ -394,7 +395,11 @@ func (alS *AttributeService) V1GetAttributeForEvent(args *AttrArgsProcessEvent, if args.CGREvent == nil { return utils.NewErrMandatoryIeMissing(utils.CGREventString) } - attrPrf, err := alS.attributeProfileForEvent(args, utils.MapStorage{ + tnt := args.Tenant + if tnt == utils.EmptyString { + tnt = alS.cgrcfg.GeneralCfg().DefaultTenant + } + attrPrf, err := alS.attributeProfileForEvent(tnt, args, utils.MapStorage{ utils.MetaReq: args.CGREvent.Event, utils.MetaOpts: args.Opts, utils.MetaVars: utils.MapStorage{ @@ -420,6 +425,11 @@ func (alS *AttributeService) V1ProcessEvent(args *AttrArgsProcessEvent, if args.Event == nil { return utils.NewErrMandatoryIeMissing(utils.Event) } + tnt := args.Tenant + if tnt == utils.EmptyString { + tnt = alS.cgrcfg.GeneralCfg().DefaultTenant + } + processRuns := alS.cgrcfg.AttributeSCfg().ProcessRuns if args.ProcessRuns != nil && *args.ProcessRuns != 0 { processRuns = *args.ProcessRuns @@ -440,7 +450,7 @@ func (alS *AttributeService) V1ProcessEvent(args *AttrArgsProcessEvent, for i := 0; i < processRuns; i++ { (eNV[utils.MetaVars].(utils.MapStorage))[utils.ProcessRuns] = utils.NewNMData(i + 1) var evRply *AttrSProcessEventReply - evRply, err = alS.processEvent(args, eNV, dynDP, lastID) + evRply, err = alS.processEvent(tnt, args, eNV, dynDP, lastID) if err != nil { if err != utils.ErrNotFound { err = utils.NewErrServerError(err) diff --git a/engine/z_attributes_test.go b/engine/z_attributes_test.go index e9e54ada7..8965b6274 100644 --- a/engine/z_attributes_test.go +++ b/engine/z_attributes_test.go @@ -248,7 +248,7 @@ func TestAttributeCache(t *testing.T) { } func TestAttributeProfileForEvent(t *testing.T) { - atrp, err := attrService.attributeProfileForEvent(attrEvs[0], utils.MapStorage{ + atrp, err := attrService.attributeProfileForEvent(attrEvs[0].Tenant, attrEvs[0], utils.MapStorage{ utils.MetaReq: attrEvs[0].CGREvent.Event, utils.MetaOpts: attrEvs[0].Opts, utils.MetaVars: utils.MapStorage{ @@ -261,7 +261,7 @@ func TestAttributeProfileForEvent(t *testing.T) { if !reflect.DeepEqual(atrPs[0], atrp) { t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(atrPs[0]), utils.ToJSON(atrp)) } - atrp, err = attrService.attributeProfileForEvent(attrEvs[1], utils.MapStorage{ + atrp, err = attrService.attributeProfileForEvent(attrEvs[1].Tenant, attrEvs[1], utils.MapStorage{ utils.MetaReq: attrEvs[1].CGREvent.Event, utils.MetaOpts: attrEvs[1].Opts, utils.MetaVars: utils.MapStorage{ @@ -275,7 +275,7 @@ func TestAttributeProfileForEvent(t *testing.T) { t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(atrPs[1]), utils.ToJSON(atrp)) } - atrp, err = attrService.attributeProfileForEvent(attrEvs[2], utils.MapStorage{ + atrp, err = attrService.attributeProfileForEvent(attrEvs[2].Tenant, attrEvs[2], utils.MapStorage{ utils.MetaReq: attrEvs[2].CGREvent.Event, utils.MetaOpts: attrEvs[2].Opts, utils.MetaVars: utils.MapStorage{ @@ -304,7 +304,7 @@ func TestAttributeProcessEvent(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - atrp, err := attrService.processEvent(attrEvs[0], eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) + atrp, err := attrService.processEvent(attrEvs[0].Tenant, attrEvs[0], eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) if err != nil { t.Errorf("Error: %+v", err) } @@ -322,7 +322,7 @@ func TestAttributeProcessEventWithNotFound(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - if _, err := attrService.processEvent(attrEvs[3], eNM, + if _, err := attrService.processEvent(attrEvs[0].Tenant, attrEvs[3], eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString); err == nil || err != utils.ErrNotFound { t.Errorf("Error: %+v", err) } @@ -343,7 +343,7 @@ func TestAttributeProcessEventWithIDs(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - if atrp, err := attrService.processEvent(attrEvs[3], eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString); err != nil { + if atrp, err := attrService.processEvent(attrEvs[0].Tenant, attrEvs[3], eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString); err != nil { } else if !reflect.DeepEqual(eRply, atrp) { t.Errorf("Expecting: %+v, received: %+v", utils.ToJSON(eRply), utils.ToJSON(atrp)) } @@ -2014,7 +2014,7 @@ func TestProcessAttributeConstant(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - rcv, err := attrService.processEvent(ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) + rcv, err := attrService.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) if err != nil { t.Errorf("Error: %+v", err) } @@ -2077,7 +2077,7 @@ func TestProcessAttributeVariable(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - rcv, err := attrService.processEvent(ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) + rcv, err := attrService.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) if err != nil { t.Errorf("Error: %+v", err) } @@ -2147,7 +2147,7 @@ func TestProcessAttributeComposed(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - rcv, err := attrService.processEvent(ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) + rcv, err := attrService.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) if err != nil { t.Errorf("Error: %+v", err) } @@ -2212,7 +2212,7 @@ func TestProcessAttributeUsageDifference(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - rcv, err := attrService.processEvent(ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) + rcv, err := attrService.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) if err != nil { t.Errorf("Error: %+v", err) } @@ -2277,7 +2277,7 @@ func TestProcessAttributeSum(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - rcv, err := attrService.processEvent(ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) + rcv, err := attrService.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) if err != nil { t.Errorf("Error: %+v", err) } @@ -2342,7 +2342,7 @@ func TestProcessAttributeDiff(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - rcv, err := attrService.processEvent(ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) + rcv, err := attrService.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) if err != nil { t.Errorf("Error: %+v", err) } @@ -2407,7 +2407,7 @@ func TestProcessAttributeMultiply(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - rcv, err := attrService.processEvent(ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) + rcv, err := attrService.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) if err != nil { t.Errorf("Error: %+v", err) } @@ -2472,7 +2472,7 @@ func TestProcessAttributeDivide(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - rcv, err := attrService.processEvent(ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) + rcv, err := attrService.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) if err != nil { t.Errorf("Error: %+v", err) } @@ -2537,7 +2537,7 @@ func TestProcessAttributeValueExponent(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - rcv, err := attrService.processEvent(ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) + rcv, err := attrService.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) if err != nil { t.Errorf("Error: %+v", err) } @@ -2602,7 +2602,7 @@ func TestProcessAttributeUnixTimeStamp(t *testing.T) { utils.ProcessRuns: utils.NewNMData(0), }, } - rcv, err := attrService.processEvent(ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) + rcv, err := attrService.processEvent(ev.Tenant, ev, eNM, newDynamicDP(nil, nil, nil, "cgrates.org", eNM), utils.EmptyString) if err != nil { t.Errorf("Error: %+v", err) }