|
This test schedules multi-cursor responses to be received from a mocked-mongot before an aggregation is run. In many cases, the additional response-cursor received is a metadata cursor. The test then sets up mock responses for getMores that it expects mongod to send to the mock. However, because the aggregation sent by the user to mongod doesn't require any use of the metadata, the cursor can be destroyed on mongod after the query is completed, before the getMore for the metadata reaches the network/the mock mongot. This timing issue is made more likely with the addition of pinned-connections; when pinning is enabled, commands for cursors returned from the same initial are serialized because they need to use the same connection, so it's increasingly likely that the user query can be completed (because the cursor containing the actual data is exhausted/getMore'd first) before the metadata cursor's getMore is scheduled.
The result of this is that while assertions around the aggregation still work fine (this is legal behavior and doesn't represent a real bug), the mock-response we scheduled on the mongotmock is found when we tear down the test. As part of the teardown, we assert that no remaining responses are scheduled on the mocks, and this assertion fails.
|