mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-23 16:18:44 +05:00
Fixed bug in ers
This commit is contained in:
committed by
Dan Christian Bogos
parent
b8a89b3f60
commit
d20178548f
@@ -123,11 +123,13 @@ func (erS *ERService) ListenAndServe(stopChan, cfgRldChan chan struct{}) (err er
|
||||
if erS.cfg.ERsCfg().Readers[rdrIdx].Type == utils.MetaNone { // ignore *default reader
|
||||
continue
|
||||
}
|
||||
if err := erS.addReader(id, rdrIdx); err != nil {
|
||||
if err = erS.addReader(id, rdrIdx); err != nil {
|
||||
utils.Logger.Crit(
|
||||
fmt.Sprintf("<%s> adding reader <%s> got error: <%s>",
|
||||
utils.ERs, id, err.Error()))
|
||||
erS.rdrErr <- err
|
||||
erS.closeAllRdrs()
|
||||
erS.Unlock()
|
||||
return
|
||||
}
|
||||
}
|
||||
erS.Unlock()
|
||||
|
||||
@@ -370,7 +370,6 @@ func TestERsListenAndServeCfgRldChan5(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func TestERsListenAndServeCfgRldChan6(t *testing.T) {
|
||||
cfg := config.NewDefaultCGRConfig()
|
||||
cfg.ERsCfg().Readers = []*config.EventReaderCfg{
|
||||
@@ -395,17 +394,21 @@ func TestERsListenAndServeCfgRldChan6(t *testing.T) {
|
||||
srv.rdrPaths = map[string]string{
|
||||
"test": "path_test",
|
||||
}
|
||||
cfgRldChan <- struct{}{}
|
||||
go func() {
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
close(stopChan)
|
||||
cfg.ERsCfg().Readers = []*config.EventReaderCfg{
|
||||
{
|
||||
ID: "test",
|
||||
Type: "BadType",
|
||||
},
|
||||
}
|
||||
cfgRldChan <- struct{}{}
|
||||
}()
|
||||
err := srv.ListenAndServe(stopChan, cfgRldChan)
|
||||
if err == nil || err.Error() != "unsupported reader type: <badType>" {
|
||||
t.Fatalf("\nExpecting <%+v>,\n Received <%+v>", "unsupported reader type: <badType>", err)
|
||||
if err == nil || err.Error() != "unsupported reader type: <BadType>" {
|
||||
t.Fatalf("\nExpecting <%+v>,\n Received <%+v>", "unsupported reader type: <BadType>", err)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func TestERsProcessEvent(t *testing.T) {
|
||||
cfg := config.NewDefaultCGRConfig()
|
||||
|
||||
Reference in New Issue
Block a user