[CSHARP-3878] Make sure DisposableMongoClient has a unique underlying Cluster Created: 23/Sep/21 Updated: 24/Sep/21 Resolved: 24/Sep/21 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Testing |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Task | Priority: | Unknown |
| Reporter: | Robert Stam | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
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:
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.
|
| Comments |
| Comment by Githook User [ 24/Sep/21 ] |
|
Author: {'name': 'rstam', 'email': 'robert@robertstam.org', 'username': 'rstam'}Message: |