The test update_yield1.js is designed to verify that a long-running multi-update yields to a findOne() operation. However, it depends heavily on timing information and has been shown to be flaky when the test runs slowly.
We can test the same behavior in a much more dependable way as follows:
- Start a mongod and configure internalQueryExecYieldIterations so that operations will yield predictably.
- Insert some data and explain a multi-update which would update all of the data.
- Assert that the number of yields reported in the explain execution stats is greater than or equal to some value.