Skip to content

Instantly share code, notes, and snippets.

@oguzhancagliyan
Last active October 6, 2020 06:31
Show Gist options
  • Save oguzhancagliyan/87009c57283679141b445a610e7a4eeb to your computer and use it in GitHub Desktop.
Save oguzhancagliyan/87009c57283679141b445a610e7a4eeb to your computer and use it in GitHub Desktop.
fixture for localstack
public class LocalStackFixture : IAsyncLifetime
{
private readonly TestcontainersContainer _localStackContainer;
public LocalStackFixture()
{
var localStackBuilder = new TestcontainersBuilder<TestcontainersContainer>()
.WithImage("localstack/localstack:0.10.9")
.WithCleanUp(true)
.WithEnvironment("DEFAULT_REGION", "eu-central-1")
.WithEnvironment("SERVICES", "dynamodb,sqs")
.WithEnvironment("DOCKER_HOST", "unix:///var/run/docker.sock")
.WithEnvironment("DEBUG", "1")
.WithPortBinding(4569, 4569)
.WithPortBinding(4564, 4564)
.WithPortBinding(4576,4576);
_localStackContainer = localStackBuilder.Build();
}
public async Task InitializeAsync()
{
await _localStackContainer.StartAsync();
}
public async Task DisposeAsync()
{
await _localStackContainer.StopAsync();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment