Added CDR Server test

This commit is contained in:
Trial97
2019-09-20 13:54:06 +03:00
committed by Dan Christian Bogos
parent 1f7dc77fc9
commit 60fef23caa
3 changed files with 134 additions and 0 deletions

View File

@@ -276,6 +276,50 @@ func TestCGRConfigReloadSchedulerS(t *testing.T) {
}
}
func TestCGRConfigReloadCDRs(t *testing.T) {
cfg, err := NewDefaultCGRConfig()
if err != nil {
t.Fatal(err)
}
cfg.RalsCfg().RALsEnabled = true
var reply string
if err = cfg.V1ReloadConfig(&ConfigReloadWithArgDispatcher{
Path: path.Join("/usr", "share", "cgrates", "conf", "samples", "tutmongo2"),
Section: CDRS_JSN,
}, &reply); err != nil {
t.Error(err)
} else if reply != utils.OK {
t.Errorf("Expected OK received: %s", reply)
}
expAttr := &CdrsCfg{
Enabled: true,
ExtraFields: utils.RSRFields{
utils.NewRSRFieldMustCompile("PayPalAccount"),
utils.NewRSRFieldMustCompile("LCRProfile"),
utils.NewRSRFieldMustCompile("ResourceID"),
},
ChargerSConns: []*RemoteHost{
&RemoteHost{
Address: "127.0.0.1:2012",
Transport: utils.MetaJSONrpc,
},
},
RaterConns: []*RemoteHost{
&RemoteHost{
Address: utils.MetaInternal,
},
},
AttributeSConns: []*RemoteHost{},
ThresholdSConns: []*RemoteHost{},
StatSConns: []*RemoteHost{},
SMCostRetries: 5,
StoreCdrs: true,
}
if !reflect.DeepEqual(expAttr, cfg.CdrsCfg()) {
t.Errorf("Expected %s , received: %s ", utils.ToJSON(expAttr), utils.ToJSON(cfg.CdrsCfg()))
}
}
func TestCgrCfgV1ReloadConfigSection(t *testing.T) {
for _, dir := range []string{"/tmp/ers/in", "/tmp/ers/out"} {
if err := os.RemoveAll(dir); err != nil {