Merge pull request #19016 from trociny/wip-valgrind-unittest_rbd_mirror

test/rbd_mirror: fix valgrind warnings in unittest

Reviewed-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
Jason Dillaman 2017-11-20 13:16:23 -05:00 committed by GitHub
commit d23172c02d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -239,8 +239,10 @@ public:
}
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,

View File

@ -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) {
@ -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) {

View File

@ -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(