75f3dd141c
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (actions) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
CI and Release / lint-frontend (push) Has been cancelled
CI and Release / dockerfile-scan (push) Has been cancelled
CI and Release / test-frontend (push) Has been cancelled
CI and Release / lint-verification-agent (push) Has been cancelled
CI and Release / test-verification-agent (push) Has been cancelled
CI and Release / e2e-verification-agent (push) Has been cancelled
CI and Release / test-backend (push) Has been cancelled
CI and Release / build-dev-image (push) Has been cancelled
CI and Release / push-dev-image (push) Has been cancelled
CI and Release / build-image (push) Has been cancelled
CI and Release / build-verification-image (push) Has been cancelled
CI and Release / determine-version (push) Has been cancelled
CI and Release / push-image (push) Has been cancelled
CI and Release / push-verification-image (12) (push) Has been cancelled
CI and Release / lint-backend (push) Has been cancelled
CI and Release / push-verification-image (17) (push) Has been cancelled
CI and Release / push-verification-image (18) (push) Has been cancelled
CI and Release / release (push) Has been cancelled
CI and Release / publish-helm-chart (push) Has been cancelled
CI and Release / push-verification-image (13) (push) Has been cancelled
CI and Release / push-verification-image (14) (push) Has been cancelled
CI and Release / push-verification-image (15) (push) Has been cancelled
CI and Release / push-verification-image (16) (push) Has been cancelled
38 lines
1021 B
Go
38 lines
1021 B
Go
package containers
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/testcontainers/testcontainers-go"
|
|
"github.com/testcontainers/testcontainers-go/wait"
|
|
)
|
|
|
|
// Credentials baked into every test MinIO container (the S3-compatible backend).
|
|
const (
|
|
MinioRootUser = "testuser"
|
|
MinioRootPassword = "testpassword"
|
|
MinioRegion = "us-east-1"
|
|
)
|
|
|
|
const minioPort = "9000/tcp"
|
|
|
|
// StartMinio's container starts empty: the caller creates whatever bucket it needs against the
|
|
// returned endpoint, or for failure-path tests points at a missing one.
|
|
func StartMinio(t *testing.T) Endpoint {
|
|
t.Helper()
|
|
|
|
req := testcontainers.ContainerRequest{
|
|
Image: "minio/minio:latest",
|
|
ExposedPorts: []string{minioPort},
|
|
Env: map[string]string{
|
|
"MINIO_ROOT_USER": MinioRootUser,
|
|
"MINIO_ROOT_PASSWORD": MinioRootPassword,
|
|
},
|
|
Cmd: []string{"server", "/data"},
|
|
WaitingFor: wait.ForHTTP("/minio/health/live").WithPort(minioPort).WithStartupTimeout(120 * time.Second),
|
|
}
|
|
|
|
return start(t, req, minioPort)
|
|
}
|