mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-22 23:58:44 +05:00
Added CDR Server test
This commit is contained in:
committed by
Dan Christian Bogos
parent
1f7dc77fc9
commit
60fef23caa
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user