-
Notifications
You must be signed in to change notification settings - Fork 26
chore: Replace Testcontainers generic container with DynamoDB module #294
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
chore: Replace Testcontainers generic container with DynamoDB module #294
Conversation
No related issues found. Please ensure there is an open issue related to this change to avoid significant delays or closure. |
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## develop #294 +/- ##
===========================================
- Coverage 69.09% 68.94% -0.15%
===========================================
Files 79 79
Lines 3433 3433
===========================================
- Hits 2372 2367 -5
- Misses 1061 1066 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
@HofmeisterAn thanks for opening the pull request. After some tests, this configuration fails to work properly on a non docker host environment (colima). Docker.DotNet.DockerContainerNotFoundException: Docker API responded with status code=NotFound, response={"message":"No such container: d268d87c9a9908...
Docker.DotNet.DockerContainerNotFoundException
Docker API responded with status code=NotFound, response={"message":"No such container: d268d87c9a9908c9720ff33e5d79aef3a43ce2dcca3c5d6ec62080faee2d9769"}
at Docker.DotNet.ContainerOperations.<>c.<.cctor>b__30_0(HttpStatusCode statusCode, String responseBody)
at Docker.DotNet.DockerClient.HandleIfErrorResponseAsync(HttpStatusCode statusCode, HttpResponseMessage response, IEnumerable`1 handlers)
at Docker.DotNet.DockerClient.MakeRequestAsync(IEnumerable`1 errorHandlers, HttpMethod method, String path, IQueryString queryString, IRequestContent body, IDictionary`2 headers, TimeSpan timeout, CancellationToken token)
at Docker.DotNet.ContainerOperations.InspectContainerAsync(String id, CancellationToken cancellationToken)
at DotNet.Testcontainers.Containers.DockerContainer.<>c__DisplayClass57_0.<<UnsafeStartAsync>g__CheckPortBindingsAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
at DotNet.Testcontainers.Configurations.WaitStrategy.<>c__DisplayClass1_0.<<WaitUntilAsync>g__UntilAsync|0>d.MoveNext()
--- End of stack trace from previous location ---
at DotNet.Testcontainers.Configurations.WaitStrategy.WaitUntilAsync(Func`1 wait, TimeSpan frequency, TimeSpan timeout, CancellationToken ct)
at DotNet.Testcontainers.Containers.DockerContainer.UnsafeStartAsync(CancellationToken ct)
at DotNet.Testcontainers.Containers.DockerContainer.StartAsync(CancellationToken ct)
at DotNet.Testcontainers.Containers.ResourceReaper.GetAndStartNewAsync(Guid sessionId, IDockerEndpointAuthenticationConfiguration dockerEndpointAuthConfig, IImage resourceReaperImage, IMount dockerSocket, Boolean requiresPrivilegedMode, TimeSpan initTimeout, CancellationToken ct)
at DotNet.Testcontainers.Containers.ResourceReaper.GetAndStartNewAsync(Guid sessionId, IDockerEndpointAuthenticationConfiguration dockerEndpointAuthConfig, IImage resourceReaperImage, IMount dockerSocket, Boolean requiresPrivilegedMode, TimeSpan initTimeout, CancellationToken ct)
at DotNet.Testcontainers.Containers.ResourceReaper.GetAndStartDefaultAsync(IDockerEndpointAuthenticationConfiguration dockerEndpointAuthConfig, Boolean isWindowsEngineEnabled, CancellationToken ct)
at DotNet.Testcontainers.Clients.TestcontainersClient.RunAsync(IContainerConfiguration configuration, CancellationToken ct)
at DotNet.Testcontainers.Containers.DockerContainer.UnsafeCreateAsync(CancellationToken ct)
at DotNet.Testcontainers.Containers.DockerContainer.StartAsync(CancellationToken ct)
at AWS.Lambda.Powertools.Idempotency.Tests.Persistence.DynamoDbFixture.InitializeAsync() in /Users/henrigra/work/aws-lambda-powertools-dotnet/libraries/tests/AWS.Lambda.Powertools.Idempotency.Tests/Persistence/DynamoDBFixture.cs:line 41
at Xunit.Sdk.ExceptionAggregator.RunAsync(Func`1 code) in /_/src/xunit.core/Sdk/ExceptionAggregator.cs:line 96
-----
System.NullReferenceException
Object reference not set to an instance of an object.
at AWS.Lambda.Powertools.Idempotency.Tests.Persistence.DynamoDbFixture.Dispose() in /Users/henrigra/work/aws-lambda-powertools-dotnet/libraries/tests/AWS.Lambda.Powertools.Idempotency.Tests/Persistence/DynamoDBFixture.cs:line 86
at Xunit.Sdk.ExceptionAggregator.Run(Action code) in /_/src/xunit.core/Sdk/ExceptionAggregator.cs:line 79 |
Closing this pull request. Something we can review on the future but for now the current approach is working fine for us and this new approach is not working as expected. |
Issue number: -
Summary
Changes
The pull request replaces the Testcontainers' generic container with the official DynamoDB module configuration. This change contains a couple of best practices and leverages the async operations with xUnit.net's
IAsyncLifetime
interface for starting and stopping the container. Instead of using the synchronously blocking memberWait()
, the pull request uses theawait
keyword, following the Task-based Asynchronous Pattern (TAP).User experience
The tests work the same, but the code is much cleaner now. It follows the best practices and recommendations.
Checklist
Please leave checklist items unchecked if they do not apply to your change.
Is this a breaking change?
RFC issue number:
Checklist:
Acknowledgment
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.