]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: wait for mocked requests to complete 6800/head
authorJason Dillaman <dillaman@redhat.com>
Fri, 4 Dec 2015 15:37:25 +0000 (10:37 -0500)
committerJason Dillaman <dillaman@redhat.com>
Fri, 4 Dec 2015 15:39:15 +0000 (10:39 -0500)
Fixes: #13969
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/test/librbd/mock/MockImageCtx.h

index 9ded05dd16c6849b78510f39b7fc6e49fbfd49a9..1e70b1f27cfcb13c3821d0e73c9923128c0313c8 100644 (file)
@@ -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,