Merged in feature/timeout (pull request #138)

Remove race conditions from -race in tests

* timeout

* raceconditions

* nobuildgp

* build

* perf
This commit is contained in:
Michael McGuinness
2025-05-12 15:11:50 +00:00
parent b5c30b4af7
commit f5061f53db
9 changed files with 39 additions and 37 deletions
-7
View File
@@ -3,7 +3,6 @@ package test
import (
"fmt"
"strconv"
"sync"
"testing"
db "queryorchestration/internal/database"
@@ -24,8 +23,6 @@ const (
dbPort = 5432
)
var dbLock sync.Mutex
func CreateDB(t testing.TB, cfg serviceconfig.ConfigProvider, network string, dcfg *CreateDatabaseConfig) testcontainers.Container {
port, err := nat.NewPort("tcp", strconv.Itoa(dbPort))
require.NoError(t, err)
@@ -59,8 +56,6 @@ func CreateDB(t testing.TB, cfg serviceconfig.ConfigProvider, network string, dc
},
}
dbLock.Lock()
container, err := testcontainers.GenericContainer(t.Context(), testcontainers.GenericContainerRequest{
ContainerRequest: req,
Started: true,
@@ -73,8 +68,6 @@ func CreateDB(t testing.TB, cfg serviceconfig.ConfigProvider, network string, dc
mappedPort, err := container.MappedPort(t.Context(), port)
require.NoError(t, err)
dbLock.Unlock()
cfg.SetDBHost(host)
cfg.SetDBPort(mappedPort.Int())