Skip to content

Commit

Permalink
chore: simplify env vars for localstack module (#873)
Browse files Browse the repository at this point in the history
  • Loading branch information
mdelapenya committed Feb 22, 2023
1 parent ddc8e21 commit 2db3a3e
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 31 deletions.
7 changes: 1 addition & 6 deletions modules/localstack/localstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,7 @@ func StartContainer(ctx context.Context, overrideReq OverrideContainerRequestOpt
Binds: []string{fmt.Sprintf("%s:/var/run/docker.sock", testcontainersdocker.ExtractDockerHost(ctx))},
WaitingFor: wait.ForHTTP("/_localstack/health").WithPort("4566/tcp").WithStartupTimeout(120 * time.Second),
ExposedPorts: []string{fmt.Sprintf("%d/tcp", defaultPort)},
Env: map[string]string{
"AWS_ACCESS_KEY_ID": defaultAccessKeyID,
"AWS_SECRET_ACCESS_KEY": defaultSecretAccessKey,
"AWS_SESSION_TOKEN": defaultToken,
"DEFAULT_REGION": defaultRegion,
},
Env: map[string]string{},
}
// }

Expand Down
1 change: 0 additions & 1 deletion modules/localstack/localstack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ func TestStart(t *testing.T) {
ctx,
OverrideContainerRequest(testcontainers.ContainerRequest{
Image: fmt.Sprintf("localstack/localstack:%s", defaultVersion),
Env: map[string]string{"SERVICES": "s3,sqs,kinesis"},
}),
)
// }
Expand Down
13 changes: 1 addition & 12 deletions modules/localstack/v1/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,7 @@ func TestS3(t *testing.T) {
ctx := context.Background()

// localStackCreateContainer {
container, err := localstack.StartContainer(
ctx,
localstack.OverrideContainerRequest(testcontainers.ContainerRequest{
Env: map[string]string{
"AWS_ACCESS_KEY_ID": accesskey,
"AWS_SECRET_ACCESS_KEY": secretkey,
"AWS_SESSION_TOKEN": token,
"AWS_DEFAULT_REGION": region,
"SERVICES": "s3,sqs,cloudwatchlogs,kms",
}},
),
)
container, err := localstack.StartContainer(ctx, localstack.NoopOverrideContainerRequest)
require.Nil(t, err)
// }

Expand Down
13 changes: 1 addition & 12 deletions modules/localstack/v2/s3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,7 @@ func s3Client(ctx context.Context, l *localstack.LocalStackContainer) (*s3.Clien
func TestS3(t *testing.T) {
ctx := context.Background()

container, err := localstack.StartContainer(
ctx,
localstack.OverrideContainerRequest(testcontainers.ContainerRequest{
Env: map[string]string{
"AWS_ACCESS_KEY_ID": accesskey,
"AWS_SECRET_ACCESS_KEY": secretkey,
"AWS_SESSION_TOKEN": token,
"AWS_DEFAULT_REGION": region,
"SERVICES": "s3,sqs,cloudwatchlogs,kms",
}},
),
)
container, err := localstack.StartContainer(ctx, localstack.NoopOverrideContainerRequest)
require.Nil(t, err)

s3Client, err := s3Client(ctx, container)
Expand Down

0 comments on commit 2db3a3e

Please sign in to comment.