From: Mykola Golub Date: Thu, 23 Aug 2018 11:37:04 +0000 (+0300) Subject: test/librbd: fix gmock warnings for get_modify_timestamp call X-Git-Tag: v14.0.1~492^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=cafb97218414871fc6e827bd4e4f7657137f05e4;p=ceph.git test/librbd: fix gmock warnings for get_modify_timestamp call Signed-off-by: Mykola Golub --- diff --git a/src/test/librbd/io/test_mock_ImageRequest.cc b/src/test/librbd/io/test_mock_ImageRequest.cc index 17b3b4943d4ad..741be280d0181 100644 --- a/src/test/librbd/io/test_mock_ImageRequest.cc +++ b/src/test/librbd/io/test_mock_ImageRequest.cc @@ -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;