]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test: Set pool size to 3 for split ops tests 70157/head
authorMatty Williams <Matty.Williams@ibm.com>
Thu, 16 Jul 2026 09:32:16 +0000 (10:32 +0100)
committerMatty Williams <Matty.Williams@ibm.com>
Thu, 16 Jul 2026 14:49:25 +0000 (15:49 +0100)
Signed-off-by: Matty Williams <Matty.Williams@ibm.com>
Assisted-by: IBM-Bob:Claude/GPT
src/test/librados/split_op_cxx.cc
src/test/librados/test_cxx.cc
src/test/librados/test_cxx.h

index 4abc416bb9222c63704181ebaeb0e0cde6d41821..eecb6d3a2c6da139faf11c36060af32a93c53739 100644 (file)
@@ -1,5 +1,6 @@
 #include <common/perf_counters_collection.h>
 
+#include <fmt/format.h>
 #include "test/librados/test_cxx.h"
 #include "test/librados/testcase_cxx.h"
 #include "crimson_utils.h"
@@ -11,7 +12,18 @@ using namespace librados;
 using namespace cls;
 using namespace rados::cls;
 
-typedef RadosTestPP LibRadosSplitOpPP;
+class LibRadosSplitOpPP : public RadosTestPP {
+public:
+  static void SetUpTestCase() {
+    auto pool_prefix = fmt::format("{}_", ::testing::UnitTest::GetInstance()->current_test_case()->name());
+    pool_name_default = get_temp_pool_name(pool_prefix);
+    std::map<std::string, std::string> config = {{"rados_replica_read_policy", "default"}};
+    ASSERT_EQ("", connect_cluster_pp(s_cluster, config));
+    ASSERT_EQ("", create_pool_pp(pool_name_default, s_cluster, 3));
+    s_cluster.wait_for_latest_osdmap();
+  }
+};
+
 typedef RadosTestECPP LibRadosSplitOpECPP;
 
 // After a write is committed, it isn't necessarily true that the log is
index 28ac94b3ba18d289b674e281fd5b38ecad06bab3..16d4039b9a5dbdbd0c13e8b139bc02493df6c289 100644 (file)
@@ -123,22 +123,33 @@ std::string create_one_ec_pool_pp(const std::string &pool_name,
   return err;
 }
 
-std::string create_pool_pp(const std::string &pool_name, Rados &cluster) {
-  int ret = cluster.pool_create(pool_name.c_str());
-  if (ret) {
-    cluster.shutdown();
-    std::ostringstream oss;
-    oss << "cluster.pool_create(" << pool_name << ") failed with error " << ret;
-    return oss.str();
+std::string create_pool_pp(const std::string &pool_name, Rados &cluster, int size) {
+  std::ostringstream oss;
+  int ret;
+  if (size > 0) {
+    ret = cluster.mon_command(
+      "{\"prefix\": \"osd pool create\", \"pool\": \"" + pool_name +
+      "\", \"size\": " + std::to_string(size) + "}",
+      {}, NULL, NULL);
+    if (ret) {
+      oss << "mon_command osd pool create pool:" << pool_name
+          << " size:" << size << " failed with error " << ret;
+      return oss.str();
+    }
+  } else {
+    ret = cluster.pool_create(pool_name.c_str());
+    if (ret) {
+      cluster.shutdown();
+      oss << "cluster.pool_create(" << pool_name << ") failed with error " << ret;
+      return oss.str();
+    }
   }
 
   IoCtx ioctx;
   ret = cluster.ioctx_create(pool_name.c_str(), ioctx);
   if (ret < 0) {
     cluster.shutdown();
-    std::ostringstream oss;
-    oss << "cluster.ioctx_create(" << pool_name << ") failed with error "
-        << ret;
+    oss << "cluster.ioctx_create(" << pool_name << ") failed with error " << ret;
     return oss.str();
   }
   ioctx.application_enable("rados", true);
index 4bedfa4bd40cc9e052fe0dc7f9aa3624a39c6aa0..52eb393be658e32d9cc44994af056cb3d877f4b6 100644 (file)
@@ -20,7 +20,8 @@ std::string create_ec_pool_pp(
   librados::Rados &cluster,
   bool fast_ec = false);
 std::string create_pool_pp(const std::string &pool_name,
-                            librados::Rados &cluster);
+                            librados::Rados &cluster,
+                            int size = 0);
 std::string set_allow_ec_overwrites_pp(const std::string &pool_name,
                                       librados::Rados &cluster, bool allow);
 std::string connect_cluster_pp(librados::Rados &cluster);