]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/librbd: fix gmock warnings for get_modify_timestamp call 23707/head
authorMykola Golub <mgolub@suse.com>
Thu, 23 Aug 2018 11:37:04 +0000 (14:37 +0300)
committerMykola Golub <mgolub@suse.com>
Thu, 23 Aug 2018 11:37:04 +0000 (14:37 +0300)
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/test/librbd/io/test_mock_ImageRequest.cc

index 17b3b4943d4adf24f23872ea74e216b3281d6e61..741be280d018182faa1bf71a473ff9d5bab5ed2c 100644 (file)
@@ -75,6 +75,19 @@ struct TestMockIoImageRequest : public TestMockFixture {
       .WillOnce(Return(appending));
   }
 
+  void expect_get_modify_timestamp(MockTestImageCtx &mock_image_ctx,
+                                   bool needs_update) {
+    if (needs_update) {
+      mock_image_ctx.mtime_update_interval = 5;
+      EXPECT_CALL(mock_image_ctx, get_modify_timestamp())
+        .WillOnce(Return(ceph_clock_now() - utime_t(10,0)));
+    } else {
+      mock_image_ctx.mtime_update_interval = 0;
+      EXPECT_CALL(mock_image_ctx, get_modify_timestamp());
+    }
+  }
+
+
   void expect_object_request_send(MockTestImageCtx &mock_image_ctx,
                                   int r) {
     EXPECT_CALL(*mock_image_ctx.io_object_dispatcher, send(_))
@@ -214,6 +227,7 @@ TEST_F(TestMockIoImageRequest, AioWriteJournalAppendDisabled) {
 
   InSequence seq;
   expect_is_journal_appending(mock_journal, false);
+  expect_get_modify_timestamp(mock_image_ctx, false);
   expect_object_request_send(mock_image_ctx, 0);
 
   C_SaferCond aio_comp_ctx;
@@ -243,6 +257,7 @@ TEST_F(TestMockIoImageRequest, AioDiscardJournalAppendDisabled) {
 
   InSequence seq;
   expect_is_journal_appending(mock_journal, false);
+  expect_get_modify_timestamp(mock_image_ctx, false);
   expect_object_request_send(mock_image_ctx, 0);
 
   C_SaferCond aio_comp_ctx;
@@ -300,6 +315,7 @@ TEST_F(TestMockIoImageRequest, AioWriteSameJournalAppendDisabled) {
 
   InSequence seq;
   expect_is_journal_appending(mock_journal, false);
+  expect_get_modify_timestamp(mock_image_ctx, false);
   expect_object_request_send(mock_image_ctx, 0);
 
   C_SaferCond aio_comp_ctx;
@@ -330,6 +346,7 @@ TEST_F(TestMockIoImageRequest, AioCompareAndWriteJournalAppendDisabled) {
 
   InSequence seq;
   expect_is_journal_appending(mock_journal, false);
+  expect_get_modify_timestamp(mock_image_ctx, false);
   expect_object_request_send(mock_image_ctx, 0);
 
   C_SaferCond aio_comp_ctx;