diff --git a/config/config_test.go b/config/config_test.go index 457d625ef..ffc15d9f0 100755 --- a/config/config_test.go +++ b/config/config_test.go @@ -1788,7 +1788,7 @@ func TestCheckConfigSanity(t *testing.T) { cfg.statsCfg.Enabled = true cfg.cdrsCfg.OnlineCDRExports = []string{"stringy"} cfg.CdreProfiles = map[string]*CdreCfg{"stringx": &CdreCfg{}} - expected = " Cannot find CDR export template with ID: " + expected = " cannot find CDR export template with ID: " if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } diff --git a/config/configsanity.go b/config/configsanity.go index ba50032b2..502ae3881 100644 --- a/config/configsanity.go +++ b/config/configsanity.go @@ -39,7 +39,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.StatService, utils.RALService) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.RALService, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.RALService, connID) } } for _, connID := range cfg.ralsCfg.ThresholdSConns { @@ -47,7 +47,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.ThresholdS, utils.RALService) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.RALService, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.RALService, connID) } } } @@ -58,7 +58,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.ChargerS, utils.CDRs) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.CDRs, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.CDRs, connID) } } for _, connID := range cfg.cdrsCfg.RaterConns { @@ -66,7 +66,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.RALService, utils.CDRs) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.CDRs, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.CDRs, connID) } } for _, connID := range cfg.cdrsCfg.AttributeSConns { @@ -74,7 +74,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.AttributeS, utils.CDRs) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.CDRs, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.CDRs, connID) } } for _, connID := range cfg.cdrsCfg.StatSConns { @@ -82,7 +82,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.StatService, utils.CDRs) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.CDRs, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.CDRs, connID) } } for _, connID := range cfg.cdrsCfg.ThresholdSConns { @@ -90,12 +90,12 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.ThresholdS, utils.CDRs) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.CDRs, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.CDRs, connID) } } for _, cdrePrfl := range cfg.cdrsCfg.OnlineCDRExports { if _, hasIt := cfg.CdreProfiles[cdrePrfl]; !hasIt { - return fmt.Errorf("<%s> Cannot find CDR export template with ID: <%s>", utils.CDRs, cdrePrfl) + return fmt.Errorf("<%s> cannot find CDR export template with ID: <%s>", utils.CDRs, cdrePrfl) } } } @@ -106,7 +106,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { } for _, dir := range []string{ldrSCfg.TpInDir, ldrSCfg.TpOutDir} { if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) { - return fmt.Errorf("<%s> Nonexistent folder: %s", utils.LoaderS, dir) + return fmt.Errorf("<%s> nonexistent folder: %s", utils.LoaderS, dir) } } for _, data := range ldrSCfg.Data { @@ -131,7 +131,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.ChargerS, utils.SessionS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SessionS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SessionS, connID) } } for _, connID := range cfg.sessionSCfg.RALsConns { @@ -139,7 +139,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.RALService, utils.SessionS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SessionS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SessionS, connID) } } for _, connID := range cfg.sessionSCfg.ResSConns { @@ -147,7 +147,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.ResourceS, utils.SessionS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SessionS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SessionS, connID) } } for _, connID := range cfg.sessionSCfg.ThreshSConns { @@ -155,7 +155,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.ThresholdS, utils.SessionS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SessionS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SessionS, connID) } } for _, connID := range cfg.sessionSCfg.StatSConns { @@ -163,7 +163,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.StatService, utils.SessionS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SessionS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SessionS, connID) } } for _, connID := range cfg.sessionSCfg.SupplSConns { @@ -171,7 +171,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SupplierS, utils.SessionS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SessionS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SessionS, connID) } } for _, connID := range cfg.sessionSCfg.AttrSConns { @@ -179,7 +179,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.AttributeS, utils.SessionS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SessionS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SessionS, connID) } } for _, connID := range cfg.sessionSCfg.CDRsConns { @@ -187,12 +187,12 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.CDRs, utils.SessionS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SessionS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SessionS, connID) } } for _, connID := range cfg.sessionSCfg.ReplicationConns { if _, has := cfg.rpcConns[connID]; !has { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SessionS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SessionS, connID) } } if cfg.cacheCfg[utils.CacheClosedSessions].Limit == 0 { @@ -200,7 +200,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { } for alfld := range cfg.sessionSCfg.AlterableFields.Data() { if utils.ProtectedSFlds.Has(alfld) { - return fmt.Errorf("<%s> The following protected field can't be altered by session: <%s>", utils.SessionS, alfld) + return fmt.Errorf("<%s> the following protected field can't be altered by session: <%s>", utils.SessionS, alfld) } } } @@ -216,7 +216,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SessionS, utils.FreeSWITCHAgent) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.FreeSWITCHAgent, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.FreeSWITCHAgent, connID) } } } @@ -231,7 +231,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SessionS, utils.KamailioAgent) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.KamailioAgent, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.KamailioAgent, connID) } } } @@ -246,7 +246,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SessionS, utils.AsteriskAgent) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.AsteriskAgent, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.AsteriskAgent, connID) } } } @@ -261,7 +261,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SessionS, utils.DiameterAgent) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.DiameterAgent, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.DiameterAgent, connID) } } } @@ -276,7 +276,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SessionS, utils.RadiusAgent) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.RadiusAgent, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.RadiusAgent, connID) } } } @@ -291,7 +291,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SessionS, utils.DNSAgent) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.DNSAgent, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.DNSAgent, connID) } } } @@ -303,7 +303,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> HTTPAgent Template.", utils.SessionS, httpAgentCfg.ID) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Template with ID <%s> has connection with id: <%s> not defined", utils.HTTPAgent, httpAgentCfg.ID, connID) + return fmt.Errorf("<%s> template with ID <%s> has connection with id: <%s> not defined", utils.HTTPAgent, httpAgentCfg.ID, connID) } } if !utils.SliceHasMember([]string{utils.MetaUrl, utils.MetaXml}, httpAgentCfg.RequestPayload) { @@ -324,7 +324,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.AttributeS, utils.ChargerS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.ChargerS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.ChargerS, connID) } } } @@ -335,7 +335,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.ThresholdS, utils.ResourceS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.ResourceS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.ResourceS, connID) } } } @@ -346,7 +346,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.ThresholdS, utils.StatS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.StatS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.StatS, connID) } } } @@ -357,7 +357,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.AttributeS, utils.SupplierS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SupplierS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SupplierS, connID) } } for _, connID := range cfg.supplierSCfg.StatSConns { @@ -365,7 +365,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.StatService, utils.SupplierS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SupplierS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SupplierS, connID) } } for _, connID := range cfg.supplierSCfg.ResourceSConns { @@ -373,7 +373,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.ResourceS, utils.SupplierS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SupplierS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SupplierS, connID) } } } @@ -384,7 +384,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.CDRs, utils.SchedulerS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.SchedulerS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.SchedulerS, connID) } } } @@ -395,7 +395,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SessionS, utils.ERs) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.ERs, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.ERs, connID) } } for _, rdr := range cfg.ersCfg.Readers { @@ -407,7 +407,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { case utils.MetaFileCSV, utils.MetaPartialCSV, utils.MetaFlatstore: for _, dir := range []string{rdr.ProcessedPath, rdr.SourcePath} { if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) { - return fmt.Errorf("<%s> Nonexistent folder: %s for reader with ID: %s", utils.ERs, dir, rdr.ID) + return fmt.Errorf("<%s> nonexistent folder: %s for reader with ID: %s", utils.ERs, dir, rdr.ID) } } if rdr.FieldSep == utils.EmptyString { @@ -415,12 +415,12 @@ func (cfg *CGRConfig) checkConfigSanity() error { } case utils.MetaKafkajsonMap: if rdr.RunDelay > 0 { - return fmt.Errorf("<%s> RunDelay field can not be bigger than zero for reader with ID: %s", utils.ERs, rdr.ID) + return fmt.Errorf("<%s> the RunDelay field can not be bigger than zero for reader with ID: %s", utils.ERs, rdr.ID) } case utils.MetaFileXML, utils.MetaFileFWV: for _, dir := range []string{rdr.ProcessedPath, rdr.SourcePath} { if _, err := os.Stat(dir); err != nil && os.IsNotExist(err) { - return fmt.Errorf("<%s> Nonexistent folder: %s for reader with ID: %s", utils.ERs, dir, rdr.ID) + return fmt.Errorf("<%s> nonexistent folder: %s for reader with ID: %s", utils.ERs, dir, rdr.ID) } } } @@ -431,7 +431,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { if !utils.IsSliceMember([]string{utils.PostgressSSLModeDisable, utils.PostgressSSLModeAllow, utils.PostgressSSLModePrefer, utils.PostgressSSLModeRequire, utils.PostgressSSLModeVerifyCa, utils.PostgressSSLModeVerifyFull}, cfg.storDbCfg.SSLMode) { - return fmt.Errorf("<%s> Unsuported sslmode for storDB", utils.StorDB) + return fmt.Errorf("<%s> unsuported sslmode for storDB", utils.StorDB) } } // DataDB sanity checks @@ -442,21 +442,21 @@ func (cfg *CGRConfig) checkConfigSanity() error { } } if cfg.resourceSCfg.Enabled == true && cfg.resourceSCfg.StoreInterval != -1 { - return fmt.Errorf("<%s> StoreInterval needs to be -1 when DataBD is *internal, received : %d", utils.ResourceS, cfg.resourceSCfg.StoreInterval) + return fmt.Errorf("<%s> the StoreInterval field needs to be -1 when DataBD is *internal, received : %d", utils.ResourceS, cfg.resourceSCfg.StoreInterval) } if cfg.statsCfg.Enabled == true && cfg.statsCfg.StoreInterval != -1 { - return fmt.Errorf("<%s> StoreInterval needs to be -1 when DataBD is *internal, received : %d", utils.StatS, cfg.statsCfg.StoreInterval) + return fmt.Errorf("<%s> the StoreInterval field needs to be -1 when DataBD is *internal, received : %d", utils.StatS, cfg.statsCfg.StoreInterval) } if cfg.thresholdSCfg.Enabled == true && cfg.thresholdSCfg.StoreInterval != -1 { - return fmt.Errorf("<%s> StoreInterval needs to be -1 when DataBD is *internal, received : %d", utils.ThresholdS, cfg.thresholdSCfg.StoreInterval) + return fmt.Errorf("<%s> the StoreInterval field needs to be -1 when DataBD is *internal, received : %d", utils.ThresholdS, cfg.thresholdSCfg.StoreInterval) } } for item, val := range cfg.dataDbCfg.Items { if val.Remote == true && len(cfg.dataDbCfg.RmtConns) == 0 { - return fmt.Errorf("Remote connections required by: <%s>", item) + return fmt.Errorf("remote connections required by: <%s>", item) } if val.Replicate == true && len(cfg.dataDbCfg.RplConns) == 0 { - return fmt.Errorf("Replicate connections required by: <%s>", item) + return fmt.Errorf("replicate connections required by: <%s>", item) } } // APIer sanity checks @@ -465,7 +465,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.AttributeS, utils.ApierV1) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.ApierV1, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.ApierV1, connID) } } for _, connID := range cfg.apier.SchedulerConns { @@ -473,7 +473,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.SchedulerS, utils.ApierV1) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.ApierV1, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.ApierV1, connID) } } // Dispatcher sanity check @@ -483,7 +483,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.AttributeS, utils.DispatcherS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.DispatcherS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.DispatcherS, connID) } } } @@ -499,7 +499,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.StatS, utils.FilterS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.FilterS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.FilterS, connID) } } for _, connID := range cfg.filterSCfg.ResourceSConns { @@ -507,7 +507,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.ResourceS, utils.FilterS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.FilterS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.FilterS, connID) } } for _, connID := range cfg.filterSCfg.RALsConns { @@ -515,7 +515,7 @@ func (cfg *CGRConfig) checkConfigSanity() error { return fmt.Errorf("<%s> not enabled but requested by <%s> component.", utils.RALService, utils.FilterS) } if _, has := cfg.rpcConns[connID]; !has && !strings.HasPrefix(connID, utils.MetaInternal) { - return fmt.Errorf("<%s> Connection with id: <%s> not defined", utils.FilterS, connID) + return fmt.Errorf("<%s> connection with id: <%s> not defined", utils.FilterS, connID) } } diff --git a/config/configsanity_test.go b/config/configsanity_test.go index 709da692f..108811dc4 100644 --- a/config/configsanity_test.go +++ b/config/configsanity_test.go @@ -35,7 +35,7 @@ func TestConfigSanityRater(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.ralsCfg.StatSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -46,7 +46,7 @@ func TestConfigSanityRater(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.ralsCfg.ThresholdSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -64,7 +64,7 @@ func TestConfigSanityCDRServer(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.cdrsCfg.ChargerSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -77,7 +77,7 @@ func TestConfigSanityCDRServer(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.cdrsCfg.RaterConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -89,7 +89,7 @@ func TestConfigSanityCDRServer(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.cdrsCfg.AttributeSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -101,7 +101,7 @@ func TestConfigSanityCDRServer(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.cdrsCfg.StatSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -109,12 +109,12 @@ func TestConfigSanityCDRServer(t *testing.T) { cfg.cdrsCfg.OnlineCDRExports = []string{"stringy"} cfg.CdreProfiles = map[string]*CdreCfg{"stringx": &CdreCfg{}} - expected = " Cannot find CDR export template with ID: " + expected = " cannot find CDR export template with ID: " if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.cdrsCfg.ThresholdSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -140,7 +140,7 @@ func TestConfigSanityLoaders(t *testing.T) { }, }, } - expected := " Nonexistent folder: /not/exist" + expected := " nonexistent folder: /not/exist" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -204,7 +204,7 @@ func TestConfigSanitySessionS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.sessionSCfg.ChargerSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -217,7 +217,7 @@ func TestConfigSanitySessionS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.sessionSCfg.RALsConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -230,7 +230,7 @@ func TestConfigSanitySessionS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.sessionSCfg.ResSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -243,7 +243,7 @@ func TestConfigSanitySessionS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.sessionSCfg.ThreshSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -256,7 +256,7 @@ func TestConfigSanitySessionS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.sessionSCfg.StatSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -269,7 +269,7 @@ func TestConfigSanitySessionS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.sessionSCfg.SupplSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -282,7 +282,7 @@ func TestConfigSanitySessionS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.sessionSCfg.AttrSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -295,14 +295,14 @@ func TestConfigSanitySessionS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.sessionSCfg.CDRsConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.sessionSCfg.CDRsConns = []string{} cfg.cdrsCfg.Enabled = true cfg.sessionSCfg.ReplicationConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -314,7 +314,7 @@ func TestConfigSanitySessionS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.cacheCfg[utils.CacheClosedSessions].Limit = 1 - expected = " The following protected field can't be altered by session: " + expected = " the following protected field can't be altered by session: " cfg.sessionSCfg.AlterableFields = utils.NewStringSet([]string{utils.CGRID}) if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) @@ -341,7 +341,7 @@ func TestConfigSanityFreeSWITCHAgent(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.fsAgentCfg.SessionSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -363,7 +363,7 @@ func TestConfigSanityKamailioAgent(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.kamAgentCfg.SessionSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -385,7 +385,7 @@ func TestConfigSanityAsteriskAgent(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.asteriskAgentCfg.SessionSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -407,7 +407,7 @@ func TestConfigSanityDAgent(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.diameterAgentCfg.SessionSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -429,7 +429,7 @@ func TestConfigSanityRadiusAgent(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.radiusAgentCfg.SessionSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -451,7 +451,7 @@ func TestConfigSanityDNSAgent(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.dnsAgentCfg.SessionSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -471,7 +471,7 @@ func TestConfigSanityHTTPAgent(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.httpAgentCfg[0].SessionSConns = []string{"test"} - expected = " Template with ID has connection with id: not defined" + expected = " template with ID has connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -521,7 +521,7 @@ func TestConfigSanityHTTPAgent(t *testing.T) { } cfg.chargerSCfg.AttributeSConns = []string{"Invalid"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -538,7 +538,7 @@ func TestConfigSanityResourceLimiter(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.resourceSCfg.ThresholdSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -555,7 +555,7 @@ func TestConfigSanityStatS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.statsCfg.ThresholdSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -572,7 +572,7 @@ func TestConfigSanitySupplierS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.supplierSCfg.ResourceSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -585,7 +585,7 @@ func TestConfigSanitySupplierS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.supplierSCfg.StatSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -598,7 +598,7 @@ func TestConfigSanitySupplierS(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.supplierSCfg.AttributeSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -615,7 +615,7 @@ func TestConfigSanityScheduler(t *testing.T) { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.schedulerCfg.CDRsConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -628,7 +628,7 @@ func TestConfigSanityEventReader(t *testing.T) { Enabled: true, SessionSConns: []string{"unexistedConn"}, } - expected := " Connection with id: not defined" + expected := " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -656,7 +656,7 @@ func TestConfigSanityEventReader(t *testing.T) { ProcessedPath: "not/a/path", }, } - expected = " Nonexistent folder: not/a/path for reader with ID: test2" + expected = " nonexistent folder: not/a/path for reader with ID: test2" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -680,7 +680,7 @@ func TestConfigSanityEventReader(t *testing.T) { RunDelay: 1, FieldSep: utils.InInFieldSep, } - expected = " RunDelay field can not be bigger than zero for reader with ID: test4" + expected = " the RunDelay field can not be bigger than zero for reader with ID: test4" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -692,7 +692,7 @@ func TestConfigSanityEventReader(t *testing.T) { ProcessedPath: "not/a/path", SourcePath: "not/a/path", } - expected = " Nonexistent folder: not/a/path for reader with ID: test5" + expected = " nonexistent folder: not/a/path for reader with ID: test5" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -705,7 +705,7 @@ func TestConfigSanityEventReader(t *testing.T) { ProcessedPath: "not/a/path", SourcePath: "not/a/path", } - expected = " Nonexistent folder: not/a/path for reader with ID: test5" + expected = " nonexistent folder: not/a/path for reader with ID: test5" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -717,7 +717,7 @@ func TestConfigSanityStorDB(t *testing.T) { Type: utils.POSTGRES, SSLMode: "wrongSSLMode", } - expected := " Unsuported sslmode for storDB" + expected := " unsuported sslmode for storDB" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -747,21 +747,21 @@ func TestConfigSanityDataDB(t *testing.T) { } cfg.cacheCfg[utils.CacheAccounts].Limit = 0 cfg.resourceSCfg.Enabled = true - expected = " StoreInterval needs to be -1 when DataBD is *internal, received : 0" + expected = " the StoreInterval field needs to be -1 when DataBD is *internal, received : 0" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.resourceSCfg.Enabled = false cfg.statsCfg.Enabled = true - expected = " StoreInterval needs to be -1 when DataBD is *internal, received : 0" + expected = " the StoreInterval field needs to be -1 when DataBD is *internal, received : 0" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } cfg.statsCfg.Enabled = false cfg.thresholdSCfg.Enabled = true - expected = " StoreInterval needs to be -1 when DataBD is *internal, received : 0" + expected = " the StoreInterval field needs to be -1 when DataBD is *internal, received : 0" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -772,7 +772,7 @@ func TestConfigSanityDataDB(t *testing.T) { Remote: true, }, } - expected = "Remote connections required by: " + expected = "remote connections required by: " if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -783,7 +783,7 @@ func TestConfigSanityDataDB(t *testing.T) { Replicate: true, }, } - expected = "Replicate connections required by: " + expected = "replicate connections required by: " if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -798,7 +798,7 @@ func TestConfigSanityAPIer(t *testing.T) { t.Error(err) } cfg.apier.AttributeSConns = []string{"test"} - expected := " Connection with id: not defined" + expected := " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -810,7 +810,7 @@ func TestConfigSanityAPIer(t *testing.T) { t.Error(err) } cfg.apier.SchedulerConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -826,7 +826,7 @@ func TestConfigSanityDispatcher(t *testing.T) { t.Error(err) } cfg.dispatcherSCfg.AttributeSConns = []string{"test"} - expected := " Connection with id: not defined" + expected := " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -854,7 +854,7 @@ func TestConfigSanityFilterS(t *testing.T) { t.Error(err) } cfg.filterSCfg.StatSConns = []string{"test"} - expected := " Connection with id: not defined" + expected := " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -866,7 +866,7 @@ func TestConfigSanityFilterS(t *testing.T) { t.Error(err) } cfg.filterSCfg.ResourceSConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) } @@ -878,7 +878,7 @@ func TestConfigSanityFilterS(t *testing.T) { t.Error(err) } cfg.filterSCfg.RALsConns = []string{"test"} - expected = " Connection with id: not defined" + expected = " connection with id: not defined" if err := cfg.checkConfigSanity(); err == nil || err.Error() != expected { t.Errorf("Expecting: %+q received: %+q", expected, err) }