1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_TEST_RBD_MIRROR_TEST_MOCK_FIXTURE_H
5 #define CEPH_TEST_RBD_MIRROR_TEST_MOCK_FIXTURE_H
7 #include "test/rbd_mirror/test_fixture.h"
8 #include "test/librados_test_stub/LibradosTestStub.h"
9 #include "common/WorkQueue.h"
10 #include <boost/shared_ptr.hpp>
11 #include <gmock/gmock.h>
12 #include "include/assert.h"
15 class TestRadosClient
;
16 class MockTestMemIoCtxImpl
;
17 class MockTestMemRadosClient
;
24 ACTION_P(CopyInBufferlist
, str
) {
28 ACTION_P(CompleteContext
, r
) {
32 ACTION_P2(CompleteContext
, wq
, r
) {
33 ContextWQ
*context_wq
= reinterpret_cast<ContextWQ
*>(wq
);
34 context_wq
->queue(arg0
, r
);
37 MATCHER_P(ContentsEqual
, bl
, "") {
38 // TODO fix const-correctness of bufferlist
39 return const_cast<bufferlist
&>(arg
).contents_equal(
40 const_cast<bufferlist
&>(bl
));
46 class TestMockFixture
: public TestFixture
{
48 typedef boost::shared_ptr
<librados::TestCluster
> TestClusterRef
;
50 static void SetUpTestCase();
51 static void TearDownTestCase();
53 void TearDown() override
;
55 void expect_test_features(librbd::MockImageCtx
&mock_image_ctx
);
58 static TestClusterRef s_test_cluster
;
64 #endif // CEPH_TEST_RBD_MIRROR_TEST_MOCK_FIXTURE_H