Merge branch 'main' into flow-events-correlation

# Conflicts:
#	management/server/http/api/openapi.yml
This commit is contained in:
bcmmbaga
2025-04-30 12:54:29 +03:00
170 changed files with 7525 additions and 3289 deletions

View File

@@ -11,6 +11,7 @@ import (
"github.com/testcontainers/testcontainers-go"
"github.com/testcontainers/testcontainers-go/modules/mysql"
"github.com/testcontainers/testcontainers-go/modules/postgres"
testcontainersredis "github.com/testcontainers/testcontainers-go/modules/redis"
"github.com/testcontainers/testcontainers-go/wait"
)
@@ -108,3 +109,28 @@ func CreatePostgresTestContainer() (func(), string, error) {
func noOpCleanup() {
// no-op
}
// CreateRedisTestContainer creates a new Redis container for testing.
func CreateRedisTestContainer() (func(), string, error) {
ctx := context.Background()
redisContainer, err := testcontainersredis.RunContainer(ctx, testcontainers.WithImage("redis:7"))
if err != nil {
return nil, "", err
}
cleanup := func() {
timeoutCtx, cancelFunc := context.WithTimeout(ctx, 1*time.Second)
defer cancelFunc()
if err = redisContainer.Terminate(timeoutCtx); err != nil {
log.WithContext(ctx).Warnf("failed to stop redis container %s: %s", redisContainer.GetContainerID(), err)
}
}
redisURL, err := redisContainer.ConnectionString(ctx)
if err != nil {
return nil, "", err
}
return cleanup, redisURL, nil
}

View File

@@ -14,3 +14,9 @@ func CreateMysqlTestContainer() (func(), string, error) {
// Empty function for MySQL
}, "", nil
}
func CreateRedisTestContainer() (func(), string, error) {
return func() {
// Empty function for Redis
}, "", nil
}