]>
Commit | Line | Data |
---|---|---|
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_FIXTURE_H | |
5 | #define CEPH_TEST_RBD_MIRROR_TEST_FIXTURE_H | |
6 | ||
7 | #include "include/int_types.h" | |
8 | #include "include/rados/librados.hpp" | |
9 | #include <gtest/gtest.h> | |
11fdf7f2 | 10 | #include <memory> |
7c673cae FG |
11 | #include <set> |
12 | ||
13 | namespace librbd { | |
14 | class ImageCtx; | |
15 | class RBD; | |
16 | } | |
17 | ||
18 | namespace rbd { | |
19 | namespace mirror { | |
20 | ||
21 | template <typename> class Threads; | |
22 | ||
23 | class TestFixture : public ::testing::Test { | |
24 | public: | |
25 | TestFixture(); | |
26 | ||
27 | static void SetUpTestCase(); | |
28 | static void TearDownTestCase(); | |
29 | ||
30 | void SetUp() override; | |
31 | void TearDown() override; | |
32 | ||
33 | librados::IoCtx m_local_io_ctx; | |
34 | librados::IoCtx m_remote_io_ctx; | |
35 | ||
36 | std::string m_image_name; | |
37 | uint64_t m_image_size = 1 << 24; | |
38 | ||
39 | std::set<librbd::ImageCtx *> m_image_ctxs; | |
40 | ||
41 | Threads<librbd::ImageCtx> *m_threads = nullptr; | |
42 | ||
43 | ||
44 | int create_image(librbd::RBD &rbd, librados::IoCtx &ioctx, | |
45 | const std::string &name, uint64_t size); | |
46 | int open_image(librados::IoCtx &io_ctx, const std::string &image_name, | |
47 | librbd::ImageCtx **image_ctx); | |
48 | ||
49 | int create_snap(librbd::ImageCtx *image_ctx, const char* snap_name, | |
50 | librados::snap_t *snap_id = nullptr); | |
51 | ||
52 | static std::string get_temp_image_name(); | |
53 | static int create_image_data_pool(std::string &data_pool); | |
54 | ||
55 | static std::string _local_pool_name; | |
56 | static std::string _remote_pool_name; | |
57 | static std::shared_ptr<librados::Rados> _rados; | |
58 | static uint64_t _image_number; | |
59 | static std::string _data_pool; | |
60 | }; | |
61 | ||
62 | } // namespace mirror | |
63 | } // namespace rbd | |
64 | ||
65 | #endif // CEPH_TEST_RBD_MIRROR_TEST_FIXTURE_H |