mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-23 08:08:45 +05:00
Remove tariffPlans for GOCS tests
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
#Tenant,ID,FilterIDs,ActivationInterval,RunID,AttributeIDs,Weight
|
||||
cgrates.org,DEFAULT,,,*default,*none,0
|
||||
|
@@ -1,4 +0,0 @@
|
||||
#Id,DestinationId,RatesTag,RoundingMethod,RoundingDecimals,MaxCost,MaxCostStrategy
|
||||
DR_1002_20CNT,DST_1002,RT_20CNT,*up,4,0,
|
||||
DR_1001_10CNT,DST_1001,RT_10CNT,*up,4,0,
|
||||
|
||||
|
@@ -1,3 +0,0 @@
|
||||
#Id,Prefix
|
||||
DST_1002,1002
|
||||
DST_1001,1001
|
||||
|
@@ -1,5 +0,0 @@
|
||||
#Id,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart
|
||||
RT_10CNT,0.2,0.1,60s,60s,0s
|
||||
RT_10CNT,0,0.05,60s,1s,60s
|
||||
RT_20CNT,0.4,0.2,60s,60s,0s
|
||||
RT_20CNT,0,0.1,60s,1s,60s
|
||||
|
@@ -1,3 +0,0 @@
|
||||
#Id,DestinationRatesId,TimingTag,Weight
|
||||
RP_1001,DR_1002_20CNT,*any,10
|
||||
RP_1002,DR_1001_10CNT,*any,10
|
||||
|
@@ -1,3 +0,0 @@
|
||||
#Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject
|
||||
cgrates.org,call,1001,2014-01-14T00:00:00Z,RP_1001,
|
||||
cgrates.org,call,1002,2014-01-14T00:00:00Z,RP_1002,
|
||||
|
@@ -1,2 +0,0 @@
|
||||
#Tenant,ID,FilterIDs,ActivationInterval,RunID,AttributeIDs,Weight
|
||||
cgrates.org,DEFAULT,,,*default,*none,0
|
||||
|
@@ -1,4 +0,0 @@
|
||||
#Id,DestinationId,RatesTag,RoundingMethod,RoundingDecimals,MaxCost,MaxCostStrategy
|
||||
DR_1002_20CNT,DST_1002,RT_20CNT,*up,4,0,
|
||||
DR_1001_10CNT,DST_1001,RT_10CNT,*up,4,0,
|
||||
|
||||
|
@@ -1,3 +0,0 @@
|
||||
#Id,Prefix
|
||||
DST_1002,1002
|
||||
DST_1001,1001
|
||||
|
@@ -1,5 +0,0 @@
|
||||
#Id,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart
|
||||
RT_10CNT,0.2,0.1,60s,60s,0s
|
||||
RT_10CNT,0,0.05,60s,1s,60s
|
||||
RT_20CNT,0.4,0.2,60s,60s,0s
|
||||
RT_20CNT,0,0.1,60s,1s,60s
|
||||
|
@@ -1,3 +0,0 @@
|
||||
#Id,DestinationRatesId,TimingTag,Weight
|
||||
RP_1001,DR_1002_20CNT,*any,10
|
||||
RP_1002,DR_1001_10CNT,*any,10
|
||||
|
@@ -1,3 +0,0 @@
|
||||
#Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject
|
||||
cgrates.org,call,1001,2014-01-14T00:00:00Z,RP_1001,
|
||||
cgrates.org,call,1002,2014-01-14T00:00:00Z,RP_1002,
|
||||
|
@@ -24,9 +24,12 @@ import (
|
||||
"net/rpc"
|
||||
"os/exec"
|
||||
"path"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
v1 "github.com/cgrates/cgrates/apier/v1"
|
||||
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
@@ -137,24 +140,47 @@ func testGOCSApierRpcConn(t *testing.T) {
|
||||
}
|
||||
|
||||
func testGOCSLoadData(t *testing.T) {
|
||||
attrs := &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "gocs", "us_site")}
|
||||
var loadInst utils.LoadInstance
|
||||
if err := usRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil {
|
||||
t.Error(err)
|
||||
chargerProfile := &v1.ChargerWithCache{
|
||||
ChargerProfile: &engine.ChargerProfile{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "DEFAULT",
|
||||
RunID: utils.MetaDefault,
|
||||
AttributeIDs: []string{utils.META_NONE},
|
||||
Weight: 10,
|
||||
},
|
||||
}
|
||||
attrs = &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "gocs", "au_site")}
|
||||
if err := auRPC.Call(utils.ApierV2LoadTariffPlanFromFolder, attrs, &loadInst); err != nil {
|
||||
var result string
|
||||
if err := usRPC.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil {
|
||||
t.Error(err)
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups on au_site
|
||||
attrs = &utils.AttrLoadTpFromFolder{FolderPath: path.Join(*dataDir, "tariffplans", "gocs", "dsp_site")}
|
||||
var rpl *engine.ChargerProfile
|
||||
if err := usRPC.Call(utils.ApierV1GetChargerProfile,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: "DEFAULT"}, &rpl); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(chargerProfile.ChargerProfile, rpl) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", chargerProfile.ChargerProfile, rpl)
|
||||
}
|
||||
if err := usRPC.Call(utils.ApierV1SetChargerProfile, chargerProfile, &result); err != nil {
|
||||
t.Error(err)
|
||||
} else if result != utils.OK {
|
||||
t.Error("Unexpected reply returned", result)
|
||||
}
|
||||
if err := usRPC.Call(utils.ApierV1GetChargerProfile,
|
||||
&utils.TenantID{Tenant: "cgrates.org", ID: "DEFAULT"}, &rpl); err != nil {
|
||||
t.Error(err)
|
||||
} else if !reflect.DeepEqual(chargerProfile.ChargerProfile, rpl) {
|
||||
t.Errorf("Expecting : %+v, received: %+v", chargerProfile.ChargerProfile, rpl)
|
||||
}
|
||||
|
||||
wchan := make(chan struct{}, 1)
|
||||
go func() {
|
||||
loaderPath, err := exec.LookPath("cgr-loader")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
loader := exec.Command(loaderPath, "-config_path", dspCfgPath, "-path", attrs.FolderPath)
|
||||
loader := exec.Command(loaderPath, "-config_path", dspCfgPath, "-path", path.Join(*dataDir, "tariffplans", "gocs", "dsp_site"))
|
||||
|
||||
if err := loader.Start(); err != nil {
|
||||
t.Error(err)
|
||||
@@ -194,6 +220,7 @@ func testGOCSLoadData(t *testing.T) {
|
||||
} else if rply := acnt.BalanceMap[utils.VOICE].GetTotalValue(); rply != expectedVoice {
|
||||
t.Errorf("Expecting: %v, received: %v", expectedVoice, rply)
|
||||
}
|
||||
time.Sleep(time.Duration(*waitRater) * time.Millisecond) // Give time for scheduler to execute topups on au_site
|
||||
}
|
||||
|
||||
func testGOCSAuthSession(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user