[SERVER-47418] setMinimumLoggedSeverity in unittest/log_test.h needs to get cleaned up Created: 08/Apr/20 Updated: 29/Oct/23 Resolved: 16/Apr/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Logging |
| Affects Version/s: | None |
| Fix Version/s: | 4.7.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Gabriel Russell (Inactive) | Assignee: | Billy Donahue |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||
| Sprint: | Service arch 2020-04-20 | ||||||||
| Participants: | |||||||||
| Description |
|
when using setMinimumLoggedSeverity in unittests, the value doesn't get reset after the test and could effect subsequent test. A possible solution would be to return a sort of an ON_BLOCK_EXIT clean up function that would reset the value at the end of the test. |
| Comments |
| Comment by Githook User [ 01/May/20 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: (cherry picked from commit e4794531419bff51da233bc4453db6f99d1809ff) |
| Comment by Githook User [ 15/Apr/20 ] |
|
Author: {'name': 'Billy Donahue', 'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue'}Message: |
| Comment by Billy Donahue [ 14/Apr/20 ] |
|
(I up-prioritized this into my current sprint and fixed it immediately because we had a few BFs that we couldn't debug because of bad MinimumLogSeverity hygiene in unit tests.) |
| Comment by Billy Donahue [ 14/Apr/20 ] |
| Comment by Billy Donahue [ 14/Apr/20 ] |
|
Regarding automatically restoring state after a test run, there's an unbounded list of "state" to be restored, but we could alert on what we can notice. I noticed that time_support_test.cpp changes the process time zone and doesn't put it back, for example. I'd prefer tests to clean up after themselves, and for tests to be correct regardless of launcher's details. We need to audit the tests. To help with that auditing, we might place assertions into the unit test launcher that fail the test if it doesn't clean up after itself. We'd consider a test that exhibits a failure to clean up global state to be a failed test, as it could indicate an important infrastructure bug. Anyway, I also feel the ???MinimumLoggedSeverity functions need work. They have an inconsistent naming convention with some using MinimumLogSeverity and others spelled as MinimumLoggedSeverity, and they should be moved to the mongo::unittest namespace as these free functions are really test helpers defined in the unittest directory. |
| Comment by Sara Williamson [ 13/Apr/20 ] |
|
We may want to consider automatically restoring state after test run by the test runner. |