mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-24 08:38:45 +05:00
Update integration tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
a7fb5315db
commit
63ba0ffca7
@@ -152,7 +152,7 @@ func (cS *ChargerService) processEvent(cgrEv *utils.CGREventWithArgDispatcher) (
|
||||
// V1ProcessEvent will process the event received via API and return list of events forked
|
||||
func (cS *ChargerService) V1ProcessEvent(args *utils.CGREventWithArgDispatcher,
|
||||
reply *[]*ChrgSProcessEventReply) (err error) {
|
||||
if args.Event == nil {
|
||||
if args.CGREvent == nil || args.Event == nil {
|
||||
return utils.NewErrMandatoryIeMissing("Event")
|
||||
}
|
||||
rply, err := cS.processEvent(args)
|
||||
|
||||
@@ -550,8 +550,8 @@ func (fltr *FilterRule) passResourceS(dP config.DataProvider,
|
||||
}
|
||||
for _, resItem := range fltr.resourceItems {
|
||||
//take total usage for resource
|
||||
var reply *Resource
|
||||
if err := resourceS.Call(utils.ApierV1GetResource,
|
||||
var reply Resource
|
||||
if err := resourceS.Call(utils.ResourceSv1GetResource,
|
||||
&utils.TenantID{Tenant: tenant, ID: resItem.ItemID}, &reply); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -721,3 +721,16 @@ func (rS *ResourceService) V1ReleaseResource(args utils.ArgRSv1ResourceUsage, re
|
||||
*reply = utils.OK
|
||||
return
|
||||
}
|
||||
|
||||
// GetResource returns a resource configuration
|
||||
func (rS *ResourceService) V1GetResource(arg *utils.TenantID, reply *Resource) error {
|
||||
if missing := utils.MissingStructFields(arg, []string{"Tenant", "ID"}); len(missing) != 0 { //Params missing
|
||||
return utils.NewErrMandatoryIeMissing(missing...)
|
||||
}
|
||||
if res, err := rS.dm.GetResource(arg.Tenant, arg.ID, true, true, utils.NonTransactional); err != nil {
|
||||
return err
|
||||
} else {
|
||||
*reply = *res
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -299,12 +299,13 @@ func (spS *SupplierService) statMetrics(statIDs []string, tenant string) (stsMet
|
||||
func (spS *SupplierService) resourceUsage(resIDs []string, tenant string) (tUsage float64, err error) {
|
||||
if spS.resourceS != nil {
|
||||
for _, resID := range resIDs {
|
||||
var res *Resource
|
||||
if err = spS.resourceS.Call(utils.ApierV1GetResource,
|
||||
var res Resource
|
||||
if err = spS.resourceS.Call(utils.ResourceSv1GetResource,
|
||||
&utils.TenantID{Tenant: tenant, ID: resID}, &res); err != nil &&
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<SupplierS> error: %s getting resource for ID : %s", err.Error(), resID))
|
||||
continue
|
||||
}
|
||||
tUsage += res.totalUsage()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user