From 164180bca3b2298a412c0084aa58aecd4f9394ed Mon Sep 17 00:00:00 2001 From: andronache Date: Thu, 11 Feb 2021 14:18:52 +0200 Subject: [PATCH] Refactoring code in services --- agents/astagent.go | 4 +-- engine/attributes.go | 7 ++-- engine/chargers.go | 8 ++--- engine/chargers_test.go | 10 ++---- engine/z_attributes_test.go | 51 +++++++++++------------------ general_tests/sessions_race_test.go | 5 ++- services/analyzers.go | 1 + services/asteriskagent.go | 14 ++++---- services/attributes.go | 12 ++----- services/chargers.go | 11 ++----- services/globalvars_test.go | 49 --------------------------- 11 files changed, 44 insertions(+), 128 deletions(-) delete mode 100644 services/globalvars_test.go diff --git a/agents/astagent.go b/agents/astagent.go index 343c61f77..8131b0155 100644 --- a/agents/astagent.go +++ b/agents/astagent.go @@ -55,14 +55,14 @@ const ( // NewAsteriskAgent constructs a new Asterisk Agent func NewAsteriskAgent(cgrCfg *config.CGRConfig, astConnIdx int, - connMgr *engine.ConnManager) (*AsteriskAgent, error) { + connMgr *engine.ConnManager) *AsteriskAgent { sma := &AsteriskAgent{ cgrCfg: cgrCfg, astConnIdx: astConnIdx, connMgr: connMgr, eventsCache: make(map[string]*utils.CGREvent), } - return sma, nil + return sma } // AsteriskAgent used to cominicate with asterisk diff --git a/engine/attributes.go b/engine/attributes.go index eab3acee5..31b20a6a3 100644 --- a/engine/attributes.go +++ b/engine/attributes.go @@ -31,12 +31,12 @@ import ( // NewAttributeService returns a new AttributeService func NewAttributeService(dm *DataManager, filterS *FilterS, - cgrcfg *config.CGRConfig) (*AttributeService, error) { + cgrcfg *config.CGRConfig) *AttributeService { return &AttributeService{ dm: dm, filterS: filterS, cgrcfg: cgrcfg, - }, nil + } } // AttributeService the service for the API @@ -47,10 +47,9 @@ type AttributeService struct { } // Shutdown is called to shutdown the service -func (alS *AttributeService) Shutdown() (err error) { +func (alS *AttributeService) Shutdown() { utils.Logger.Info(fmt.Sprintf("<%s> shutdown initialized", utils.AttributeS)) utils.Logger.Info(fmt.Sprintf("<%s> shutdown complete", utils.AttributeS)) - return } // attributeProfileForEvent returns the matching attribute diff --git a/engine/chargers.go b/engine/chargers.go index 1cfef1a69..5a0333dcb 100644 --- a/engine/chargers.go +++ b/engine/chargers.go @@ -26,10 +26,9 @@ import ( ) func NewChargerService(dm *DataManager, filterS *FilterS, - cfg *config.CGRConfig, connMgr *ConnManager) (*ChargerService, error) { - + cfg *config.CGRConfig, connMgr *ConnManager) *ChargerService { return &ChargerService{dm: dm, filterS: filterS, - cfg: cfg, connMgr: connMgr}, nil + cfg: cfg, connMgr: connMgr} } // ChargerService is performing charging @@ -41,10 +40,9 @@ type ChargerService struct { } // Shutdown is called to shutdown the service -func (cS *ChargerService) Shutdown() (err error) { +func (cS *ChargerService) Shutdown() { utils.Logger.Info(fmt.Sprintf("<%s> shutdown initialized", utils.ChargerS)) utils.Logger.Info(fmt.Sprintf("<%s> shutdown complete", utils.ChargerS)) - return } // matchingChargingProfilesForEvent returns ordered list of matching chargers which are active by the time of the function call diff --git a/engine/chargers_test.go b/engine/chargers_test.go index ac5355b99..dc6bb7823 100755 --- a/engine/chargers_test.go +++ b/engine/chargers_test.go @@ -212,11 +212,8 @@ func TestChargerMatchingChargerProfilesForEvent(t *testing.T) { defaultCfg := config.NewDefaultCGRConfig() data := NewInternalDB(nil, nil, true) dmCharger = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) - chargerSrv, err = NewChargerService(dmCharger, + chargerSrv = NewChargerService(dmCharger, &FilterS{dm: dmCharger, cfg: defaultCfg}, defaultCfg, nil) - if err != nil { - t.Errorf("Error: %+v", err) - } fltrCP1 := &Filter{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, @@ -382,11 +379,8 @@ func TestChargerProcessEvent(t *testing.T) { defaultCfg := config.NewDefaultCGRConfig() data := NewInternalDB(nil, nil, true) dmCharger = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) - chargerSrv, err = NewChargerService(dmCharger, + chargerSrv = NewChargerService(dmCharger, &FilterS{dm: dmCharger, cfg: defaultCfg}, defaultCfg, nil) - if err != nil { - t.Errorf("Error: %+v", err) - } fltrCP1 := &Filter{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, diff --git a/engine/z_attributes_test.go b/engine/z_attributes_test.go index c5e2055b9..0b9c40732 100644 --- a/engine/z_attributes_test.go +++ b/engine/z_attributes_test.go @@ -155,10 +155,7 @@ func TestAttributePopulateAttrService(t *testing.T) { defaultCfg.AttributeSCfg().PrefixIndexedFields = nil data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) - attrService, err = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) - if err != nil { - t.Errorf("Error: %+v", err) - } + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) } func TestAttributeAddFilters(t *testing.T) { @@ -1750,10 +1747,7 @@ func BenchmarkAttributeProcessEventConstant(b *testing.B) { defaultCfg.AttributeSCfg().ProcessRuns = 1 data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) - attrService, err = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) - if err != nil { - b.Errorf("Error: %+v", err) - } + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) //refresh the DM if err := dmAtr.DataDB().Flush(""); err != nil { b.Error(err) @@ -1811,10 +1805,8 @@ func BenchmarkAttributeProcessEventVariable(b *testing.B) { defaultCfg.AttributeSCfg().ProcessRuns = 1 data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) - attrService, err = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) - if err != nil { - b.Errorf("Error: %+v", err) - } + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + //refresh the DM if err := dmAtr.DataDB().Flush(""); err != nil { b.Error(err) @@ -1902,7 +1894,7 @@ func TestProcessAttributeConstant(t *testing.T) { defaultCfg.AttributeSCfg().ProcessRuns = 1 data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_CONSTANT", @@ -1960,7 +1952,7 @@ func TestProcessAttributeVariable(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_VARIABLE", @@ -2021,7 +2013,7 @@ func TestProcessAttributeComposed(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_COMPOSED", @@ -2088,7 +2080,7 @@ func TestProcessAttributeUsageDifference(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_USAGE_DIFF", @@ -2150,7 +2142,7 @@ func TestProcessAttributeSum(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_SUM", @@ -2212,7 +2204,7 @@ func TestProcessAttributeDiff(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_DIFF", @@ -2274,7 +2266,7 @@ func TestProcessAttributeMultiply(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_MULTIPLY", @@ -2336,7 +2328,7 @@ func TestProcessAttributeDivide(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_DIVIDE", @@ -2398,7 +2390,7 @@ func TestProcessAttributeValueExponent(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_VAL_EXP", @@ -2460,7 +2452,7 @@ func TestProcessAttributeUnixTimeStamp(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_UNIX_TIMESTAMP", @@ -2522,7 +2514,7 @@ func TestProcessAttributePrefix(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_PREFIX", @@ -2583,7 +2575,7 @@ func TestProcessAttributeSuffix(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_SUFFIX", @@ -2647,10 +2639,7 @@ func TestAttributeIndexSelectsFalse(t *testing.T) { defaultCfg.AttributeSCfg().IndexedSelects = false data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) - attrService, err = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) - if err != nil { - t.Errorf("Error: %+v", err) - } + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) //refresh the DM if err := dmAtr.DataDB().Flush(""); err != nil { @@ -2707,7 +2696,7 @@ func TestProcessAttributeWithSameWeight(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_1", @@ -2781,7 +2770,7 @@ func TestAttributeMultipleProcessWithFiltersExists(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf1Exists := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_1_EXISTS", @@ -2875,7 +2864,7 @@ func TestAttributeMultipleProcessWithFiltersNotEmpty(t *testing.T) { data := NewInternalDB(nil, nil, true) dmAtr = NewDataManager(data, config.CgrConfig().CacheCfg(), nil) Cache.Clear(nil) - attrService, _ = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) + attrService = NewAttributeService(dmAtr, &FilterS{dm: dmAtr, cfg: defaultCfg}, defaultCfg) attrPrf1NotEmpty := &AttributeProfile{ Tenant: config.CgrConfig().GeneralCfg().DefaultTenant, ID: "ATTR_1_NOTEMPTY", diff --git a/general_tests/sessions_race_test.go b/general_tests/sessions_race_test.go index 49cd75f84..3b4ad942f 100644 --- a/general_tests/sessions_race_test.go +++ b/general_tests/sessions_race_test.go @@ -102,9 +102,8 @@ func TestSessionSRace(t *testing.T) { filterS = engine.NewFilterS(cfg, connMgr, dm) // chargerS - if chrS, err = engine.NewChargerService(dm, filterS, cfg, connMgr); err != nil { - t.Fatal(err) - } + chrS = engine.NewChargerService(dm, filterS, cfg, connMgr) + chargerSChan <- v1.NewChargerSv1(chrS) // addCharger diff --git a/services/analyzers.go b/services/analyzers.go index 2d84b66b0..b0eeca095 100644 --- a/services/analyzers.go +++ b/services/analyzers.go @@ -83,6 +83,7 @@ func (anz *AnalyzerService) Start() (err error) { }(anz.anz) anz.server.SetAnalyzer(anz.anz) anz.rpc = v1.NewAnalyzerSv1(anz.anz) + //separa in propria functie go func() { var fS *engine.FilterS select { diff --git a/services/asteriskagent.go b/services/asteriskagent.go index ac9a0fc3a..7ae03feca 100644 --- a/services/asteriskagent.go +++ b/services/asteriskagent.go @@ -72,10 +72,7 @@ func (ast *AsteriskAgent) Start() (err error) { ast.stopChan = make(chan struct{}) ast.smas = make([]*agents.AsteriskAgent, len(ast.cfg.AsteriskAgentCfg().AsteriskConns)) for connIdx := range ast.cfg.AsteriskAgentCfg().AsteriskConns { // Instantiate connections towards asterisk servers - if ast.smas[connIdx], err = agents.NewAsteriskAgent(ast.cfg, connIdx, ast.connMgr); err != nil { - utils.Logger.Err(fmt.Sprintf("<%s> error: %s!", utils.AsteriskAgent, err)) - return - } + ast.smas[connIdx] = agents.NewAsteriskAgent(ast.cfg, connIdx, ast.connMgr) go listenAndServe(ast.smas[connIdx], ast.stopChan, ast.shdChan) } return @@ -83,14 +80,17 @@ func (ast *AsteriskAgent) Start() (err error) { // Reload handles the change of config func (ast *AsteriskAgent) Reload() (err error) { - if err = ast.Shutdown(); err != nil { - return - } + ast.shutdown() return ast.Start() } // Shutdown stops the service func (ast *AsteriskAgent) Shutdown() (err error) { + ast.shutdown() + return +} + +func (ast *AsteriskAgent) shutdown() { ast.Lock() close(ast.stopChan) ast.smas = nil diff --git a/services/attributes.go b/services/attributes.go index 9afe9a980..d88294f29 100644 --- a/services/attributes.go +++ b/services/attributes.go @@ -82,13 +82,7 @@ func (attrS *AttributeService) Start() (err error) { attrS.Lock() defer attrS.Unlock() - attrS.attrS, err = engine.NewAttributeService(datadb, filterS, attrS.cfg) - if err != nil { - utils.Logger.Crit( - fmt.Sprintf("<%s> Could not init, error: %s", - utils.AttributeS, err.Error())) - return - } + attrS.attrS = engine.NewAttributeService(datadb, filterS, attrS.cfg) utils.Logger.Info(fmt.Sprintf("<%s> starting <%s> subsystem", utils.CoreS, utils.AttributeS)) attrS.rpc = v1.NewAttributeSv1(attrS.attrS) if !attrS.cfg.DispatcherSCfg().Enabled { @@ -107,9 +101,7 @@ func (attrS *AttributeService) Reload() (err error) { func (attrS *AttributeService) Shutdown() (err error) { attrS.Lock() defer attrS.Unlock() - if err = attrS.attrS.Shutdown(); err != nil { - return - } + attrS.attrS.Shutdown() attrS.attrS = nil attrS.rpc = nil <-attrS.connChan diff --git a/services/chargers.go b/services/chargers.go index 32b96232e..631f5b1ed 100644 --- a/services/chargers.go +++ b/services/chargers.go @@ -83,12 +83,7 @@ func (chrS *ChargerService) Start() (err error) { chrS.Lock() defer chrS.Unlock() - if chrS.chrS, err = engine.NewChargerService(datadb, filterS, chrS.cfg, chrS.connMgr); err != nil { - utils.Logger.Crit( - fmt.Sprintf("<%s> Could not init, error: %s", - utils.ChargerS, err.Error())) - return - } + chrS.chrS = engine.NewChargerService(datadb, filterS, chrS.cfg, chrS.connMgr) utils.Logger.Info(fmt.Sprintf("<%s> starting <%s> subsystem", utils.CoreS, utils.ChargerS)) cSv1 := v1.NewChargerSv1(chrS.chrS) if !chrS.cfg.DispatcherSCfg().Enabled { @@ -107,9 +102,7 @@ func (chrS *ChargerService) Reload() (err error) { func (chrS *ChargerService) Shutdown() (err error) { chrS.Lock() defer chrS.Unlock() - if err = chrS.chrS.Shutdown(); err != nil { - return - } + chrS.chrS.Shutdown() chrS.chrS = nil chrS.rpc = nil <-chrS.connChan diff --git a/services/globalvars_test.go b/services/globalvars_test.go deleted file mode 100644 index 738e37047..000000000 --- a/services/globalvars_test.go +++ /dev/null @@ -1,49 +0,0 @@ -/* -Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments -Copyright (C) ITsysCOM GmbH - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see -*/ -package services - -import ( - "reflect" - "testing" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/utils" -) - -func TestGlobalVarS(t *testing.T) { - cfg := config.NewDefaultCGRConfig() - - exp := &GlobalVarS{cfg: cfg} - if gv := NewGlobalVarS(cfg, nil); !reflect.DeepEqual(gv, exp) { - t.Errorf("Expected %+v, received %+v", exp, gv) - } - if exp.ServiceName() != utils.GlobalVarS { - t.Errorf("Unexpected service name %q", exp.ServiceName()) - } - if !exp.ShouldRun() { - t.Errorf("This service should allways run") - } - if !exp.IsRunning() { - t.Errorf("This service needs to be running") - } - cfg.HTTPCfg().ClientOpts[utils.HTTPClientDialTimeoutCfg] = "30as" - - if err := exp.Shutdown(); err != nil { - t.Fatal(err) - } -}