-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Server Programmability
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Having common defaults reduces the friction of creating new tests. Ideally you can use one of these fixtures as-is and start testing your component with minimal tweaks.
AI suggested patterns seen in the codebase:
- B1 "writable primary" (re-set coordinator + primary + oplog): 26 files. Minimal example: dbdirectclient_test.cpp:32-46.
- B2 = B1 + StorageInterface::set: 16 files.
- B3 "transaction-capable primary" = B2 + MongoDSessionCatalog + onStepUp (+ sometimes ReadWriteConcernDefaults): 6 files — this is exactly OpObserverTest::setUp (op_observer_impl_test.cpp:237-273), resharding_oplog_session_application_test.cpp:78-99, transaction_participant_test.cpp:289-318, etc.
- B4 "query-stage ctor fixture" (useMockClock + cached opCtx + ExpressionContextBuilder + optional client): 9 files in db/exec/classic/ + classic_stage_builder_test.cpp.
- B5 "majority-read capable": coordinator primary + oplog + SnapshotManager->setCommittedSnapshot(getNextOpTime(...)) inside a WUOW (mock_repl_coord_server_fixture.cpp:74-79, shard_local_test.cpp:54-83, dbcheck_test_fixture.cpp:45-55).
We should also include something for sharding across nodes.
- depends on
-
SERVER-135148 flexible ServiceContextTest initialization
-
- In Code Review
-
- related to
-
SERVER-135726 Unit testing guide documentation
-
- Needs Scheduling
-