diff --git a/internal/database/mariadb/issue_test.go b/internal/database/mariadb/issue_test.go index b56db30..1b18eae 100644 --- a/internal/database/mariadb/issue_test.go +++ b/internal/database/mariadb/issue_test.go @@ -4,6 +4,8 @@ package mariadb_test import ( + "time" + "github.com/cloudoperators/heureka/internal/database/mariadb" "github.com/cloudoperators/heureka/internal/database/mariadb/test" "github.com/cloudoperators/heureka/internal/entity" @@ -21,6 +23,9 @@ var _ = Describe("Issue", Label("database", "Issue"), func() { var db *mariadb.SqlDatabase var seeder *test.DatabaseSeeder BeforeEach(func() { + // This sleep suppresses a potential racing condition which triggers test failures. + time.Sleep(3 * time.Second) + var err error db = dbm.NewTestSchema() seeder, err = test.NewDatabaseSeeder(dbm.DbConfig()) diff --git a/internal/e2e/activity_query_test.go b/internal/e2e/activity_query_test.go index af6ed05..ce9df42 100644 --- a/internal/e2e/activity_query_test.go +++ b/internal/e2e/activity_query_test.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "os" + "time" "github.com/cloudoperators/heureka/internal/entity" testentity "github.com/cloudoperators/heureka/internal/entity/test" @@ -31,6 +32,9 @@ var _ = Describe("Getting Activities via API", Label("e2e", "Activity"), func() var cfg util.Config BeforeEach(func() { + // This sleep suppresses a potential racing condition which triggers test failures. + time.Sleep(3 * time.Second) + var err error _ = dbm.NewTestSchema() seeder, err = test.NewDatabaseSeeder(dbm.DbConfig()) @@ -133,6 +137,7 @@ var _ = Describe("Getting Activities via API", Label("e2e", "Activity"), func() req.Var("after", "0") req.Header.Set("Cache-Control", "no-cache") + ctx := context.Background() err = client.Run(ctx, req, &respData) diff --git a/internal/e2e/component_instance_query_test.go b/internal/e2e/component_instance_query_test.go index 68eed09..ea51c2f 100644 --- a/internal/e2e/component_instance_query_test.go +++ b/internal/e2e/component_instance_query_test.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "os" + "time" "github.com/cloudoperators/heureka/internal/entity" testentity "github.com/cloudoperators/heureka/internal/entity/test" @@ -31,6 +32,9 @@ var _ = Describe("Getting ComponentInstances via API", Label("e2e", "ComponentIn var cfg util.Config BeforeEach(func() { + // This sleep suppresses a potential racing condition which triggers test failures. + time.Sleep(3 * time.Second) + var err error _ = dbm.NewTestSchema() seeder, err = test.NewDatabaseSeeder(dbm.DbConfig()) @@ -135,6 +139,7 @@ var _ = Describe("Getting ComponentInstances via API", Label("e2e", "ComponentIn req.Var("after", "0") req.Header.Set("Cache-Control", "no-cache") + ctx := context.Background() err = client.Run(ctx, req, &respData) diff --git a/internal/e2e/component_query_test.go b/internal/e2e/component_query_test.go index 0837ed4..16f6342 100644 --- a/internal/e2e/component_query_test.go +++ b/internal/e2e/component_query_test.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "os" + "time" "github.com/cloudoperators/heureka/internal/entity" testentity "github.com/cloudoperators/heureka/internal/entity/test" @@ -32,6 +33,9 @@ var _ = Describe("Getting Components via API", Label("e2e", "Components"), func( var cfg util.Config BeforeEach(func() { + // This sleep suppresses a potential racing condition which triggers test failures. + time.Sleep(3 * time.Second) + var err error _ = dbm.NewTestSchema() seeder, err = test.NewDatabaseSeeder(dbm.DbConfig()) @@ -136,6 +140,7 @@ var _ = Describe("Getting Components via API", Label("e2e", "Components"), func( req.Var("after", "0") req.Header.Set("Cache-Control", "no-cache") + ctx := context.Background() err = client.Run(ctx, req, &respData) diff --git a/internal/e2e/component_version_query_test.go b/internal/e2e/component_version_query_test.go index 92fa8dd..cf29d47 100644 --- a/internal/e2e/component_version_query_test.go +++ b/internal/e2e/component_version_query_test.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "os" + "time" "github.com/cloudoperators/heureka/internal/entity" testentity "github.com/cloudoperators/heureka/internal/entity/test" @@ -31,6 +32,9 @@ var _ = Describe("Getting ComponentVersions via API", Label("e2e", "ComponentVer var cfg util.Config BeforeEach(func() { + // This sleep suppresses a potential racing condition which triggers test failures. + time.Sleep(3 * time.Second) + var err error _ = dbm.NewTestSchema() seeder, err = test.NewDatabaseSeeder(dbm.DbConfig()) diff --git a/internal/e2e/evidence_query_test.go b/internal/e2e/evidence_query_test.go index 6a2f86b..afdce61 100644 --- a/internal/e2e/evidence_query_test.go +++ b/internal/e2e/evidence_query_test.go @@ -32,6 +32,9 @@ var _ = Describe("Getting Evidences via API", Label("e2e", "Evidences"), func() var cfg util.Config BeforeEach(func() { + // This sleep suppresses a potential racing condition which triggers test failures. + time.Sleep(3 * time.Second) + var err error _ = dbm.NewTestSchema() seeder, err = test.NewDatabaseSeeder(dbm.DbConfig()) diff --git a/internal/e2e/issue_match_change_test.go b/internal/e2e/issue_match_change_test.go index 82bdf99..eea4eab 100644 --- a/internal/e2e/issue_match_change_test.go +++ b/internal/e2e/issue_match_change_test.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "os" + "time" "github.com/cloudoperators/heureka/internal/entity" testentity "github.com/cloudoperators/heureka/internal/entity/test" @@ -28,6 +29,9 @@ var _ = Describe("Getting IssueMatchChanges via API", Label("e2e", "IssueMatchCh var s *server.Server var cfg util.Config BeforeEach(func() { + // This sleep suppresses a potential racing condition which triggers test failures. + time.Sleep(3 * time.Second) + var err error _ = dbm.NewTestSchema() seeder, err = test.NewDatabaseSeeder(dbm.DbConfig()) @@ -132,6 +136,7 @@ var _ = Describe("Getting IssueMatchChanges via API", Label("e2e", "IssueMatchCh req.Var("after", "0") req.Header.Set("Cache-Control", "no-cache") + ctx := context.Background() err = client.Run(ctx, req, &respData) diff --git a/internal/e2e/issue_match_query_test.go b/internal/e2e/issue_match_query_test.go index 84c1606..284d380 100644 --- a/internal/e2e/issue_match_query_test.go +++ b/internal/e2e/issue_match_query_test.go @@ -31,6 +31,9 @@ var _ = Describe("Getting IssueMatches via API", Label("e2e", "IssueMatches"), f var s *server.Server var cfg util.Config BeforeEach(func() { + // This sleep suppresses a potential racing condition which triggers test failures. + time.Sleep(3 * time.Second) + var err error _ = dbm.NewTestSchema() seeder, err = test.NewDatabaseSeeder(dbm.DbConfig()) @@ -134,6 +137,7 @@ var _ = Describe("Getting IssueMatches via API", Label("e2e", "IssueMatches"), f req.Var("after", "0") req.Header.Set("Cache-Control", "no-cache") + ctx := context.Background() err = client.Run(ctx, req, &respData) diff --git a/internal/e2e/service_query_test.go b/internal/e2e/service_query_test.go index 29d3bca..04ef7ab 100644 --- a/internal/e2e/service_query_test.go +++ b/internal/e2e/service_query_test.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "os" + "time" "github.com/cloudoperators/heureka/internal/entity" testentity "github.com/cloudoperators/heureka/internal/entity/test" @@ -31,6 +32,9 @@ var _ = Describe("Getting Services via API", Label("e2e", "Services"), func() { var cfg util.Config BeforeEach(func() { + // This sleep suppresses a potential racing condition which triggers test failures. + time.Sleep(3 * time.Second) + var err error _ = dbm.NewTestSchema() seeder, err = test.NewDatabaseSeeder(dbm.DbConfig()) @@ -39,7 +43,6 @@ var _ = Describe("Getting Services via API", Label("e2e", "Services"), func() { cfg = dbm.DbConfig() cfg.Port = util2.GetRandomFreePort() s = server.NewServer(cfg) - s.NonBlockingStart() }) @@ -174,6 +177,7 @@ var _ = Describe("Getting Services via API", Label("e2e", "Services"), func() { req.Var("after", "0") req.Header.Set("Cache-Control", "no-cache") + ctx := context.Background() err = client.Run(ctx, req, &respData)