]>
git.proxmox.com Git - ceph.git/blob - ceph/src/test/rbd_mirror/test_fixture.h
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_FIXTURE_H
5 #define CEPH_TEST_RBD_MIRROR_TEST_FIXTURE_H
7 #include "include/int_types.h"
8 #include "include/rados/librados.hpp"
9 #include <gtest/gtest.h>
20 template <typename
> class Threads
;
22 class TestFixture
: public ::testing::Test
{
26 static void SetUpTestCase();
27 static void TearDownTestCase();
29 void SetUp() override
;
30 void TearDown() override
;
32 librados::IoCtx m_local_io_ctx
;
33 librados::IoCtx m_remote_io_ctx
;
35 std::string m_image_name
;
36 uint64_t m_image_size
= 1 << 24;
38 std::set
<librbd::ImageCtx
*> m_image_ctxs
;
40 Threads
<librbd::ImageCtx
> *m_threads
= nullptr;
43 int create_image(librbd::RBD
&rbd
, librados::IoCtx
&ioctx
,
44 const std::string
&name
, uint64_t size
);
45 int open_image(librados::IoCtx
&io_ctx
, const std::string
&image_name
,
46 librbd::ImageCtx
**image_ctx
);
48 int create_snap(librbd::ImageCtx
*image_ctx
, const char* snap_name
,
49 librados::snap_t
*snap_id
= nullptr);
51 static std::string
get_temp_image_name();
52 static int create_image_data_pool(std::string
&data_pool
);
54 static std::string _local_pool_name
;
55 static std::string _remote_pool_name
;
56 static std::shared_ptr
<librados::Rados
> _rados
;
57 static uint64_t _image_number
;
58 static std::string _data_pool
;
64 #endif // CEPH_TEST_RBD_MIRROR_TEST_FIXTURE_H