TEST_F(FetcherTest, CompletionFutureReleasesMutexBeforeBecomingReady) {
|
auto fut = [&] {
|
auto scopedFetcher = std::make_shared<Fetcher>(
|
&getExecutor(), source, "scoped", findCmdObj, doNothingCallback);
|
ASSERT_OK(scopedFetcher->schedule());
|
|
auto rejectingExecutor = RejectingExecutor::make();
|
return scopedFetcher->onCompletion().thenRunOn(rejectingExecutor).then([scopedFetcher] {
|
MONGO_UNREACHABLE;
|
});
|
}();
|
|
{
|
// similar to `processNetworkResponse` but without assertions about `fetcher`
|
const BSONObj doc = BSON("_id" << 1);
|
auto response BSON("cursor" << BSON("id" << 0LL << "ns"
|
<< "scoped.coll"
|
<< "firstBatch" << BSON_ARRAY(doc))
|
<< "ok" << 1);
|
|
executor::NetworkInterfaceMock::InNetworkGuard guard(getNet());
|
getNet()->scheduleSuccessfulResponse(response);
|
getNet()->runReadyNetworkOperations();
|
}
|
|
fut.wait();
|
}
|