Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(modules.gcloud): pass as ptr to allow request customization #1972

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/gcloud/bigquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func RunBigQueryContainer(ctx context.Context, opts ...testcontainers.ContainerC
Started: true,
}

settings := applyOptions(req, opts)
settings := applyOptions(&req, opts)

req.Cmd = []string{"--project", settings.ProjectID}

Expand Down
2 changes: 1 addition & 1 deletion modules/gcloud/bigtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func RunBigTableContainer(ctx context.Context, opts ...testcontainers.ContainerC
Started: true,
}

settings := applyOptions(req, opts)
settings := applyOptions(&req, opts)

req.Cmd = []string{
"/bin/sh",
Expand Down
2 changes: 1 addition & 1 deletion modules/gcloud/datastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func RunDatastoreContainer(ctx context.Context, opts ...testcontainers.Container
Started: true,
}

settings := applyOptions(req, opts)
settings := applyOptions(&req, opts)

req.Cmd = []string{
"/bin/sh",
Expand Down
2 changes: 1 addition & 1 deletion modules/gcloud/firestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func RunFirestoreContainer(ctx context.Context, opts ...testcontainers.Container
Started: true,
}

settings := applyOptions(req, opts)
settings := applyOptions(&req, opts)

req.Cmd = []string{
"/bin/sh",
Expand Down
4 changes: 2 additions & 2 deletions modules/gcloud/gcloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ func WithProjectID(projectID string) Option {
}

// applyOptions applies the options to the container request and returns the settings.
func applyOptions(req testcontainers.GenericContainerRequest, opts []testcontainers.ContainerCustomizer) options {
func applyOptions(req *testcontainers.GenericContainerRequest, opts []testcontainers.ContainerCustomizer) options {
settings := defaultOptions()
for _, opt := range opts {
if apply, ok := opt.(Option); ok {
apply(&settings)
}
opt.Customize(&req)
opt.Customize(req)
}

return settings
Expand Down
2 changes: 1 addition & 1 deletion modules/gcloud/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func RunPubsubContainer(ctx context.Context, opts ...testcontainers.ContainerCus
Started: true,
}

settings := applyOptions(req, opts)
settings := applyOptions(&req, opts)

req.Cmd = []string{
"/bin/sh",
Expand Down
2 changes: 1 addition & 1 deletion modules/gcloud/spanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func RunSpannerContainer(ctx context.Context, opts ...testcontainers.ContainerCu
Started: true,
}

settings := applyOptions(req, opts)
settings := applyOptions(&req, opts)

container, err := testcontainers.GenericContainer(ctx, req)
if err != nil {
Expand Down