diff --git a/general_tests/accountactions_it_test.go b/general_tests/accountactions_it_test.go index 4c44bc388..2cdb726da 100644 --- a/general_tests/accountactions_it_test.go +++ b/general_tests/accountactions_it_test.go @@ -40,7 +40,6 @@ var ( accPrfCfg *config.CGRConfig accSRPC *birpc.Client accPrfConfigDIR string //run tests for specific configuration - err error sTestsAccPrf = []func(t *testing.T){ testAccActionsInitCfg, diff --git a/general_tests/all_cfg_rld_it_test.go b/general_tests/all_cfg_rld_it_test.go index bd1c02488..bbea5852f 100644 --- a/general_tests/all_cfg_rld_it_test.go +++ b/general_tests/all_cfg_rld_it_test.go @@ -68,6 +68,7 @@ func TestRldCfg(t *testing.T) { func testCfgLoadConfig(t *testing.T) { testCfgPath = path.Join(*utils.DataDir, "conf", "samples", testCfgDir) + var err error if testCfg, err = config.NewCGRConfigFromPath(context.Background(), testCfgPath); err != nil { t.Error(err) } diff --git a/general_tests/all_sections_cfg_rld_it_test.go b/general_tests/all_sections_cfg_rld_it_test.go index 8f012a5d3..c051cd624 100644 --- a/general_tests/all_sections_cfg_rld_it_test.go +++ b/general_tests/all_sections_cfg_rld_it_test.go @@ -104,6 +104,7 @@ func TestSectChange(t *testing.T) { func testSectLoadConfig(t *testing.T) { testSectCfgPath = path.Join(*utils.DataDir, "conf", "samples", testSectCfgDir) + var err error if testSectCfg, err = config.NewCGRConfigFromPath(context.Background(), testSectCfgPath); err != nil { t.Error(err) } diff --git a/general_tests/analyzers_doc_it_test.go b/general_tests/analyzers_doc_it_test.go index 3dbdac864..faacedcbf 100644 --- a/general_tests/analyzers_doc_it_test.go +++ b/general_tests/analyzers_doc_it_test.go @@ -129,7 +129,7 @@ func testAnzDocKillEngine(t *testing.T) { func testAnzDocCoreSStatus(t *testing.T) { var status map[string]any - if err = anzDocRPC.Call(context.Background(), utils.CoreSv1Status, utils.TenantWithAPIOpts{}, &status); err != nil { + if err := anzDocRPC.Call(context.Background(), utils.CoreSv1Status, utils.TenantWithAPIOpts{}, &status); err != nil { return } } diff --git a/general_tests/cdrs_it_test.go b/general_tests/cdrs_it_test.go index ca95be922..ae4e0ff96 100644 --- a/general_tests/cdrs_it_test.go +++ b/general_tests/cdrs_it_test.go @@ -117,6 +117,7 @@ func testCDRsStartEngine(t *testing.T) { // Connect rpc client to rater func testCDRsRpcConn(t *testing.T) { + var err error cdrsRpc, err = engine.NewRPCClient(cdrsCfg.ListenCfg(), *utils.Encoding) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal("Could not connect to rater: ", err.Error()) diff --git a/general_tests/cdrs_post_failover_it_test.go b/general_tests/cdrs_post_failover_it_test.go index c5fd38b99..330f78423 100644 --- a/general_tests/cdrs_post_failover_it_test.go +++ b/general_tests/cdrs_post_failover_it_test.go @@ -105,6 +105,7 @@ func testCDRsPostFailoverStartEngine(t *testing.T) { // Connect rpc client to rater func testCDRsPostFailoverRpcConn(t *testing.T) { + var err error cdrsPostFailRpc, err = engine.NewRPCClient(cdrsPostFailCfg.ListenCfg(), *utils.Encoding) // We connect over JSON so we can also troubleshoot if needed if err != nil { t.Fatal("Could not connect to rater: ", err.Error()) @@ -221,7 +222,7 @@ func testCDRsPostFailoverToFile(t *testing.T) { } func testCDRsPostFailoverKillEngine(t *testing.T) { - if err = os.RemoveAll(cdrsPostFailCfg.EFsCfg().FailedPostsDir); err != nil { + if err := os.RemoveAll(cdrsPostFailCfg.EFsCfg().FailedPostsDir); err != nil { t.Error(err) } if err := engine.KillEngine(*utils.WaitRater); err != nil { diff --git a/general_tests/dataconverter_it_test.go b/general_tests/dataconverter_it_test.go index 8ee441d80..8ec03a6ab 100644 --- a/general_tests/dataconverter_it_test.go +++ b/general_tests/dataconverter_it_test.go @@ -105,6 +105,7 @@ func testDCStartEngine(t *testing.T) { } func testDCRpcConn(t *testing.T) { + var err error dcRPC, err = engine.NewRPCClient(dcCfg.ListenCfg(), *utils.Encoding) if err != nil { t.Fatal("Could not connect to rater: ", err.Error()) diff --git a/general_tests/export_it_test.go b/general_tests/export_it_test.go index 33801937b..58061cead 100644 --- a/general_tests/export_it_test.go +++ b/general_tests/export_it_test.go @@ -107,6 +107,7 @@ func testExpCreateFiles(t *testing.T) { func testExpLoadConfig(t *testing.T) { expCfgPath = path.Join(*utils.DataDir, "conf", "samples", expCfgDir) + var err error if expCfg, err = config.NewCGRConfigFromPath(context.Background(), expCfgPath); err != nil { t.Error(err) } diff --git a/general_tests/gocs_it_test.go b/general_tests/gocs_it_test.go index 8a9250e3e..a4751325d 100644 --- a/general_tests/gocs_it_test.go +++ b/general_tests/gocs_it_test.go @@ -70,6 +70,7 @@ func TestGOCSIT(t *testing.T) { // Init Config func testGOCSInitCfg(t *testing.T) { + var err error auCfgPath = path.Join(*utils.DataDir, "conf", "samples", "gocs", "au_site") if auCfg, err = config.NewCGRConfigFromPath(context.Background(), auCfgPath); err != nil { t.Fatal(err) @@ -108,6 +109,7 @@ func testGOCSFlushDBs(t *testing.T) { // Start CGR Engine func testGOCSStartEngine(t *testing.T) { + var err error if usEngine, err = engine.StopStartEngine(usCfgPath, *utils.WaitRater); err != nil { t.Fatal(err) } @@ -123,6 +125,7 @@ func testGOCSStartEngine(t *testing.T) { // Connect rpc client to rater func testGOCSApierRpcConn(t *testing.T) { + var err error if auRPC, err = engine.NewRPCClient(auCfg.ListenCfg(), *utils.Encoding); err != nil { t.Fatal(err) } @@ -616,13 +619,13 @@ func testGOCSStopCgrEngine(t *testing.T) { if err := engine.KillEngine(100); err != nil { t.Error(err) } - if err = auEngine.Process.Kill(); err != nil { + if err := auEngine.Process.Kill(); err != nil { t.Error(err) } - if err = usEngine.Process.Kill(); err != nil { + if err := usEngine.Process.Kill(); err != nil { t.Error(err) } - if err = dspEngine.Process.Kill(); err != nil { + if err := dspEngine.Process.Kill(); err != nil { t.Error(err) } } diff --git a/general_tests/loaders_internal_indexes_it_test.go b/general_tests/loaders_internal_indexes_it_test.go index 455589405..96697265a 100644 --- a/general_tests/loaders_internal_indexes_it_test.go +++ b/general_tests/loaders_internal_indexes_it_test.go @@ -75,6 +75,7 @@ func TestLoadersIDBIdxIt(t *testing.T) { func testLoadersIDBIdxItLoadConfig(t *testing.T) { loadersIDBIdxCfgPath = path.Join(*utils.DataDir, "conf", "samples", loadersIDBIdxCfgDir) + var err error if loadersIDBIdxCfg, err = config.NewCGRConfigFromPath(context.Background(), loadersIDBIdxCfgPath); err != nil { t.Error(err) } diff --git a/general_tests/loadersold2new_it_test.go b/general_tests/loadersold2new_it_test.go index b04b5041d..85272d332 100644 --- a/general_tests/loadersold2new_it_test.go +++ b/general_tests/loadersold2new_it_test.go @@ -78,7 +78,7 @@ func TestLdro2nRtChange(t *testing.T) { func testCreateDirs(t *testing.T) { for _, dir := range testLdro2nDirs { - if err = os.MkdirAll(dir, 0755); err != nil { + if err := os.MkdirAll(dir, 0755); err != nil { t.Fatal(err) } } @@ -86,7 +86,7 @@ func testCreateDirs(t *testing.T) { func testRemoveDirs(t *testing.T) { for _, dir := range testLdro2nDirs { - if err = os.RemoveAll(dir); err != nil { + if err := os.RemoveAll(dir); err != nil { t.Fatal(err) } } @@ -128,12 +128,12 @@ func testLdro2nRtLoadTP(t *testing.T) { "DestinationRates.csv", "RatingPlans.csv", } { - if err = copyFile(filepath.Join(*utils.DataDir, "tariffplans", "oldtutorial2", file), filepath.Join("/tmp/In", file)); err != nil { + if err := copyFile(filepath.Join(*utils.DataDir, "tariffplans", "oldtutorial2", file), filepath.Join("/tmp/In", file)); err != nil { t.Fatal(err) } } time.Sleep(time.Second) - if err = copyFile(filepath.Join(*utils.DataDir, "tariffplans", "oldtutorial2", "RatingProfiles.csv"), filepath.Join("/tmp/In", "RatingProfiles.csv")); err != nil { + if err := copyFile(filepath.Join(*utils.DataDir, "tariffplans", "oldtutorial2", "RatingProfiles.csv"), filepath.Join("/tmp/In", "RatingProfiles.csv")); err != nil { t.Fatal(err) } time.Sleep(time.Second) diff --git a/general_tests/redis_cluster_it_test.go b/general_tests/redis_cluster_it_test.go index 82e4d754b..3d5f8236d 100644 --- a/general_tests/redis_cluster_it_test.go +++ b/general_tests/redis_cluster_it_test.go @@ -225,7 +225,7 @@ func testClsrSetGetAttribute(t *testing.T) { func testClsrStopMaster(t *testing.T) { path := fmt.Sprintf(clsrNodeCfgPath, 3) - if err = clsrNodes[path].Process.Kill(); err != nil { + if err := clsrNodes[path].Process.Kill(); err != nil { t.Fatal(err) } time.Sleep(time.Second) diff --git a/general_tests/rpcexp_opts_it_test.go b/general_tests/rpcexp_opts_it_test.go index a9cb1eed2..e866732ba 100644 --- a/general_tests/rpcexp_opts_it_test.go +++ b/general_tests/rpcexp_opts_it_test.go @@ -112,7 +112,7 @@ func testRPCExpStartEngine(t *testing.T) { if _, err := engine.StopStartEngine(ng1CfgPath, rrDelay); err != nil { t.Fatal(err) } - if _, err = engine.StartEngine(ng2CfgPath, rrDelay); err != nil { + if _, err := engine.StartEngine(ng2CfgPath, rrDelay); err != nil { t.Fatal(err) } } diff --git a/general_tests/session2_it_test.go b/general_tests/session2_it_test.go index 29e3765be..640cb3485 100644 --- a/general_tests/session2_it_test.go +++ b/general_tests/session2_it_test.go @@ -78,6 +78,7 @@ func TestSes2It(t *testing.T) { func testSes2ItLoadConfig(t *testing.T) { ses2CfgPath = path.Join(*utils.DataDir, "conf", "samples", ses2CfgDir) + var err error if ses2Cfg, err = config.NewCGRConfigFromPath(context.Background(), ses2CfgPath); err != nil { t.Error(err) } diff --git a/general_tests/session_graceful_shutdown_it_test.go b/general_tests/session_graceful_shutdown_it_test.go index 823f21d71..350a08d69 100644 --- a/general_tests/session_graceful_shutdown_it_test.go +++ b/general_tests/session_graceful_shutdown_it_test.go @@ -85,6 +85,7 @@ func TestSessionSRplcGracefulShutdown(t *testing.T) { // Init Config func testSessionSRplcInitCfg(t *testing.T) { + var err error smgRplcCfgPath1 = path.Join(*utils.DataDir, "conf", "samples", "sessions_replication", smgRplcCfgDIR1) if smgRplCfg1, err = config.NewCGRConfigFromPath(context.Background(), smgRplcCfgPath1); err != nil { t.Fatal(err) @@ -107,6 +108,7 @@ func testSessionSRplcFlushDBs(t *testing.T) { // Start CGR Engine func testSessionSRplcStartEngine(t *testing.T) { + var err error if _, err = engine.StopStartEngine(smgRplcCfgPath1, *utils.WaitRater); err != nil { t.Fatal(err) } @@ -118,6 +120,7 @@ func testSessionSRplcStartEngine(t *testing.T) { // Connect rpc client to rater func testSessionSRplcApierRpcConn(t *testing.T) { + var err error if smgRplcRPC1, err = engine.NewRPCClient(smgRplCfg1.ListenCfg(), *utils.Encoding); err != nil { t.Fatal(err) } diff --git a/general_tests/shared_client_lock_it_test.go b/general_tests/shared_client_lock_it_test.go index 8883a8339..177fe130c 100644 --- a/general_tests/shared_client_lock_it_test.go +++ b/general_tests/shared_client_lock_it_test.go @@ -196,7 +196,7 @@ func testSharedClientLockCDRsProcessEvent(t *testing.T) { }, } var reply string - err = clntLockRPC.Call(context.Background(), utils.CDRsV1ProcessEvent, argsEv, &reply) + err := clntLockRPC.Call(context.Background(), utils.CDRsV1ProcessEvent, argsEv, &reply) if err == nil || !strings.Contains(err.Error(), "use of closed network connection") { t.Error("Unexpected error returned", err) } diff --git a/general_tests/twoengines_it_test.go b/general_tests/twoengines_it_test.go index 1df460a8e..97a22b4e8 100644 --- a/general_tests/twoengines_it_test.go +++ b/general_tests/twoengines_it_test.go @@ -65,6 +65,7 @@ func TestTwoEngines(t *testing.T) { } func testTwoEnginesInitConfig(t *testing.T) { + var err error engineOneCfgPath = path.Join(*utils.DataDir, "conf", "samples", "twoengines", "engine1") if engineOneCfg, err = config.NewCGRConfigFromPath(context.Background(), engineOneCfgPath); err != nil { t.Fatal(err)