Remove tariffPlans for GOCS tests

This commit is contained in:
TeoV
2019-12-17 04:06:52 -05:00
parent 183c2d5a00
commit fc54558e14
13 changed files with 36 additions and 49 deletions

View File

@@ -1,2 +0,0 @@
#Tenant,ID,FilterIDs,ActivationInterval,RunID,AttributeIDs,Weight
cgrates.org,DEFAULT,,,*default,*none,0
1 #Tenant ID FilterIDs ActivationInterval RunID AttributeIDs Weight
2 cgrates.org DEFAULT *default *none 0

View File

@@ -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 #Id DestinationId RatesTag RoundingMethod RoundingDecimals MaxCost MaxCostStrategy
2 DR_1002_20CNT DST_1002 RT_20CNT *up 4 0
3 DR_1001_10CNT DST_1001 RT_10CNT *up 4 0

View File

@@ -1,3 +0,0 @@
#Id,Prefix
DST_1002,1002
DST_1001,1001
1 #Id Prefix
2 DST_1002 1002
3 DST_1001 1001

View File

@@ -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 #Id ConnectFee Rate RateUnit RateIncrement GroupIntervalStart
2 RT_10CNT 0.2 0.1 60s 60s 0s
3 RT_10CNT 0 0.05 60s 1s 60s
4 RT_20CNT 0.4 0.2 60s 60s 0s
5 RT_20CNT 0 0.1 60s 1s 60s

View File

@@ -1,3 +0,0 @@
#Id,DestinationRatesId,TimingTag,Weight
RP_1001,DR_1002_20CNT,*any,10
RP_1002,DR_1001_10CNT,*any,10
1 #Id DestinationRatesId TimingTag Weight
2 RP_1001 DR_1002_20CNT *any 10
3 RP_1002 DR_1001_10CNT *any 10

View File

@@ -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 #Tenant Category Subject ActivationTime RatingPlanId RatesFallbackSubject
2 cgrates.org call 1001 2014-01-14T00:00:00Z RP_1001
3 cgrates.org call 1002 2014-01-14T00:00:00Z RP_1002

View File

@@ -1,2 +0,0 @@
#Tenant,ID,FilterIDs,ActivationInterval,RunID,AttributeIDs,Weight
cgrates.org,DEFAULT,,,*default,*none,0
1 #Tenant ID FilterIDs ActivationInterval RunID AttributeIDs Weight
2 cgrates.org DEFAULT *default *none 0

View File

@@ -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 #Id DestinationId RatesTag RoundingMethod RoundingDecimals MaxCost MaxCostStrategy
2 DR_1002_20CNT DST_1002 RT_20CNT *up 4 0
3 DR_1001_10CNT DST_1001 RT_10CNT *up 4 0

View File

@@ -1,3 +0,0 @@
#Id,Prefix
DST_1002,1002
DST_1001,1001
1 #Id Prefix
2 DST_1002 1002
3 DST_1001 1001

View File

@@ -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 #Id ConnectFee Rate RateUnit RateIncrement GroupIntervalStart
2 RT_10CNT 0.2 0.1 60s 60s 0s
3 RT_10CNT 0 0.05 60s 1s 60s
4 RT_20CNT 0.4 0.2 60s 60s 0s
5 RT_20CNT 0 0.1 60s 1s 60s

View File

@@ -1,3 +0,0 @@
#Id,DestinationRatesId,TimingTag,Weight
RP_1001,DR_1002_20CNT,*any,10
RP_1002,DR_1001_10CNT,*any,10
1 #Id DestinationRatesId TimingTag Weight
2 RP_1001 DR_1002_20CNT *any 10
3 RP_1002 DR_1001_10CNT *any 10

View File

@@ -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 #Tenant Category Subject ActivationTime RatingPlanId RatesFallbackSubject
2 cgrates.org call 1001 2014-01-14T00:00:00Z RP_1001
3 cgrates.org call 1002 2014-01-14T00:00:00Z RP_1002

View File

@@ -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) {