Skip to content

Commit

Permalink
fix(modules.gcloud): pass as ptr to allow request customization (#1972)
Browse files Browse the repository at this point in the history
  • Loading branch information
jboyens committed Jan 8, 2024
1 parent 5fae6f3 commit 6a2a8b8
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
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

0 comments on commit 6a2a8b8

Please sign in to comment.