-
-
Notifications
You must be signed in to change notification settings - Fork 292
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: Add container builder member to depend on other Docker resources #832
Conversation
✅ Deploy Preview for testcontainers-dotnet ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
|
||
public Task DisposeAsync() | ||
{ | ||
return _container.DisposeAsync().AsTask(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cristianrgreco @eddumelendez @mdelapenya @kiview Currently, dependent resources are not being removed when the parent container is disposed, as these resources might be shared across different configurations. Ryuk is responsible for cleaning them up.
My idea is to maintain an internal reference counter that increments with every create call. When the reference counter equals 1, we can remove the dependent resources as well (while disposing the parent). WDYT?
A general review would be appreciated. PR contains minor general improvements..
What does this PR do?
This pull request adds the member
DependsOn(IContainer)
to the container builder, allowing it to depend on other containers. Internally, we will create and start the dependent containers (resources) first. The same applies for networks and volumes. Please note that we do not have an overloaded member for network and volume. Instead, we use the equivalent memberWithNetwork(INetwork)
andWithVolumeMount(Ivolume, string)
.Why is it important?
This makes it easier for developers to configure test environments and configurations that depend on other resources. We can also use it internally, for example, the WebDiver container configuration will be much simpler.
Related issues
Follow-ups