Made test DynamoDB endpoint configurable
All checks were successful
ci / build (push) Successful in 5m11s
All checks were successful
ci / build (push) Successful in 5m11s
This commit is contained in:
parent
aae3c419db
commit
40136e3936
|
@ -34,4 +34,5 @@ jobs:
|
|||
go get ./...
|
||||
go test -p 1 ./...
|
||||
env:
|
||||
TEST_DYNAMO_URL: "http://localstack:4566"
|
||||
GOPRIVATE: "github:com/lmika/*"
|
|
@ -31,6 +31,7 @@ jobs:
|
|||
go test -p 1 ./...
|
||||
env:
|
||||
GOPRIVATE: "github:com/lmika/*"
|
||||
TEST_DYNAMO_URL: "http://localstack:4566"
|
||||
|
||||
release-macos:
|
||||
needs: build
|
||||
|
|
|
@ -2,6 +2,7 @@ package testdynamo
|
|||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go-v2/aws"
|
||||
|
@ -28,8 +29,13 @@ func SetupTestTable(t *testing.T, testData []TestData) *dynamodb.Client {
|
|||
config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider("abc", "123", "")))
|
||||
assert.NoError(t, err)
|
||||
|
||||
testDynamoURL, ok := os.LookupEnv("TEST_DYNAMO_URL")
|
||||
if !ok {
|
||||
testDynamoURL = "http://localhost:4566"
|
||||
}
|
||||
|
||||
dynamoClient := dynamodb.NewFromConfig(cfg,
|
||||
dynamodb.WithEndpointResolver(dynamodb.EndpointResolverFromURL("http://localhost:4566")))
|
||||
dynamodb.WithEndpointResolver(dynamodb.EndpointResolverFromURL(testDynamoURL)))
|
||||
|
||||
for _, table := range testData {
|
||||
tableInput := &dynamodb.CreateTableInput{
|
||||
|
|
Loading…
Reference in a new issue