-
-
Notifications
You must be signed in to change notification settings - Fork 460
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: use new container request customisation in localstack
- Loading branch information
1 parent
080ea44
commit 376dc26
Showing
6 changed files
with
52 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,43 @@ | ||
package localstack | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/imdario/mergo" | ||
"github.com/testcontainers/testcontainers-go" | ||
) | ||
|
||
// LocalStackContainer represents the LocalStack container type used in the module | ||
type LocalStackContainer struct { | ||
// Container represents the LocalStack container type used in the module | ||
type Container struct { | ||
testcontainers.Container | ||
} | ||
|
||
// LocalStackContainerRequest represents the LocalStack container request type used in the module | ||
// Deprecated: use Container instead | ||
type LocalStackContainer struct { | ||
Container | ||
} | ||
|
||
// ContainerRequest represents the LocalStack container request type used in the module | ||
// to configure the container | ||
type LocalStackContainerRequest struct { | ||
type ContainerRequest struct { | ||
testcontainers.ContainerRequest | ||
} | ||
|
||
// Deprecated: use ContainerRequest instead | ||
type LocalStackContainerRequest struct { | ||
ContainerRequest | ||
} | ||
|
||
// OverrideContainerRequestOption is a type that can be used to configure the Testcontainers container request. | ||
// The passed request will be merged with the default one. | ||
// Deprecated: use testcontainers.CustomizeContainerRequestOption instead | ||
type OverrideContainerRequestOption func(req testcontainers.ContainerRequest) testcontainers.ContainerRequest | ||
|
||
// NoopOverrideContainerRequest returns a helper function that does not override the container request | ||
// Deprecated | ||
var NoopOverrideContainerRequest = func(req testcontainers.ContainerRequest) testcontainers.ContainerRequest { | ||
return req | ||
} | ||
|
||
// OverrideContainerRequest returns a function that can be used to merge the passed container request with one that is created by the LocalStack container | ||
// Deprecated: use testcontainers.CustomizeContainerRequestOption instead | ||
func OverrideContainerRequest(r testcontainers.ContainerRequest) func(req testcontainers.ContainerRequest) testcontainers.ContainerRequest { | ||
return func(req testcontainers.ContainerRequest) testcontainers.ContainerRequest { | ||
if err := mergo.Merge(&req, r, mergo.WithOverride); err != nil { | ||
fmt.Printf("error merging container request %v. Keeping the default one: %v", err, req) | ||
return req | ||
} | ||
|
||
return req | ||
} | ||
return testcontainers.CustomizeContainerRequest(r) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters