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

feat(#493): Add container lifecycle events #743

Merged
merged 2 commits into from
Jan 26, 2023

Conversation

HofmeisterAn
Copy link
Collaborator

What does this PR do?

The PR allows to override the DockerContainer lifecycle members (StartAsync, StopAsync, UnsafeCreateAsync, UnsafeDeleteAsync, UnsafeStartAsync, UnsafeStopAsync). This allows modules to extend or change the default lifecycle behavior to the module requirements. The Unsafe* members are protected and not thread-safe. Their public entrypoints are thread-safe though. This is necessary otherwise we end up with nested locks which are bad. The implementation takes care that the Unsafe* members are called in a thread-safe environment.

The PR adds the events Creating, Starting, Stopping, Created, Started, Stopped to the IContainer interfaces. Developers can subscribe to those events and get notified soon as the container reached the respected state.

Refactors the Guard implementation to support various different use cases. PR makes Guard public.

Why is it important?

To allow developers access to the different resource lifecycles.

Related issues

Breaking Changes

The interface IWaitUntil.Until(IContainer, ILogger) has changed to IWaitUntil.UntilAsync(IContainer). The logger is now available through the Docker resource instance. Providing backwards compatibility is cumbersome. Adding an interface member requires a change anyway. It is easier to simply change the interface name and remove the ILogger arg.

@HofmeisterAn HofmeisterAn added enhancement New feature or request breaking change Causing compatibility issues labels Jan 24, 2023
@netlify
Copy link

netlify bot commented Jan 24, 2023

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 2699650
🔍 Latest deploy log https://app.netlify.com/sites/testcontainers-dotnet/deploys/63d12441fea7fe0008565792
😎 Deploy Preview https://deploy-preview-743--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@HofmeisterAn HofmeisterAn merged commit 478efc5 into develop Jan 26, 2023
@HofmeisterAn HofmeisterAn deleted the feature/add-docker-resource-lifecycles branch January 26, 2023 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Causing compatibility issues enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant