summaryrefslogtreecommitdiffstats
path: root/src/test/libradosstriper/TestCase.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/test/libradosstriper/TestCase.h
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/libradosstriper/TestCase.h')
-rw-r--r--src/test/libradosstriper/TestCase.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/test/libradosstriper/TestCase.h b/src/test/libradosstriper/TestCase.h
new file mode 100644
index 000000000..c316b3bfb
--- /dev/null
+++ b/src/test/libradosstriper/TestCase.h
@@ -0,0 +1,82 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#ifndef CEPH_TEST_RADOS_TESTCASE_H
+#define CEPH_TEST_RADOS_TESTCASE_H
+
+#include "include/rados/librados.h"
+#include "include/rados/librados.hpp"
+#include "include/radosstriper/libradosstriper.h"
+#include "include/radosstriper/libradosstriper.hpp"
+#include "gtest/gtest.h"
+
+#include <string>
+
+/**
+ * These test cases create a temporary pool that lives as long as the
+ * test case. Each test within a test case gets a new ioctx and striper
+ * set to a unique namespace within the pool.
+ *
+ * Since pool creation and deletion is slow, this allows many tests to
+ * run faster.
+ */
+class StriperTest : public ::testing::Test {
+public:
+ StriperTest() {}
+ ~StriperTest() override {}
+protected:
+ static void SetUpTestCase();
+ static void TearDownTestCase();
+ static rados_t s_cluster;
+ static std::string pool_name;
+
+ void SetUp() override;
+ void TearDown() override;
+ rados_t cluster = NULL;
+ rados_ioctx_t ioctx = NULL;
+ rados_striper_t striper = NULL;
+};
+
+class StriperTestPP : public ::testing::Test {
+public:
+ StriperTestPP() : cluster(s_cluster) {}
+ ~StriperTestPP() override {}
+ static void SetUpTestCase();
+ static void TearDownTestCase();
+protected:
+ static librados::Rados s_cluster;
+ static std::string pool_name;
+
+ void SetUp() override;
+ librados::Rados &cluster;
+ librados::IoCtx ioctx;
+ libradosstriper::RadosStriper striper;
+};
+
+struct TestData {
+ uint32_t stripe_unit;
+ uint32_t stripe_count;
+ uint32_t object_size;
+ size_t size;
+};
+// this is pure copy and paste from previous class
+// but for the inheritance from TestWithParam
+// with gtest >= 1.6, we couldd avoid this by using
+// inheritance from WithParamInterface
+class StriperTestParam : public ::testing::TestWithParam<TestData> {
+public:
+ StriperTestParam() : cluster(s_cluster) {}
+ ~StriperTestParam() override {}
+ static void SetUpTestCase();
+ static void TearDownTestCase();
+protected:
+ static librados::Rados s_cluster;
+ static std::string pool_name;
+
+ void SetUp() override;
+ librados::Rados &cluster;
+ librados::IoCtx ioctx;
+ libradosstriper::RadosStriper striper;
+};
+
+#endif