Skip to content

Commit

Permalink
Merge pull request ceph#19016 from trociny/wip-valgrind-unittest_rbd_…
Browse files Browse the repository at this point in the history
…mirror

test/rbd_mirror: fix valgrind warnings in unittest

Reviewed-by: Jason Dillaman <[email protected]>
  • Loading branch information
Jason Dillaman authored Nov 20, 2017
2 parents 53898ed + 08544e7 commit d23172c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,10 @@ class TestMockImageReplayerCreateImageRequest : public TestMockFixture {
}

void expect_ioctx_create(librados::IoCtx &io_ctx) {
librados::MockTestMemIoCtxImpl &io_ctx_impl = get_mock_io_ctx(io_ctx);
EXPECT_CALL(*get_mock_io_ctx(io_ctx).get_mock_rados_client(), create_ioctx(_, _))
.WillOnce(Return(&get_mock_io_ctx(io_ctx)));
.WillOnce(DoAll(GetReference(&io_ctx_impl),
Return(&get_mock_io_ctx(io_ctx))));
}

void expect_get_parent_global_image_id(librados::IoCtx &io_ctx,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, Success) {
ASSERT_EQ(std::string("remote image id"), remote_image_id);
ASSERT_TRUE(remote_journaler != nullptr);
ASSERT_EQ(cls::journal::CLIENT_STATE_DISCONNECTED, client_state);
delete remote_journaler;
}

TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, SuccessNotRegistered) {
Expand Down Expand Up @@ -239,6 +240,7 @@ TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, SuccessNotRegistered) {
ASSERT_EQ(std::string("remote image id"), remote_image_id);
ASSERT_TRUE(remote_journaler != nullptr);
ASSERT_EQ(cls::journal::CLIENT_STATE_CONNECTED, client_state);
delete remote_journaler;
}

TEST_F(TestMockImageReplayerPrepareRemoteImageRequest, MirrorUuidError) {
Expand Down
4 changes: 4 additions & 0 deletions src/test/rbd_mirror/test_mock_fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ ACTION_P2(CompleteContext, wq, r) {
context_wq->queue(arg0, r);
}

ACTION_P(GetReference, ref_object) {
ref_object->get();
}

MATCHER_P(ContentsEqual, bl, "") {
// TODO fix const-correctness of bufferlist
return const_cast<bufferlist &>(arg).contents_equal(
Expand Down

0 comments on commit d23172c

Please sign in to comment.