mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Optimize and fix unstable tests
Revise backup loop tests to not rely on time.Sleep anymore and remove unused fields from them. Removed 3ns TTL from tpreader test dataDB configuration that caused in- consistent results. Ensure connManager cache is reloaded in filter tests. Before they could cause deadlocks. Remove redundant inits, global vars and setup tests for debit and accounts tests. Optimize some analyzers tests.
This commit is contained in:
committed by
Dan Christian Bogos
parent
04bff19ced
commit
2c1a90c9c6
@@ -74,6 +74,14 @@ func newRPCClient(cfg *config.ListenCfg) (c *birpc.Client, err error) {
|
||||
|
||||
// Test start here
|
||||
func TestAnalyzerSIT(t *testing.T) {
|
||||
switch *utils.DBType {
|
||||
case utils.MetaMongo:
|
||||
case utils.MetaInternal, utils.MetaMySQL, utils.MetaPostgres:
|
||||
t.SkipNow()
|
||||
default:
|
||||
t.Fatal("unsupported dbtype value")
|
||||
}
|
||||
|
||||
for _, stest := range sTestsAlsPrf {
|
||||
t.Run("TestAnalyzerSIT", stest)
|
||||
}
|
||||
@@ -138,7 +146,6 @@ func testAnalyzerSLoadTarrifPlans(t *testing.T) {
|
||||
} else if reply != utils.OK {
|
||||
t.Error("Unexpected reply returned", reply)
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
func testAnalyzerSChargerSv1ProcessEvent(t *testing.T) {
|
||||
|
||||
@@ -86,7 +86,7 @@ func TestNewServerCodec(t *testing.T) {
|
||||
if err = codec.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
runtime.Gosched()
|
||||
if cnt, err := anz.db.DocCount(); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -150,7 +150,7 @@ func TestNewBiRPCCodec(t *testing.T) {
|
||||
if err = codec.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
time.Sleep(15 * time.Millisecond)
|
||||
runtime.Gosched()
|
||||
if cnt, err := anz.db.DocCount(); err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -212,7 +212,7 @@ func TestNewBiRPCCodec2(t *testing.T) {
|
||||
if err = codec.Close(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
time.Sleep(200 * time.Millisecond)
|
||||
time.Sleep(15 * time.Millisecond)
|
||||
runtime.Gosched()
|
||||
if cnt, err := anz.db.DocCount(); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
@@ -53,7 +53,7 @@ func TestNewAnalyzeConnector(t *testing.T) {
|
||||
if err = rpc.Call(context.Background(), utils.CoreSv1Ping, "args", "reply"); err == nil || err.Error() != "error" {
|
||||
t.Errorf("Expected 'error' received %v", err)
|
||||
}
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
time.Sleep(15 * time.Millisecond)
|
||||
runtime.Gosched()
|
||||
if cnt, err := anz.db.DocCount(); err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user