]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librados/TestCase: inheret cleanup_default_namespace
authorSage Weil <sage@redhat.com>
Sun, 10 Aug 2014 18:41:23 +0000 (11:41 -0700)
committerSage Weil <sage@redhat.com>
Wed, 13 Aug 2014 19:55:22 +0000 (12:55 -0700)
No need to duplicate this code.

Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit 1d199fb1173dc9685dba96c22b83e4e9edf51a11)

src/test/librados/TestCase.cc
src/test/librados/TestCase.h

index 9f68af14e2b1ea9f99c3bdafc1f4bac3c2e67d9a..21124ce2251c80548f8544689f1cb105b1f45ccc 100644 (file)
@@ -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));
-  }
-}
index 5bd084fcfcd4000675e308392c8ab84d3ef4ddec..a0690265995bf2f6d3c78bbfbeb5c72d01728ce5 100644 (file)
@@ -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;