mirror of
https://github.com/ceph/ceph
synced 2025-02-21 09:57:26 +00:00
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 <mbreizma@redhat.com>
This commit is contained in:
parent
3a75a60aed
commit
b99ffc4f3e
@ -24,5 +24,5 @@ tasks:
|
||||
- workunit:
|
||||
clients:
|
||||
client.0:
|
||||
- rados/test.sh
|
||||
- rados/test.sh --crimson
|
||||
- rados/test_pool_quota.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
|
||||
|
@ -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
|
||||
)
|
||||
|
136
src/test/neorados/ec_io.cc
Normal file
136
src/test/neorados/ec_io.cc
Normal file
@ -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;
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user