diff options
author | Benety Goh <benety@mongodb.com> | 2016-12-06 11:39:55 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2016-12-06 13:52:34 -0500 |
commit | 1f9513ef67551db6ea93b8b9e2f40604167f952b (patch) | |
tree | 0f4bc663d92547206a26aa9d1f0dbbd910e63abb /src/mongo/client/fetcher_test.cpp | |
parent | 39d11435c22a8c6ce2c489221102605a9185e815 (diff) | |
download | mongo-1f9513ef67551db6ea93b8b9e2f40604167f952b.tar.gz |
SERVER-27052 fixed FetcherTest::ScheduleButShutdown test case - test should not assume when the task executor's shutdown() function will deliver the cancellation event to the fetcher's callback
Diffstat (limited to 'src/mongo/client/fetcher_test.cpp')
-rw-r--r-- | src/mongo/client/fetcher_test.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/mongo/client/fetcher_test.cpp b/src/mongo/client/fetcher_test.cpp index 2e393dda3ef..00dae071d3a 100644 --- a/src/mongo/client/fetcher_test.cpp +++ b/src/mongo/client/fetcher_test.cpp @@ -365,19 +365,17 @@ TEST_F(FetcherTest, ScheduleButShutdown) { auto net = getNet(); { executor::NetworkInterfaceMock::InNetworkGuard guard(net); - assertRemoteCommandNameEquals("find", net->scheduleSuccessfulResponse(BSON("ok" << 1))); - // Network interface should not deliver mock response to callback - // until runReadyNetworkOperations() is called. + auto noi = net->getNextReadyRequest(); + assertRemoteCommandNameEquals("find", noi->getRequest()); + net->blackHole(noi); } ASSERT_TRUE(fetcher->isActive()); - getExecutor().shutdown(); ASSERT_EQUALS(Fetcher::State::kRunning, fetcher->getState_forTest()); - { - executor::NetworkInterfaceMock::InNetworkGuard guard(net); - net->runReadyNetworkOperations(); - } + getExecutor().shutdown(); + + fetcher->join(); ASSERT_FALSE(fetcher->isActive()); ASSERT_EQUALS(ErrorCodes::CallbackCanceled, status.code()); |