Merged in feature/functestcov (pull request #84)
Function Test Coverage * test * scripts
This commit is contained in:
+5
-12
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/docker/go-connections/nat"
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/testcontainers/testcontainers-go"
|
||||
"github.com/testcontainers/testcontainers-go/wait"
|
||||
)
|
||||
@@ -29,9 +30,7 @@ func CreateAWSContainer(t testing.TB, ctx context.Context, cfg *CreateAWSConfig)
|
||||
alias := "localstack"
|
||||
|
||||
port, err := nat.NewPort("tcp", "4566")
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to create port: %v", err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
req := testcontainers.ContainerRequest{
|
||||
Image: "localstack/localstack:4.1.0",
|
||||
@@ -77,18 +76,12 @@ func CreateAWSContainer(t testing.TB, ctx context.Context, cfg *CreateAWSConfig)
|
||||
ContainerRequest: req,
|
||||
Started: true,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to start container: %v", err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
host, err := container.Host(ctx)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to extract host: %v", err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
mappedPort, err := container.MappedPort(ctx, port)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to extract port: %v", err)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
extEndpoint := fmt.Sprintf("http://%s:%s", host, mappedPort.Port())
|
||||
t.Setenv("AWS_ENDPOINT_URL", extEndpoint)
|
||||
|
||||
Reference in New Issue
Block a user