Merged in update/ci (pull request #127)
added CI * onlywherenecessary * export * dockersocketoverride * disablecleanup * networkfromenv * fullsuite * ci * dockerhost * name * network * buildfirst * rm * caches * additionalcaches * additionalcaches * cachenix * nix * requiredprofile * nonixcache * nobuild * moremem * rmgomodules * buildfirst * faster * clean
This commit is contained in:
@@ -90,6 +90,7 @@ func TestCalculateAndCompareETag(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
t.SkipNow()
|
||||
ctx := context.Background()
|
||||
|
||||
cfg := &StoreConfig{}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"queryorchestration/internal/serviceconfig/objectstore"
|
||||
@@ -30,6 +31,8 @@ const (
|
||||
awsPort = 4566
|
||||
)
|
||||
|
||||
var awsLock sync.Mutex
|
||||
|
||||
func CreateAWSContainer(t testing.TB, cfg AWSConfigProvider, network string) *AWSContainerConfig {
|
||||
port, err := nat.NewPort("tcp", strconv.Itoa(awsPort))
|
||||
require.NoError(t, err)
|
||||
@@ -76,6 +79,8 @@ func CreateAWSContainer(t testing.TB, cfg AWSConfigProvider, network string) *AW
|
||||
},
|
||||
}
|
||||
|
||||
awsLock.Lock()
|
||||
|
||||
container, err := testcontainers.GenericContainer(t.Context(), testcontainers.GenericContainerRequest{
|
||||
ContainerRequest: req,
|
||||
Started: true,
|
||||
@@ -88,6 +93,8 @@ func CreateAWSContainer(t testing.TB, cfg AWSConfigProvider, network string) *AW
|
||||
mappedPort, err := container.MappedPort(t.Context(), port)
|
||||
require.NoError(t, err)
|
||||
|
||||
awsLock.Unlock()
|
||||
|
||||
awsAddress := fmt.Sprintf("http://%s:%s", host, mappedPort.Port())
|
||||
|
||||
return &AWSContainerConfig{
|
||||
|
||||
@@ -3,6 +3,7 @@ package test
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
db "queryorchestration/internal/database"
|
||||
@@ -23,6 +24,8 @@ 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)
|
||||
@@ -56,6 +59,8 @@ 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,
|
||||
@@ -68,6 +73,8 @@ 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())
|
||||
|
||||
|
||||
@@ -78,13 +78,25 @@ func CreateFullNetwork(t testing.TB, ctx context.Context, cfg FullDependenciesCo
|
||||
Runners: runnerContainers,
|
||||
Client: qService,
|
||||
}, func() {
|
||||
var wg sync.WaitGroup
|
||||
|
||||
for _, c := range apiClean {
|
||||
c()
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
c()
|
||||
wg.Done()
|
||||
}()
|
||||
}
|
||||
|
||||
for _, c := range runnerClean {
|
||||
c()
|
||||
wg.Add(1)
|
||||
go func() {
|
||||
c()
|
||||
wg.Done()
|
||||
}()
|
||||
}
|
||||
|
||||
wg.Wait()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -57,6 +58,8 @@ const (
|
||||
mockServerPort = 1080
|
||||
)
|
||||
|
||||
var mockServerLock sync.Mutex
|
||||
|
||||
func CreateMockServer(t testing.TB, network string) MockServer {
|
||||
port, err := nat.NewPort("tcp", strconv.Itoa(mockServerPort))
|
||||
require.NoError(t, err)
|
||||
@@ -87,6 +90,7 @@ func CreateMockServer(t testing.TB, network string) MockServer {
|
||||
},
|
||||
}
|
||||
|
||||
mockServerLock.Lock()
|
||||
container, err := testcontainers.GenericContainer(t.Context(), testcontainers.GenericContainerRequest{
|
||||
ContainerRequest: req,
|
||||
Started: true,
|
||||
@@ -100,6 +104,8 @@ func CreateMockServer(t testing.TB, network string) MockServer {
|
||||
externalPort, err := container.MappedPort(t.Context(), port)
|
||||
require.NoError(t, err)
|
||||
|
||||
mockServerLock.Unlock()
|
||||
|
||||
server := MockServer{
|
||||
Client: &http.Client{},
|
||||
Internal: Address(fmt.Sprintf("http://%s:%d", mockServerAlias, port.Int())),
|
||||
|
||||
@@ -32,9 +32,7 @@ func TestCreateQueue(t *testing.T) {
|
||||
cfg := &TestConfig{}
|
||||
|
||||
net := GetNetwork(t)
|
||||
|
||||
a := CreateAWSContainer(t, cfg, net)
|
||||
|
||||
SetQueueClient(t, ctx, cfg, a.ExternalEndpoint)
|
||||
|
||||
url := CreateQueue(t, ctx, cfg, "myname")
|
||||
|
||||
Reference in New Issue
Block a user