From: Jason Dillaman Date: Fri, 4 Dec 2015 15:37:25 +0000 (-0500) Subject: tests: wait for mocked requests to complete X-Git-Tag: v10.0.2~101^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F6800%2Fhead;p=ceph.git tests: wait for mocked requests to complete Fixes: #13969 Signed-off-by: Jason Dillaman --- diff --git a/src/test/librbd/mock/MockImageCtx.h b/src/test/librbd/mock/MockImageCtx.h index 9ded05dd16c6..1e70b1f27cfc 100644 --- a/src/test/librbd/mock/MockImageCtx.h +++ b/src/test/librbd/mock/MockImageCtx.h @@ -49,11 +49,19 @@ struct MockImageCtx { } ~MockImageCtx() { + wait_for_async_requests(); delete image_watcher; delete op_work_queue; delete aio_work_queue; } + void wait_for_async_requests() { + Mutex::Locker async_ops_locker(async_ops_lock); + while (!async_requests.empty()) { + async_requests_cond.Wait(async_ops_lock); + } + } + MOCK_CONST_METHOD1(get_snap_id, librados::snap_t(std::string in_snap_name)); MOCK_CONST_METHOD1(get_snap_info, const SnapInfo*(librados::snap_t)); MOCK_CONST_METHOD2(get_parent_spec, int(librados::snap_t in_snap_id,