From: Matan Breizman Date: Sun, 14 Jan 2024 14:05:39 +0000 (+0000) Subject: test/neorados/aio_cxx: Seperate NeoRadosECTest from NeoRadosTest X-Git-Tag: v19.3.0~205^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b99ffc4f3e980d20374df4afeac2375eb36e37bb;p=ceph.git test/neorados/aio_cxx: Seperate NeoRadosECTest from NeoRadosTest 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 --- diff --git a/qa/suites/crimson-rados/basic/tasks/rados_api_tests.yaml b/qa/suites/crimson-rados/basic/tasks/rados_api_tests.yaml index ad8c921425b1..7a209a461d6f 100644 --- a/qa/suites/crimson-rados/basic/tasks/rados_api_tests.yaml +++ b/qa/suites/crimson-rados/basic/tasks/rados_api_tests.yaml @@ -24,5 +24,5 @@ tasks: - workunit: clients: client.0: - - rados/test.sh + - rados/test.sh --crimson - rados/test_pool_quota.sh diff --git a/qa/workunits/rados/test.sh b/qa/workunits/rados/test.sh index 8d5f40088950..e64fc488a2dd 100755 --- a/qa/workunits/rados/test.sh +++ b/qa/workunits/rados/test.sh @@ -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 diff --git a/src/test/neorados/CMakeLists.txt b/src/test/neorados/CMakeLists.txt index 97b99a04e5d7..62937f5c0778 100644 --- a/src/test/neorados/CMakeLists.txt +++ b/src/test/neorados/CMakeLists.txt @@ -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 index 000000000000..ae3c3ba8be5b --- /dev/null +++ b/src/test/neorados/ec_io.cc @@ -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 +#include +#include +#include +#include + +#include + +#include + +#include + +#include + +#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; +} diff --git a/src/test/neorados/io.cc b/src/test/neorados/io.cc index a73d6d36e076..82fabf185b9b 100644 --- a/src/test/neorados/io.cc +++ b/src/test/neorados/io.cc @@ -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; -}