-
Notifications
You must be signed in to change notification settings - Fork 816
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
Whilst using the DistributedApplicationTestingBuilder for testing, when the AppHost has one or more WithLifetime set to persist containers, an increasing number of separate containers are generated.
The unit tests seem to generate a completely new set of resources, e.g. the first below is when running in the IDE, and the next two correspond to two test runs.
var fixturesDb = builder.AddRedis("fixtures")
.WithPersistence()
.WithDataVolume()
.WithRedisInsight(
cfg =>
{
cfg.WithLifetime(ContainerLifetime.Persistent);
},
"redis-insight")
.WithLifetime(ContainerLifetime.Persistent);Keeping the containers corresponding to a unit test seems to be undesirable - additionally, if I have designed the unit tests to be re-runnable on a persisted database, it would help massively not to spin up those resources again.
Describe the solution you'd like
It would be useful to inform DistributedApplicationTestingBuilder how to override ContainerLifetime.Persistent or reuse the same containers without adding the additional 'test-run' to the resource name.
Additional context
No response
