]> git.proxmox.com Git - ceph.git/blame - ceph/src/test/rbd_mirror/test_mock_fixture.h
update sources to v12.2.3
[ceph.git] / ceph / src / test / rbd_mirror / test_mock_fixture.h
CommitLineData
7c673cae
FG
1// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2// vim: ts=8 sw=2 smarttab
3
4#ifndef CEPH_TEST_RBD_MIRROR_TEST_MOCK_FIXTURE_H
5#define CEPH_TEST_RBD_MIRROR_TEST_MOCK_FIXTURE_H
6
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"
13
14namespace librados {
15class TestRadosClient;
16class MockTestMemIoCtxImpl;
17class MockTestMemRadosClient;
18}
19
20namespace librbd {
21class MockImageCtx;
22}
23
b32b8144
FG
24ACTION_P(CopyInBufferlist, str) {
25 arg0->append(str);
26}
27
7c673cae
FG
28ACTION_P(CompleteContext, r) {
29 arg0->complete(r);
30}
31
32ACTION_P2(CompleteContext, wq, r) {
33 ContextWQ *context_wq = reinterpret_cast<ContextWQ *>(wq);
34 context_wq->queue(arg0, r);
35}
36
37MATCHER_P(ContentsEqual, bl, "") {
38 // TODO fix const-correctness of bufferlist
39 return const_cast<bufferlist &>(arg).contents_equal(
40 const_cast<bufferlist &>(bl));
41}
42
43namespace rbd {
44namespace mirror {
45
46class TestMockFixture : public TestFixture {
47public:
48 typedef boost::shared_ptr<librados::TestCluster> TestClusterRef;
49
50 static void SetUpTestCase();
51 static void TearDownTestCase();
52
53 void TearDown() override;
54
55 void expect_test_features(librbd::MockImageCtx &mock_image_ctx);
56
57private:
58 static TestClusterRef s_test_cluster;
59};
60
61} // namespace mirror
62} // namespace rbd
63
64#endif // CEPH_TEST_RBD_MIRROR_TEST_MOCK_FIXTURE_H