From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/test/libradosstriper/TestCase.cc | 80 ++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/test/libradosstriper/TestCase.cc (limited to 'src/test/libradosstriper/TestCase.cc') diff --git a/src/test/libradosstriper/TestCase.cc b/src/test/libradosstriper/TestCase.cc new file mode 100644 index 00000000..98e81f49 --- /dev/null +++ b/src/test/libradosstriper/TestCase.cc @@ -0,0 +1,80 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#include +#include "test/librados/test.h" +#include "test/librados/test_cxx.h" +#include "test/libradosstriper/TestCase.h" + +using namespace libradosstriper; + +std::string StriperTest::pool_name; +rados_t StriperTest::s_cluster = NULL; + +void StriperTest::SetUpTestCase() +{ + pool_name = get_temp_pool_name(); + ASSERT_EQ("", create_one_pool(pool_name, &s_cluster)); +} + +void StriperTest::TearDownTestCase() +{ + ASSERT_EQ(0, destroy_one_pool(pool_name, &s_cluster)); +} + +void StriperTest::SetUp() +{ + cluster = StriperTest::s_cluster; + ASSERT_EQ(0, rados_ioctx_create(cluster, pool_name.c_str(), &ioctx)); + ASSERT_EQ(0, rados_striper_create(ioctx, &striper)); +} + +void StriperTest::TearDown() +{ + rados_striper_destroy(striper); + rados_ioctx_destroy(ioctx); +} + +std::string StriperTestPP::pool_name; +librados::Rados StriperTestPP::s_cluster; + +void StriperTestPP::SetUpTestCase() +{ + pool_name = get_temp_pool_name(); + ASSERT_EQ("", create_one_pool_pp(pool_name, s_cluster)); +} + +void StriperTestPP::TearDownTestCase() +{ + ASSERT_EQ(0, destroy_one_pool_pp(pool_name, s_cluster)); +} + +void StriperTestPP::SetUp() +{ + ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx)); + ASSERT_EQ(0, RadosStriper::striper_create(ioctx, &striper)); +} + +// 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 +std::string StriperTestParam::pool_name; +librados::Rados StriperTestParam::s_cluster; + +void StriperTestParam::SetUpTestCase() +{ + pool_name = get_temp_pool_name(); + ASSERT_EQ("", create_one_pool_pp(pool_name, s_cluster)); +} + +void StriperTestParam::TearDownTestCase() +{ + ASSERT_EQ(0, destroy_one_pool_pp(pool_name, s_cluster)); +} + +void StriperTestParam::SetUp() +{ + ASSERT_EQ(0, cluster.ioctx_create(pool_name.c_str(), ioctx)); + ASSERT_EQ(0, RadosStriper::striper_create(ioctx, &striper)); +} -- cgit v1.2.3