Fixes panic for AttributeSv1.ProcessEvent with no attribute profile to match

This commit is contained in:
Trial97
2019-02-25 09:54:54 +02:00
committed by Dan Christian Bogos
parent f899284ae1
commit dcd645bbe5
2 changed files with 8 additions and 7 deletions

View File

@@ -238,7 +238,7 @@ func testAttributeSGetAttributeForEventNotFound(t *testing.T) {
var reply *engine.AttributeProfile
if err := attrSRPC.Call("ApierV1.GetAttributeProfile",
&utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_3"}, &reply); err != nil {
t.Error(err)
t.Fatal(err)
}
reply.Compile()
if !reflect.DeepEqual(eAttrPrf2, reply) {
@@ -290,7 +290,7 @@ func testAttributeSGetAttributeForEventWithMetaAnyContext(t *testing.T) {
var reply *engine.AttributeProfile
if err := attrSRPC.Call("ApierV1.GetAttributeProfile",
&utils.TenantID{Tenant: "cgrates.org", ID: "ATTR_2"}, &reply); err != nil {
t.Error(err)
t.Fatal(err)
}
reply.Compile()
if !reflect.DeepEqual(eAttrPrf2, reply) {
@@ -299,7 +299,7 @@ func testAttributeSGetAttributeForEventWithMetaAnyContext(t *testing.T) {
var attrReply *engine.AttributeProfile
if err := attrSRPC.Call(utils.AttributeSv1GetAttributeForEvent,
ev, &attrReply); err != nil {
t.Error(err)
t.Fatal(err)
}
attrReply.Compile()
if !reflect.DeepEqual(eAttrPrf2, attrReply) {
@@ -692,7 +692,7 @@ func testAttributeSSetAlsPrf(t *testing.T) {
var reply *engine.AttributeProfile
if err := attrSRPC.Call("ApierV1.GetAttributeProfile",
&utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}, &reply); err != nil {
t.Error(err)
t.Fatal(err)
}
reply.Compile()
if !reflect.DeepEqual(alsPrf, reply) {
@@ -725,7 +725,7 @@ func testAttributeSUpdateAlsPrf(t *testing.T) {
var reply *engine.AttributeProfile
if err := attrSRPC.Call("ApierV1.GetAttributeProfile",
&utils.TenantID{Tenant: "cgrates.org", ID: "ApierTest"}, &reply); err != nil {
t.Error(err)
t.Fatal(err)
}
reply.Compile()
if !reflect.DeepEqual(alsPrf, reply) {
@@ -791,7 +791,7 @@ func testAttributeSSetAlsPrf2(t *testing.T) {
var reply *engine.AttributeProfile
if err := attrSRPC.Call("ApierV1.GetAttributeProfile",
&utils.TenantID{Tenant: "golant", ID: "ATTR_972587832508_SESSIONAUTH"}, &reply); err != nil {
t.Error(err)
t.Fatal(err)
}
reply.Compile()
if !reflect.DeepEqual(alsPrf, reply) {

View File

@@ -215,7 +215,8 @@ func (alS *AttributeService) V1ProcessEvent(args *AttrArgsProcessEvent,
}
var apiRply *AttrSProcessEventReply // aggregate response here
for i := 0; i < *args.ProcessRuns; i++ {
evRply, err := alS.processEvent(args)
var evRply *AttrSProcessEventReply
evRply, err = alS.processEvent(args)
if err != nil {
if err != utils.ErrNotFound {
err = utils.NewErrServerError(err)