[SERVER-41060] Change query unit tests to not create multiple service contexts Created: 08/May/19 Updated: 29/Oct/23 Resolved: 05/Mar/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Querying |
| Affects Version/s: | 4.1.10 |
| Fix Version/s: | 4.7.0 |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Ian Boros | Assignee: | Ruoxin Xu |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | neweng, qexec-team | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Sprint: | Query 2020-02-24, Query 2020-03-09 |
| Participants: |
| Description |
|
ExpressionContextForTest owns a service context. DocumentSourceMock will create an ExpressionContextForTest in its create() methods. This means that each time a DocumentSourceMock is created, we go through all of the work of creating an entire service context.
At the same time, the AggregationContextFixture inherits from ServiceContextFixture, which already makes a global ServiceContext available. This means that many of the aggregation stage unit tests actually have (at least) two service contexts: one globally and another as part of the ExpressionContextForTest. While there is no immediate bug here, this was responsible for: And also caused a lot of confusion while doing investigations for
The ownership hierarchy should probably changed so that there's just one ServiceContext for the lifetime of the test which is threaded through ExpressionContextForTest. |
| Comments |
| Comment by Githook User [ 06/Mar/20 ] |
|
Author: {'username': 'RuoxinXu', 'name': 'Ruoxin Xu', 'email': 'ruoxin.xu@mongodb.com'}Message: |
| Comment by Githook User [ 05/Mar/20 ] |
|
Author: {'username': 'RuoxinXu', 'name': 'Ruoxin Xu', 'email': 'ruoxin.xu@mongodb.com'}Message: |
| Comment by Githook User [ 05/Mar/20 ] |
|
Author: {'username': 'RuoxinXu', 'name': 'Ruoxin Xu', 'email': 'ruoxin.xu@mongodb.com'}Message: |