]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
test/neorados/aio_cxx: Seperate NeoRadosECTest from NeoRadosTest
authorMatan Breizman <mbreizma@redhat.com>
Sun, 14 Jan 2024 14:05:39 +0000 (14:05 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Wed, 17 Jan 2024 11:05:46 +0000 (11:05 +0000)
SKIP_IF_CRIMSON won't work here since we try to create EC pools
prior to the test being run.
Skip if the entire test instead by seperating EC tests.

Signed-off-by: Matan Breizman <mbreizma@redhat.com>
qa/suites/crimson-rados/basic/tasks/rados_api_tests.yaml
qa/workunits/rados/test.sh
src/test/neorados/CMakeLists.txt
src/test/neorados/ec_io.cc [new file with mode: 0644]
src/test/neorados/io.cc

index ad8c921425b18a9b795fd2866febf752c3826ad9..7a209a461d6f8d3efff6ae892f6d8a272b30e87e 100644 (file)
@@ -24,5 +24,5 @@ tasks:
 - workunit:
     clients:
       client.0:
-        - rados/test.sh
+        - rados/test.sh --crimson
         - rados/test_pool_quota.sh
index 8d5f40088950d31fda2acf286ffef76c31cef511..e64fc488a2dd6da4931ef4aaca319092b64fdc7c 100755 (executable)
@@ -4,6 +4,10 @@ set -ex
 parallel=1
 [ "$1" = "--serial" ] && parallel=0
 
+# let crimson run in serial mode
+crimson=0
+[ "$1" = "--crimson" ] && parallel=0 && crimson=1
+
 color=""
 [ -t 1 ] && color="--gtest_color=yes"
 
@@ -49,7 +53,7 @@ do
 done
 
 for f in \
-    cls cmd handler_error io list misc pool read_operations snapshots \
+    cls cmd handler_error io ec_io list misc pool read_operations snapshots \
     watch_notify write_operations
 do
     if [ $parallel -eq 1 ]; then
@@ -60,6 +64,10 @@ do
        echo "test $f on pid $pid"
        pids[$f]=$pid
     else
+       if [ $crimson -eq 1 ] && [ $f = "ec_io" ]; then
+               echo "Skipping EC with Crimson"
+               continue
+       fi
        ceph_test_neorados_$f
     fi
 done
index 97b99a04e5d76f4d4c6d3b674b0dcc2db6ea8ed7..62937f5c07782d292125461df7980c0ec702f8d4 100644 (file)
@@ -122,6 +122,22 @@ install(TARGETS
   ceph_test_neorados_io
   DESTINATION ${CMAKE_INSTALL_BINDIR})
 
+add_executable(ceph_test_neorados_ec_io
+  ec_io.cc
+  )
+target_link_libraries(ceph_test_neorados_ec_io
+  libneorados
+  ${BLKID_LIBRARIES}
+  ${CMAKE_DL_LIBS}
+  ${CRYPTO_LIBS}
+  ${EXTRALIBS}
+  neoradostest-support
+  ${UNITTEST_LIBS}
+  )
+install(TARGETS
+  ceph_test_neorados_ec_io
+  DESTINATION ${CMAKE_INSTALL_BINDIR})
+
 add_executable(ceph_test_neorados_list
   list.cc
   )
diff --git a/src/test/neorados/ec_io.cc b/src/test/neorados/ec_io.cc
new file mode 100644 (file)
index 0000000..ae3c3ba
--- /dev/null
@@ -0,0 +1,136 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+/*
+ * Ceph - scalable distributed file system
+ *
+ * Copyright (C) 2023 IBM
+ *
+ * See file COPYING for license information.
+ *
+ */
+
+#include <array>
+#include <coroutine>
+#include <cstdint>
+#include <limits>
+#include <utility>
+
+#include <fmt/format.h>
+
+#include <boost/asio/use_awaitable.hpp>
+
+#include <boost/container/flat_map.hpp>
+
+#include <boost/system/errc.hpp>
+
+#include "include/neorados/RADOS.hpp"
+
+#include "include/buffer.h"
+#include "include/stringify.h"
+
+#include "test/neorados/common_tests.h"
+
+#include "gtest/gtest.h"
+
+namespace asio = boost::asio;
+namespace buffer = ceph::buffer;
+namespace container = boost::container;
+namespace sys = boost::system;
+
+using namespace std::literals;
+
+using neorados::ReadOp;
+using neorados::WriteOp;
+
+static constexpr auto oid = "oid"sv;
+
+CORO_TEST_F(NeoRadosECIo, SimpleWrite, NeoRadosECTest) {
+  co_return;
+  static constexpr auto nspace = "nspace";
+  auto pool2 = pool();
+  const auto bl = filled_buffer_list(0xcc, 128);
+
+  pool2.set_ns(nspace);
+  EXPECT_EQ(nspace, pool2.get_ns());
+  sleep(10);
+
+  {
+    co_await execute(oid, WriteOp().write(0, bl));
+    auto resbl = co_await read(oid);
+    EXPECT_EQ(bl, resbl);
+  }
+
+  {
+    co_await execute(oid, WriteOp().write(0, bl), pool2);
+    auto resbl = co_await read(oid, pool2);
+    EXPECT_EQ(bl, resbl);
+  }
+
+  co_return;
+}
+
+CORO_TEST_F(NeoRadosECIo, ReadOp, NeoRadosECTest) {
+  const auto refbl = filled_buffer_list(0xcc, 128);
+
+  co_await execute(oid, WriteOp{}.write_full(refbl));
+  {
+    buffer::list op_bl;
+    co_await rados().execute(oid, pool(),
+                            ReadOp().read(0, refbl.length(), nullptr),
+                            &op_bl, asio::use_awaitable);
+    EXPECT_EQ(refbl, op_bl);
+  }
+  {
+    buffer::list op_bl;
+    // 0 means read the whole object data.
+    co_await rados().execute(oid, pool(),
+                            ReadOp().read(0, 0, nullptr),
+                            &op_bl, asio::use_awaitable);
+    EXPECT_EQ(refbl, op_bl);
+  }
+  {
+    buffer::list read_bl, op_bl;
+    co_await rados().execute(oid, pool(),
+                            ReadOp().read(0, refbl.length(), &read_bl),
+                            &op_bl, asio::use_awaitable);
+    EXPECT_EQ(refbl, read_bl);
+    EXPECT_EQ(refbl, op_bl);
+  }
+  {
+    buffer::list read_bl, op_bl;
+    // 0 means read the whole object data.
+    co_await rados().execute(oid, pool(),
+                            ReadOp().read(0, 0, &read_bl),
+                            &op_bl, asio::use_awaitable);
+    EXPECT_EQ(refbl, read_bl);
+    EXPECT_EQ(refbl, op_bl);
+  }
+
+  {
+    buffer::list read_bl, read_bl2, op_bl;
+    // 0 means read the whole object data.
+    co_await rados().execute(oid, pool(), ReadOp{}
+                            .read(0, 0, &read_bl)
+                            .read(0, 0, &read_bl2),
+                            &op_bl, asio::use_awaitable);
+    EXPECT_EQ(refbl, read_bl);
+    EXPECT_EQ(refbl, read_bl2);
+    buffer::list bl2;
+    bl2.append(refbl);
+    bl2.append(refbl);
+    EXPECT_EQ(bl2, op_bl);
+  }
+  {
+    // Read into buffer with a cached crc
+    auto op_bl = filled_buffer_list('z', refbl.length());
+    EXPECT_NE(refbl.crc32c(0), op_bl.crc32c(0));  // cache 'x' crc
+
+    co_await rados().execute(oid, pool(),
+                            ReadOp().read(0, refbl.length(), nullptr),
+                            &op_bl, asio::use_awaitable);
+    EXPECT_EQ(refbl, op_bl);
+    EXPECT_EQ(refbl.crc32c(0), op_bl.crc32c(0));  // cache 'x' crc
+  }
+
+  co_return;
+}
index a73d6d36e07650ad822b1dbd16046a0dc633ac89..82fabf185b9bd9501bdd51a0a26fa5f29603e635 100644 (file)
@@ -379,94 +379,3 @@ CORO_TEST_F(NeoRadosIo, GetXattrs, NeoRadosTest) {
 
   co_return;
 }
-
-CORO_TEST_F(NeoRadosECIo, SimpleWrite, NeoRadosECTest) {
-  SKIP_IF_CRIMSON();
-  static constexpr auto nspace = "nspace";
-  auto pool2 = pool();
-  const auto bl = filled_buffer_list(0xcc, 128);
-
-  pool2.set_ns(nspace);
-  EXPECT_EQ(nspace, pool2.get_ns());
-
-  {
-    co_await execute(oid, WriteOp().write(0, bl));
-    auto resbl = co_await read(oid);
-    EXPECT_EQ(bl, resbl);
-  }
-
-  {
-    co_await execute(oid, WriteOp().write(0, bl), pool2);
-    auto resbl = co_await read(oid, pool2);
-    EXPECT_EQ(bl, resbl);
-  }
-
-  co_return;
-}
-
-CORO_TEST_F(NeoRadosECIo, ReadOp, NeoRadosECTest) {
-  SKIP_IF_CRIMSON();
-  const auto refbl = filled_buffer_list(0xcc, 128);
-
-  co_await execute(oid, WriteOp{}.write_full(refbl));
-  {
-    buffer::list op_bl;
-    co_await rados().execute(oid, pool(),
-                            ReadOp().read(0, refbl.length(), nullptr),
-                            &op_bl, asio::use_awaitable);
-    EXPECT_EQ(refbl, op_bl);
-  }
-  {
-    buffer::list op_bl;
-    // 0 means read the whole object data.
-    co_await rados().execute(oid, pool(),
-                            ReadOp().read(0, 0, nullptr),
-                            &op_bl, asio::use_awaitable);
-    EXPECT_EQ(refbl, op_bl);
-  }
-  {
-    buffer::list read_bl, op_bl;
-    co_await rados().execute(oid, pool(),
-                            ReadOp().read(0, refbl.length(), &read_bl),
-                            &op_bl, asio::use_awaitable);
-    EXPECT_EQ(refbl, read_bl);
-    EXPECT_EQ(refbl, op_bl);
-  }
-  {
-    buffer::list read_bl, op_bl;
-    // 0 means read the whole object data.
-    co_await rados().execute(oid, pool(),
-                            ReadOp().read(0, 0, &read_bl),
-                            &op_bl, asio::use_awaitable);
-    EXPECT_EQ(refbl, read_bl);
-    EXPECT_EQ(refbl, op_bl);
-  }
-
-  {
-    buffer::list read_bl, read_bl2, op_bl;
-    // 0 means read the whole object data.
-    co_await rados().execute(oid, pool(), ReadOp{}
-                            .read(0, 0, &read_bl)
-                            .read(0, 0, &read_bl2),
-                            &op_bl, asio::use_awaitable);
-    EXPECT_EQ(refbl, read_bl);
-    EXPECT_EQ(refbl, read_bl2);
-    buffer::list bl2;
-    bl2.append(refbl);
-    bl2.append(refbl);
-    EXPECT_EQ(bl2, op_bl);
-  }
-  {
-    // Read into buffer with a cached crc
-    auto op_bl = filled_buffer_list('z', refbl.length());
-    EXPECT_NE(refbl.crc32c(0), op_bl.crc32c(0));  // cache 'x' crc
-
-    co_await rados().execute(oid, pool(),
-                            ReadOp().read(0, refbl.length(), nullptr),
-                            &op_bl, asio::use_awaitable);
-    EXPECT_EQ(refbl, op_bl);
-    EXPECT_EQ(refbl.crc32c(0), op_bl.crc32c(0));  // cache 'x' crc
-  }
-
-  co_return;
-}