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(CompleteContext, r) {
28 ACTION_P2(CompleteContext, wq, r) {
29 ContextWQ *context_wq = reinterpret_cast<ContextWQ *>(wq);
30 context_wq->queue(arg0, r);
33 MATCHER_P(ContentsEqual, bl, "") {
34 // TODO fix const-correctness of bufferlist
35 return const_cast<bufferlist &>(arg).contents_equal(
36 const_cast<bufferlist &>(bl));
42 class TestMockFixture : public TestFixture {
44 typedef boost::shared_ptr<librados::TestCluster> TestClusterRef;
46 static void SetUpTestCase();
47 static void TearDownTestCase();
49 void TearDown() override;
51 void expect_test_features(librbd::MockImageCtx &mock_image_ctx);
54 static TestClusterRef s_test_cluster;
60 #endif // CEPH_TEST_RBD_MIRROR_TEST_MOCK_FIXTURE_H