]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/test/rbd_mirror/test_mock_fixture.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / test / rbd_mirror / test_mock_fixture.cc
index d5c6c7caf278744435594577693d1b105122ce07..9e308a63bcb5fce6160609d37459131a59a6a16d 100644 (file)
@@ -22,7 +22,7 @@ void TestMockFixture::SetUpTestCase() {
 
   // use a mock version of the in-memory rados client
   librados_test_stub::set_cluster(boost::shared_ptr<librados::TestCluster>(
-    new librados::MockTestMemCluster()));
+    new ::testing::NiceMock<librados::MockTestMemCluster>()));
   TestFixture::SetUpTestCase();
 }
 
@@ -39,6 +39,8 @@ void TestMockFixture::TearDown() {
 
   ::testing::Mock::VerifyAndClear(mock_rados_client);
   mock_rados_client->default_to_dispatch();
+  dynamic_cast<librados::MockTestMemCluster*>(
+    librados_test_stub::get_cluster().get())->default_to_dispatch();
 
   TestFixture::TearDown();
 }
@@ -50,6 +52,13 @@ void TestMockFixture::expect_test_features(librbd::MockImageCtx &mock_image_ctx)
       })));
 }
 
+librados::MockTestMemCluster& TestMockFixture::get_mock_cluster() {
+  librados::MockTestMemCluster* mock_cluster = dynamic_cast<
+    librados::MockTestMemCluster*>(librados_test_stub::get_cluster().get());
+  ceph_assert(mock_cluster != nullptr);
+  return *mock_cluster;
+}
+
 } // namespace mirror
 } // namespace rbd