]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/test/rbd_mirror/test_mock_LeaderWatcher.cc
update sources to v12.1.0
[ceph.git] / ceph / src / test / rbd_mirror / test_mock_LeaderWatcher.cc
index bb8935193b39e5317978dab3e91ddbb8cf2cc776..2f458e6ad6411ddd5713193a3e2b356329cae104 100644 (file)
@@ -50,6 +50,7 @@ struct MockManagedLock {
   MOCK_CONST_METHOD0(is_shutdown, bool());
 
   MOCK_CONST_METHOD0(is_state_post_acquiring, bool());
+  MOCK_CONST_METHOD0(is_state_pre_releasing, bool());
   MOCK_CONST_METHOD0(is_state_locked, bool());
 };
 
@@ -147,6 +148,10 @@ struct ManagedLock<MockTestImageCtx> {
     return MockManagedLock::get_instance().is_state_post_acquiring();
   }
 
+  bool is_state_pre_releasing() const {
+    return MockManagedLock::get_instance().is_state_pre_releasing();
+  }
+
   bool is_state_locked() const {
     return MockManagedLock::get_instance().is_state_locked();
   }
@@ -264,6 +269,8 @@ struct MockListener : public LeaderWatcher<librbd::MockTestImageCtx>::Listener {
 
   MOCK_METHOD1(post_acquire_handler, void(Context *));
   MOCK_METHOD1(pre_release_handler, void(Context *));
+
+  MOCK_METHOD1(update_leader_handler, void(const std::string &));
 };
 
 MockListener *MockListener::s_instance = nullptr;
@@ -371,6 +378,8 @@ public:
       .Times(AtLeast(0)).WillRepeatedly(Return(false));
     EXPECT_CALL(mock_managed_lock, is_state_locked())
       .Times(AtLeast(0)).WillRepeatedly(Return(false));
+    EXPECT_CALL(mock_managed_lock, is_state_pre_releasing())
+      .Times(AtLeast(0)).WillRepeatedly(Return(false));
   }
 
   void expect_notify_heartbeat(MockManagedLock &mock_managed_lock,
@@ -627,6 +636,7 @@ TEST_F(TestMockLeaderWatcher, Break) {
   expect_is_shutdown(mock_managed_lock);
   expect_is_leader(mock_managed_lock);
   expect_destroy(mock_managed_lock);
+  EXPECT_CALL(listener, update_leader_handler(_));
 
   InSequence seq;