-
Type: Task
-
Resolution: Done
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: Testing
-
None
Surprisingly this hasn't happened to us before, but today I wrote a test using a `DisposableMongoClient` that resulted in the rest of the test suite failing.
The new test looked like this:
var clientSettings = DriverTestConfiguration.Client.Settings.Clone(); // make some minor changes to the clientSettings using (var client = DriverTestConfiguration.CreateDisposableClient(clientSettings)) { // the test }
What happened was that the changes made to `clientSettings` were minor enough that they did not result in a new underlying `Cluster` being created. So when the `DisposableMongoClient` was `Disposed` so was the underlying `Cluster`.
But once that happend all other tests that use `DriverTestConfiguration.Client` (which is almost all tests) started failing because that `MongoClient` instance had its `Cluster` disposed out from under it.
The simplest way to make the `ClusterKey` for ` DisposableMongoClient` unique is to instantiate a new `ClusterConfigurator`, wrapping any existing one.