mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Updated integration tests
This commit is contained in:
@@ -43,12 +43,12 @@ var sTestSessionSv1ProcessEvent = []func(t *testing.T){
|
||||
testSSv1ItRpcConn,
|
||||
testSSv1ItPing,
|
||||
testSSv1ItTPFromFolder,
|
||||
// testSSv1ItProcessEventAuth,
|
||||
testSSv1ItProcessEventAuth,
|
||||
testSSv1ItProcessEventInitiateSession,
|
||||
// testSSv1ItProcessEventUpdateSession,
|
||||
// testSSv1ItProcessEventTerminateSession,
|
||||
// testSSv1ItProcessCDRForSessionFromProcessEvent,
|
||||
// testSSv1ItGetCDRs,
|
||||
testSSv1ItProcessEventUpdateSession,
|
||||
testSSv1ItProcessEventTerminateSession,
|
||||
testSSv1ItProcessCDRForSessionFromProcessEvent,
|
||||
testSSv1ItGetCDRs,
|
||||
testSSv1ItStopCgrEngine,
|
||||
}
|
||||
|
||||
|
||||
@@ -50,19 +50,13 @@
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"rpc_conns": {
|
||||
"conn1": {
|
||||
"strategy": "*first",
|
||||
"conns": [{"address": "127.0.0.1:2012", "transport":"*json"}],
|
||||
},
|
||||
},
|
||||
|
||||
"sessions": {
|
||||
"enabled": true,
|
||||
"attributes_conns": ["conn1"],
|
||||
"rals_conns": ["conn1"],
|
||||
"resources_conns": ["conn1"],
|
||||
"chargers_conns": ["conn1"],
|
||||
"attributes_conns": ["*localhost"],
|
||||
"rals_conns": ["*localhost"],
|
||||
"resources_conns": ["*localhost"],
|
||||
"chargers_conns": ["*localhost"],
|
||||
"listen_bijson": ":3014",
|
||||
},
|
||||
|
||||
|
||||
@@ -53,19 +53,12 @@
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"rpc_conns": {
|
||||
"conn1": {
|
||||
"strategy": "*first",
|
||||
"conns": [{"address": "127.0.0.1:2012", "transport":"*json"}],
|
||||
},
|
||||
},
|
||||
|
||||
"sessions": {
|
||||
"enabled": true,
|
||||
"attributes_conns": ["conn1"],
|
||||
"rals_conns": ["conn1"],
|
||||
"resources_conns": ["conn1"],
|
||||
"chargers_conns": ["conn1"],
|
||||
"attributes_conns": ["*localhost"],
|
||||
"rals_conns": ["*localhost"],
|
||||
"resources_conns": ["*localhost"],
|
||||
"chargers_conns": ["*localhost"],
|
||||
"listen_bijson": ":3014",
|
||||
},
|
||||
|
||||
|
||||
@@ -44,19 +44,12 @@
|
||||
"enabled": true,
|
||||
},
|
||||
|
||||
"rpc_conns": {
|
||||
"conn1": {
|
||||
"strategy": "*first",
|
||||
"conns": [{"address": "127.0.0.1:2012", "transport":"*json"}],
|
||||
},
|
||||
},
|
||||
|
||||
"sessions": {
|
||||
"enabled": true,
|
||||
"attributes_conns": ["conn1"],
|
||||
"rals_conns": ["conn1"],
|
||||
"resources_conns": ["conn1"],
|
||||
"chargers_conns": ["conn1"],
|
||||
"attributes_conns": ["*localhost"],
|
||||
"rals_conns": ["*localhost"],
|
||||
"resources_conns": ["*localhost"],
|
||||
"chargers_conns": ["*localhost"],
|
||||
"listen_bijson": ":3014",
|
||||
},
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,FieldName,Type,Value,Blocker,Weight
|
||||
cgrates.org,ATTR_1001_SIMPLEAUTH,*any,*string:~*req.Account:1001,,,*req.Password,*constant,CGRateS.org,false,20
|
||||
cgrates.org,ATTR_1001_SIMPLEAUTH,*any,,,,EventName,*constant,*remove,false,20
|
||||
cgrates.org,ATTR_1001_SIMPLEAUTH,*any,,,,*req.EventName,*constant,*remove,false,20
|
||||
cgrates.org,ATTR_1003_SIMPLEAUTH,*any,*string:~*req.Account:1003,,,*req.Password,*constant,CGRateS.com,false,20
|
||||
cgrates.org,ATTR_API_ATTR_FAKE_AUTH,*auth,*string:~*req.APIKey:12345,,,*req.APIMethods,*constant,,false,20
|
||||
cgrates.org,ATTR_API_ATTR_AUTH,*auth,*string:~*req.APIKey:attr12345,,,*req.APIMethods,*constant,AttributeSv1.Ping&AttributeSv1.GetAttributeForEvent&AttributeSv1.ProcessEvent,false,20
|
||||
|
||||
|
@@ -168,14 +168,9 @@ func (alS *AttributeService) processEvent(args *AttrArgsProcessEvent) (
|
||||
}
|
||||
rply = &AttrSProcessEventReply{
|
||||
MatchedProfiles: []string{attrPrf.ID},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: args.Tenant,
|
||||
ID: args.ID,
|
||||
Time: args.Time,
|
||||
Event: make(map[string]interface{}),
|
||||
},
|
||||
blocker: attrPrf.Blocker}
|
||||
evNm := config.NewNavigableMap(map[string]interface{}{utils.MetaReq: args.Event})
|
||||
CGREvent: args.CGREvent,
|
||||
blocker: attrPrf.Blocker}
|
||||
evNm := config.NewNavigableMap(map[string]interface{}{utils.MetaReq: rply.CGREvent.Event})
|
||||
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 {
|
||||
@@ -265,9 +260,9 @@ func (alS *AttributeService) processEvent(args *AttrArgsProcessEvent) (
|
||||
}
|
||||
if attribute.FieldName == utils.MetaTenant {
|
||||
if attribute.Type == utils.META_COMPOSED {
|
||||
args.CGREvent.Tenant += substitute
|
||||
rply.CGREvent.Tenant += substitute
|
||||
} else {
|
||||
args.CGREvent.Tenant = substitute
|
||||
rply.CGREvent.Tenant = substitute
|
||||
}
|
||||
continue
|
||||
}
|
||||
@@ -282,18 +277,6 @@ func (alS *AttributeService) processEvent(args *AttrArgsProcessEvent) (
|
||||
}
|
||||
evNm.Set(strings.Split(attribute.FieldName, utils.NestingSep), substitute, false, false)
|
||||
}
|
||||
var ev interface{}
|
||||
ev, err = evNm.FieldAsInterface([]string{utils.MetaReq})
|
||||
if err != nil {
|
||||
if err.Error() == utils.ErrNotFound.Error() {
|
||||
return
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
var ok bool
|
||||
if rply.CGREvent.Event, ok = ev.(map[string]interface{}); !ok {
|
||||
return nil, fmt.Errorf("invalid event")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -327,6 +310,7 @@ func (alS *AttributeService) V1ProcessEvent(args *AttrArgsProcessEvent,
|
||||
args.ProcessRuns = utils.IntPointer(alS.cgrcfg.AttributeSCfg().ProcessRuns)
|
||||
}
|
||||
var apiRply *AttrSProcessEventReply // aggregate response here
|
||||
args.CGREvent = args.CGREvent.Clone()
|
||||
for i := 0; i < *args.ProcessRuns; i++ {
|
||||
var evRply *AttrSProcessEventReply
|
||||
evRply, err = alS.processEvent(args)
|
||||
@@ -338,9 +322,6 @@ func (alS *AttributeService) V1ProcessEvent(args *AttrArgsProcessEvent,
|
||||
}
|
||||
break
|
||||
}
|
||||
if len(evRply.AlteredFields) != 0 {
|
||||
args.CGREvent = evRply.CGREvent // for next loop
|
||||
}
|
||||
if apiRply == nil { // first reply
|
||||
apiRply = evRply
|
||||
if apiRply.blocker {
|
||||
|
||||
Reference in New Issue
Block a user