-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Request: allow use of already previous test session Docker containers #691
Comments
I'm more than happy to implement this myself and open a PR, but first would need to know if this functionality is something that you'd find OK to be added to gnomock @orlangure |
Hi @devuo, I like the idea! I can already see two scenarios that we might need to support:
We can start with the first option of course and see how it goes, but I would like to eventually support both. What do you think? |
That's great to hear 😀! Do you want me to take a hand at it, or will you implement it? |
If you can, please go ahead. 😼 |
The first step is now merged, and I'll create a new release soon, thanks to @devuo 😻 I really liked the second, much more complex feature mentioned here, I think it would be great to start thinking about it as well. I'll give it a thought in the background, and I hope somebody can offer some help with defining the feature a bit better so we can proceed to actually implementing per-preset cleanups. |
I submitted a first draft of how the reset feature (continuation of reuse) can look like. The naive way is to provide a single cleanup function, that can do any work type ResetFunc func(*Container) error It works good for postgres since there should be an easy way to drop almost everything and restore with When I tried to implement the same thing for type Resetter interface {
Reset(*Container) error
} The advantage is that the The downside is that a single interface will make the @devuo do you have any thoughts on the issue? I think your input is very valuable, because you built the ability to reuse containers, and this feels like the next step in the same direction. Of course if anybody else sees the issue and has something to say about it, please go ahead 😼 |
Hey @orlangure that's great, will give feedback in the next day or two 🙏 |
Context:
Starting Docker containers can take from a few seconds to some minutes depending on the Docker image being used.
The current implementation forcefully kills containers if there is already one running with the same container name. This impedes the ability of setting up a faster test workflow for developers to do so: the re-use of the same container in different test runs.
Proposal:
Allow developers to pass an option like
.WithContainerNameReuse("some-container-name")
(or other some other option name) that would make Gnomock re-use the container with the given name, instead of killing it and starting a new.The text was updated successfully, but these errors were encountered: