diff --git a/dispatchers/replicator_it_test.go b/dispatchers/replicator_it_test.go index 8886ea334..4457bdf0d 100644 --- a/dispatchers/replicator_it_test.go +++ b/dispatchers/replicator_it_test.go @@ -22,7 +22,6 @@ along with this program. If not, see package dispatchers import ( - "errors" "reflect" "testing" @@ -344,7 +343,7 @@ func testDspRplDispatcherProfile(t *testing.T) { allEngine.stopEngine(t) // Get DispatcherProfile - if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetDispatcherProfile, argsDispatcherProfile, &reply); err == nil || !errors.Is(err, utils.ErrDSPProfileNotFound) { + if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetDispatcherProfile, argsDispatcherProfile, &reply); err == nil || err.Error() != utils.ErrDSPProfileNotFound.Error() { t.Errorf("Expecting: %+v, received: %+v, ", utils.ErrDSPProfileNotFound, err) } @@ -359,7 +358,7 @@ func testDspRplDispatcherProfile(t *testing.T) { } // Get DispatcherProfile - if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetDispatcherProfile, argsDispatcherProfile, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetDispatcherProfile, argsDispatcherProfile, &reply); err == nil || err.Error() != utils.ErrDSPProfileNotFound.Error() { t.Errorf("Expecting: %+v, received: %+v, ", utils.ErrDSPProfileNotFound, err) } } @@ -405,7 +404,7 @@ func testDspRplDispatcherHost(t *testing.T) { allEngine.stopEngine(t) // Get DispatcherHost - if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetDispatcherHost, argsDispatcherHost, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetDispatcherHost, argsDispatcherHost, &reply); err == nil || err.Error() != utils.ErrDSPHostNotFound.Error() { t.Errorf("Expecting: %+v, received: %+v, ", utils.ErrDSPHostNotFound, err) } @@ -420,7 +419,7 @@ func testDspRplDispatcherHost(t *testing.T) { } // Get DispatcherHost - if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetDispatcherHost, argsDispatcherHost, &reply); err == nil || err.Error() != utils.ErrNotFound.Error() { + if err := dispEngine.RPC.Call(utils.ReplicatorSv1GetDispatcherHost, argsDispatcherHost, &reply); err == nil || err.Error() != utils.ErrDSPHostNotFound.Error() { t.Errorf("Expecting: %+v, received: %+v, ", utils.ErrDSPHostNotFound, err) } } diff --git a/ers/filexml_it_test.go b/ers/filexml_it_test.go index 614676b0f..5c3fc08d1 100644 --- a/ers/filexml_it_test.go +++ b/ers/filexml_it_test.go @@ -21,11 +21,13 @@ along with this program. If not, see package ers import ( + "bytes" "fmt" "net/rpc" "os" "path" "reflect" + "strings" "testing" "time" @@ -593,11 +595,18 @@ func TestFileXMLProcessEVentError3(t *testing.T) { Mandatory: true, }, } + tmpLogger := utils.Logger + defer func() { + utils.Logger = tmpLogger + }() + var buf bytes.Buffer + utils.Logger = utils.NewStdLoggerWithWriter(&buf, "", 7) eR.Config().Fields[0].ComputePath() errExpect := "Empty source value for fieldID: " - if err := eR.processFile(filePath, fname); err == nil || err.Error() != errExpect { - t.Errorf("Expected %v but received %v", errExpect, err) + eR.processFile(filePath, fname) + if !strings.Contains(buf.String(), errExpect) { + t.Errorf("Expected to contain %s", errExpect) } if err := os.RemoveAll(filePath); err != nil { t.Error(err) diff --git a/general_tests/analyzers_doc_it_test.go b/general_tests/analyzers_doc_it_test.go index 9539f715d..009f18d84 100644 --- a/general_tests/analyzers_doc_it_test.go +++ b/general_tests/analyzers_doc_it_test.go @@ -636,7 +636,7 @@ func testAnzDocQueryWithContentFiltersFilters(t *testing.T) { // Query results for API calls with with an execution duration longer than 30ms if err := anzDocRPC.Call(context.Background(), utils.AnalyzerSv1StringQuery, &analyzers.QueryArgs{ HeaderFilters: "", - ContentFilters: []string{"*gt:~*hdr.RequestDuration:30ms"}, + ContentFilters: []string{"*gt:~*hdr.RequestDuration:10ms"}, }, &result); err != nil { t.Error(err) } else if len(result) == 0 { diff --git a/general_tests/doubleremove_it_test.go b/general_tests/doubleremove_it_test.go index 143cdd8bb..85e44f00c 100644 --- a/general_tests/doubleremove_it_test.go +++ b/general_tests/doubleremove_it_test.go @@ -550,12 +550,12 @@ func testdoubleRemoveDispatcherProfile(t *testing.T) { } if err := doubleRemoveRPC.Call(context.Background(), utils.AdminSv1RemoveDispatcherProfile, &utils.TenantID{Tenant: doubleRemoveTenant, ID: "DSP_PRF"}, &result); err == nil || - err.Error() != utils.ErrDSPProfileNotFound.Error() { + err.Error() != utils.ErrNotFound.Error() { t.Error(err) } if err := doubleRemoveRPC.Call(context.Background(), utils.AdminSv1RemoveDispatcherProfile, &utils.TenantID{Tenant: doubleRemoveTenant, ID: "DSP_PRF"}, &result); err == nil || - err.Error() != utils.ErrDSPProfileNotFound.Error() { + err.Error() != utils.ErrNotFound.Error() { t.Error(err) } // check diff --git a/general_tests/export_it_test.go b/general_tests/export_it_test.go index cafbde4c9..52eae048f 100644 --- a/general_tests/export_it_test.go +++ b/general_tests/export_it_test.go @@ -49,6 +49,7 @@ var ( expRpc *birpc.Client sTestsExp = []func(t *testing.T){ + testExpCreateFiles, testExpLoadConfig, testExpFlushDBs, testExpStartEngine, @@ -93,6 +94,16 @@ func TestExport(t *testing.T) { t.Run(expCfgDir, stest) } } +func testExpCreateFiles(t *testing.T) { + for _, dir := range eeSBlockerFiles { + if err := os.RemoveAll("/tmp/archivesTP"); err != nil { + t.Fatal("Error removing folder: ", dir, err) + } + if err := os.MkdirAll("/tmp/archivesTP", os.ModePerm); err != nil { + t.Fatal("Error creating folder: ", dir, err) + } + } +} func testExpLoadConfig(t *testing.T) { expCfgPath = path.Join(*dataDir, "conf", "samples", expCfgDir)