From: Sage Weil Date: Sun, 10 Aug 2014 18:41:23 +0000 (-0700) Subject: librados/TestCase: inheret cleanup_default_namespace X-Git-Tag: v0.84~10^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1d199fb1173dc9685dba96c22b83e4e9edf51a11;p=ceph.git librados/TestCase: inheret cleanup_default_namespace No need to duplicate this code. Signed-off-by: Sage Weil --- diff --git a/src/test/librados/TestCase.cc b/src/test/librados/TestCase.cc index 9f68af14e2b..21124ce2251 100644 --- a/src/test/librados/TestCase.cc +++ b/src/test/librados/TestCase.cc @@ -206,24 +206,6 @@ void RadosTestEC::TearDown() rados_ioctx_destroy(ioctx); } -void RadosTestEC::cleanup_default_namespace(rados_ioctx_t ioctx) -{ - // remove all objects from the default namespace to avoid polluting - // other tests - rados_ioctx_set_namespace(ioctx, ""); - rados_list_ctx_t list_ctx; - ASSERT_EQ(0, rados_objects_list_open(ioctx, &list_ctx)); - int r; - const char *entry = NULL; - const char *key = NULL; - while ((r = rados_objects_list_next(list_ctx, &entry, &key)) != -ENOENT) { - ASSERT_EQ(0, r); - rados_ioctx_locator_set_key(ioctx, key); - ASSERT_EQ(0, rados_remove(ioctx, entry)); - } - rados_objects_list_close(list_ctx); -} - std::string RadosTestECPP::pool_name; Rados RadosTestECPP::s_cluster; @@ -254,14 +236,3 @@ void RadosTestECPP::TearDown() ioctx.close(); } -void RadosTestECPP::cleanup_default_namespace(librados::IoCtx ioctx) -{ - // remove all objects from the default namespace to avoid polluting - // other tests - ioctx.set_namespace(""); - for (ObjectIterator it = ioctx.objects_begin(); - it != ioctx.objects_end(); ++it) { - ioctx.locator_set_key(it->second); - ASSERT_EQ(0, ioctx.remove(it->first)); - } -} diff --git a/src/test/librados/TestCase.h b/src/test/librados/TestCase.h index 83e5a31cd21..79b1465f871 100644 --- a/src/test/librados/TestCase.h +++ b/src/test/librados/TestCase.h @@ -72,14 +72,13 @@ protected: std::string ns; }; -class RadosTestEC : public ::testing::Test { +class RadosTestEC : public RadosTest { public: RadosTestEC() {} virtual ~RadosTestEC() {} protected: static void SetUpTestCase(); static void TearDownTestCase(); - static void cleanup_default_namespace(rados_ioctx_t ioctx); static rados_t s_cluster; static std::string pool_name; @@ -90,14 +89,13 @@ protected: uint64_t alignment; }; -class RadosTestECPP : public ::testing::Test { +class RadosTestECPP : public RadosTestPP { public: RadosTestECPP() : cluster(s_cluster) {} virtual ~RadosTestECPP() {} protected: static void SetUpTestCase(); static void TearDownTestCase(); - static void cleanup_default_namespace(librados::IoCtx ioctx); static librados::Rados s_cluster; static std::string pool_name;