-
Notifications
You must be signed in to change notification settings - Fork 17
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
Reduce Container Usage #106
Comments
Something like this could be a way forward on this: @nscheibe, @philbir, @PascalSenn what do you guys think on this? |
This can be tackled with You can create for example a [CollectionDefinition("MongoContainer")]
public class MongoCollectionFixture : ICollectionFixture<MongoResource> { } and than use [Collection("MongoContainer")]
public class RepositoryTests
{
public RepositoryTests (MongoResource mongoResource) { }
} |
Collection fixture will not allow for parallel test runs. |
Yes, that's right you don't have support for parallel test runs but at least for non-parallel ones that will help you. Here is a sample from xUnit how we could do assembly fixture. |
@glucaci this looks interesting :) It's much simpler then the repo I posted earlier. Still, the question remains if we want to build this into Squadron. We could register the attributes with the package installation and make it very simple for the consumer. Still pondering if we in this case still want to inject the resource just to keep it the same and underneath have a pool that handles the running containers. This would then allow us to either create a container per test/class/assembly. |
At the moment we are using one container per class instance since in most cases we inject a resource as a
IClassFixture
. This can really drag down test performance. In many cases, for the test, it would be enough to create a new database within the container.So the question is should we have some kind of a runtime state and reuse a container instance through multiple resources. I think the main issue why we did not do that was that we could not determine when the last test has be run and we can get rid of the container. Essentially a test run wide init.
The text was updated successfully, but these errors were encountered: