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:
committed by
Dan Christian Bogos
parent
b8437f4a7d
commit
fc2f7631bd
@@ -481,10 +481,7 @@ func (ar *AgentRequest) ParseField(
|
||||
// setCGRReply will set the aReq.cgrReply based on reply coming from upstream or error
|
||||
// returns error in case of reply not converting to NavigableMap
|
||||
func (ar *AgentRequest) setCGRReply(rply utils.NavigableMapper, err error) {
|
||||
ar.CGRReply = &utils.DataNode{
|
||||
Type: utils.NMMapType,
|
||||
Map: make(map[string]*utils.DataNode),
|
||||
}
|
||||
ar.CGRReply.Map = make(map[string]*utils.DataNode)
|
||||
var errMsg string
|
||||
if err != nil {
|
||||
errMsg = err.Error()
|
||||
|
||||
@@ -1489,7 +1489,7 @@ func testDiamItEmulateTerminate(t *testing.T) {
|
||||
attrSetBalance := utils.AttrSetBalance{
|
||||
Tenant: "cgrates.com",
|
||||
Account: "testDiamItEmulateTerminate",
|
||||
Value: float64(1) * float64(time.Hour),
|
||||
Value: float64(time.Hour),
|
||||
BalanceType: utils.MetaVoice,
|
||||
Balance: map[string]interface{}{
|
||||
utils.ID: "testDiamItEmulateTerminate",
|
||||
|
||||
@@ -261,7 +261,7 @@ func (da *DiameterAgent) handleMessage(c diam.Conn, m *diam.Message) {
|
||||
da.aReqsLck.Unlock()
|
||||
}()
|
||||
}
|
||||
cgrRplyNM := new(utils.DataNode)
|
||||
cgrRplyNM := &utils.DataNode{Type: utils.NMMapType, Map: map[string]*utils.DataNode{}}
|
||||
opts := utils.MapStorage{}
|
||||
rply := utils.NewOrderedNavigableMap() // share it among different processors
|
||||
var processed bool
|
||||
|
||||
@@ -195,7 +195,7 @@ func testDNSitClntNAPTRSuppliers(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
} else if len(rply.Answer) != 2 {
|
||||
t.Errorf("wrong number of records: %s", utils.ToIJSON(rply.Answer))
|
||||
t.Fatalf("wrong number of records: %s", utils.ToIJSON(rply.Answer))
|
||||
}
|
||||
if rply.Rcode != dns.RcodeSuccess {
|
||||
t.Errorf("failed to get an valid answer\n%v", rply)
|
||||
|
||||
@@ -79,7 +79,7 @@ func (ra *RadiusAgent) handleAuth(req *radigo.Packet) (rpl *radigo.Packet, err e
|
||||
dcdr := newRADataProvider(req) // dcdr will provide information from request
|
||||
rpl = req.Reply()
|
||||
rpl.Code = radigo.AccessAccept
|
||||
cgrRplyNM := &utils.DataNode{}
|
||||
cgrRplyNM := &utils.DataNode{Type: utils.NMMapType, Map: map[string]*utils.DataNode{}}
|
||||
rplyNM := utils.NewOrderedNavigableMap()
|
||||
opts := utils.MapStorage{}
|
||||
var processed bool
|
||||
@@ -124,7 +124,7 @@ func (ra *RadiusAgent) handleAcct(req *radigo.Packet) (rpl *radigo.Packet, err e
|
||||
dcdr := newRADataProvider(req) // dcdr will provide information from request
|
||||
rpl = req.Reply()
|
||||
rpl.Code = radigo.AccountingResponse
|
||||
cgrRplyNM := &utils.DataNode{}
|
||||
cgrRplyNM := &utils.DataNode{Type: utils.NMMapType, Map: map[string]*utils.DataNode{}}
|
||||
rplyNM := utils.NewOrderedNavigableMap()
|
||||
opts := utils.MapStorage{}
|
||||
var processed bool
|
||||
|
||||
@@ -303,7 +303,7 @@ func (sa *SIPAgent) handleMessage(sipMessage sipingo.Message, remoteHost string)
|
||||
}
|
||||
dp := utils.MapStorage(sipMessageIface)
|
||||
var processed bool
|
||||
cgrRplyNM := &utils.DataNode{}
|
||||
cgrRplyNM := &utils.DataNode{Type: utils.NMMapType, Map: map[string]*utils.DataNode{}}
|
||||
rplyNM := utils.NewOrderedNavigableMap()
|
||||
opts := utils.MapStorage{}
|
||||
reqVars := &utils.DataNode{
|
||||
|
||||
@@ -173,7 +173,7 @@ func (sqlEe *SQLEe) ExportEvent(cgrEv *utils.CGREvent) (err error) {
|
||||
|
||||
for el := eeReq.OrdNavMP[utils.MetaExp].GetFirstElement(); el != nil; el = el.Next() {
|
||||
nmIt, _ := eeReq.OrdNavMP[utils.MetaExp].Field(el.Value)
|
||||
pathWithoutIndex := utils.GetPathWithoutIndex(strings.Join(el.Value, utils.NestingSep))
|
||||
pathWithoutIndex := strings.Join(el.Value[:len(el.Value)-1], utils.NestingSep) // remove the index path.index
|
||||
if pathWithoutIndex != utils.MetaRow {
|
||||
colNames = append(colNames, pathWithoutIndex)
|
||||
}
|
||||
|
||||
@@ -115,6 +115,9 @@ func (n *DataNode) Field(path []string) (*DataLeaf, error) {
|
||||
if len(path) == 0 {
|
||||
return nil, ErrWrongPath
|
||||
}
|
||||
if path[0] == Length {
|
||||
return &DataLeaf{Data: len(n.Slice)}, nil
|
||||
}
|
||||
idx, err := strconv.Atoi(path[0]) // convert the path to index
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -154,6 +157,9 @@ func (n *DataNode) fieldAsInterface(path []string) (interface{}, error) {
|
||||
if len(path) == 0 {
|
||||
return n.Slice, nil
|
||||
}
|
||||
if path[0] == Length {
|
||||
return len(n.Slice), nil
|
||||
}
|
||||
idx, err := strconv.Atoi(path[0]) // convert the path to index
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user