As part of the 2.8 release QA efforts, a test framework was written capable of simulating yielding behavior during query plan stages. However, the amount of work necessary to write full tests for each of the plan stages was deemed to be too high for the 2.8 cycle. This test framework should be reinvestigated and the tests themselves extended as part of a later development cycle.
Currently, neither the tests nor the framework has been committed, and only the IndexScan, Delete, and Update stages have tests written. (#TODO: attach relevant files.) CollectionScan is partially written. Tests should be written for the rest of the stages.
Right now, the assertions are fairly weak as we do not make guarantees on how race conditions will be resolved. For example, a document inserted during a find that matches the match expression given by the find may or may not be included in the results of the find – both cases are considered correct. Strengthening the assertions that check the results of the find would be a good choice, which can be done based on document oids as opposed to result count, without necessarily forcing any guarantees.