]>
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>
21 template <typename
> class Threads
;
23 class TestFixture
: public ::testing::Test
{
27 static void SetUpTestCase();
28 static void TearDownTestCase();
30 void SetUp() override
;
31 void TearDown() override
;
33 librados::IoCtx m_local_io_ctx
;
34 librados::IoCtx m_remote_io_ctx
;
36 std::string m_image_name
;
37 uint64_t m_image_size
= 1 << 24;
39 std::set
<librbd::ImageCtx
*> m_image_ctxs
;
41 Threads
<librbd::ImageCtx
> *m_threads
= nullptr;
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
);
49 int create_snap(librbd::ImageCtx
*image_ctx
, const char* snap_name
,
50 librados::snap_t
*snap_id
= nullptr);
52 static std::string
get_temp_image_name();
53 static int create_image_data_pool(std::string
&data_pool
);
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
;
65 #endif // CEPH_TEST_RBD_MIRROR_TEST_FIXTURE_H