From cafb97218414871fc6e827bd4e4f7657137f05e4 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Thu, 23 Aug 2018 14:37:04 +0300 Subject: [PATCH] test/librbd: fix gmock warnings for get_modify_timestamp call Signed-off-by: Mykola Golub --- src/test/librbd/io/test_mock_ImageRequest.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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; -- 2.39.5