]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: create pools for rbd tests with different prefix 7738/head
authorMykola Golub <mgolub@mirantis.com>
Mon, 22 Feb 2016 06:47:40 +0000 (08:47 +0200)
committerMykola Golub <mgolub@mirantis.com>
Mon, 22 Feb 2016 07:37:36 +0000 (09:37 +0200)
This makes easier to find out what test fails to cleanup.

Signed-off-by: Mykola Golub <mgolub@mirantis.com>
src/test/librados/test.cc
src/test/librados/test.h
src/test/librbd/test_fixture.cc
src/test/librbd/test_librbd.cc
src/test/rbd_mirror/test_ClusterWatcher.cc
src/test/rbd_mirror/test_PoolWatcher.cc

index 5f3ff2d47e64a1ba9bf2ccfe1b871c4d183c8e9b..e09bee15bda19889f5d350ce523b2f7656dd88b0 100644 (file)
@@ -20,7 +20,7 @@
 
 using namespace librados;
 
-std::string get_temp_pool_name()
+std::string get_temp_pool_name(const std::string &prefix)
 {
   char hostname[80];
   char out[80];
@@ -30,9 +30,7 @@ std::string get_temp_pool_name()
   static int num = 1;
   sprintf(out, "%s-%d-%d", hostname, getpid(), num);
   num++;
-  std::string prefix("test-rados-api-");
-  prefix += out;
-  return prefix;
+  return prefix + out;
 }
 
 int wait_for_healthy(rados_t *cluster)
index c5f948c6c081708b406b5195f40a3eb966f06055..1d13d8103a60f017fa65b506465889a3c5f83360 100644 (file)
@@ -22,7 +22,7 @@
 #include <string>
 #include <unistd.h>
 
-std::string get_temp_pool_name();
+std::string get_temp_pool_name(const std::string &prefix = "test-rados-api-");
 
 std::string create_one_pool(const std::string &pool_name, rados_t *cluster,
     uint32_t pg_num=0);
index 8ed42998f954bba7959cfd18cb34b53627e2ee20..a521a79deee86afc172538a3502f44ea3b547e3b 100644 (file)
@@ -24,7 +24,7 @@ TestFixture::TestFixture() : m_image_size(0) {
 }
 
 void TestFixture::SetUpTestCase() {
-  _pool_name = get_temp_pool_name();
+  _pool_name = get_temp_pool_name("test-librbd-");
   ASSERT_EQ("", create_one_pool_pp(_pool_name, _rados));
 }
 
index ed0d57d77a9eb08ae4c0915556a50bca34d3e46a..a1589a4ffb991d003528e6b1d11f4ae50cb155a7 100644 (file)
@@ -209,13 +209,13 @@ public:
     librados::Rados rados;
     std::string pool_name;
     if (unique) {
-      pool_name = get_temp_pool_name();
+      pool_name = get_temp_pool_name("test-librbd-");
       EXPECT_EQ("", create_one_pool_pp(pool_name, rados));
       _unique_pool_names.push_back(pool_name);
     } else if (m_pool_number < _pool_names.size()) {
       pool_name = _pool_names[m_pool_number];
     } else {
-      pool_name = get_temp_pool_name();
+      pool_name = get_temp_pool_name("test-librbd-");
       EXPECT_EQ("", create_one_pool_pp(pool_name, rados));
       _pool_names.push_back(pool_name);
     }
index fa1188e751e46878898e822f7d3f4f8d0e31e4cf..1629a16f1328fc5b36bbb4d8240cebda87562ade 100644 (file)
@@ -44,7 +44,7 @@ public:
 
   void create_pool(bool enable_mirroring, const peer_t &peer,
                    string *uuid = nullptr, string *name=nullptr) {
-    string pool_name = get_temp_pool_name();
+    string pool_name = get_temp_pool_name("test-rbd-mirror-");
     ASSERT_EQ("", create_one_pool_pp(pool_name, *m_cluster));
     int64_t pool_id = m_cluster->pool_lookup(pool_name.c_str());
     ASSERT_GE(pool_id, 0);
@@ -83,7 +83,7 @@ public:
 
   void create_cache_pool(const string &base_pool, string *cache_pool_name) {
     bufferlist inbl;
-    *cache_pool_name = get_temp_pool_name();
+    *cache_pool_name = get_temp_pool_name("test-rbd-mirror-");
     ASSERT_EQ("", create_one_pool_pp(*cache_pool_name, *m_cluster));
     ASSERT_EQ(0, m_cluster->mon_command(
       "{\"prefix\": \"osd tier add\", \"pool\": \"" + base_pool +
index 2bab4fde5cf8ed891ae81b939c10cbd7177f99ea..278421d3ccb85f42dd6a37c1fa914fa2f41d3db6 100644 (file)
@@ -53,7 +53,7 @@ TestPoolWatcher() : m_lock("TestPoolWatcherLock"),
   }
 
   void create_pool(bool enable_mirroring, const peer_t &peer, string *name=nullptr) {
-    string pool_name = get_temp_pool_name();
+    string pool_name = get_temp_pool_name("test-rbd-mirror-");
     ASSERT_EQ("", create_one_pool_pp(pool_name, *m_cluster));
     int64_t pool_id = m_cluster->pool_lookup(pool_name.c_str());
     ASSERT_GE(pool_id, 0);
@@ -82,7 +82,7 @@ TestPoolWatcher() : m_lock("TestPoolWatcherLock"),
 
   void create_cache_pool(const string &base_pool, string *cache_pool_name) {
     bufferlist inbl;
-    *cache_pool_name = get_temp_pool_name();
+    *cache_pool_name = get_temp_pool_name("test-rbd-mirror-");
     ASSERT_EQ("", create_one_pool_pp(*cache_pool_name, *m_cluster));
     ASSERT_EQ(0, m_cluster->mon_command(
       "{\"prefix\": \"osd tier add\", \"pool\": \"" + base_pool +