From: Casey Bodley Date: Thu, 2 Mar 2023 20:18:18 +0000 (-0500) Subject: test/rgw: ceph_test_rgw_throttle no longer needs rados X-Git-Tag: v19.0.0~1553^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=e587a71aff8d53dd6f8806a197da098b921d4392;p=ceph-ci.git test/rgw: ceph_test_rgw_throttle no longer needs rados run it as a unittest instead of a workunit Signed-off-by: Casey Bodley --- diff --git a/qa/suites/rgw/verify/tasks/cls.yaml b/qa/suites/rgw/verify/tasks/cls.yaml index 936c489bfe6..e185796bc53 100644 --- a/qa/suites/rgw/verify/tasks/cls.yaml +++ b/qa/suites/rgw/verify/tasks/cls.yaml @@ -12,5 +12,4 @@ tasks: - cls/test_cls_2pc_queue.sh - rgw/test_rgw_gc_log.sh - rgw/test_rgw_obj.sh - - rgw/test_rgw_throttle.sh - rgw/test_librgw_file.sh diff --git a/qa/workunits/rgw/test_rgw_throttle.sh b/qa/workunits/rgw/test_rgw_throttle.sh deleted file mode 100755 index f637b8f08e0..00000000000 --- a/qa/workunits/rgw/test_rgw_throttle.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -e - -ceph_test_rgw_throttle - -exit 0 diff --git a/src/test/rgw/CMakeLists.txt b/src/test/rgw/CMakeLists.txt index 57d6696c776..96d157b7ced 100644 --- a/src/test/rgw/CMakeLists.txt +++ b/src/test/rgw/CMakeLists.txt @@ -147,12 +147,9 @@ add_executable(unittest_rgw_putobj test_rgw_putobj.cc) add_ceph_unittest(unittest_rgw_putobj) target_link_libraries(unittest_rgw_putobj ${rgw_libs} ${UNITTEST_LIBS}) -add_executable(ceph_test_rgw_throttle - test_rgw_throttle.cc - $) -target_link_libraries(ceph_test_rgw_throttle ${rgw_libs} - librados global ${UNITTEST_LIBS}) -install(TARGETS ceph_test_rgw_throttle DESTINATION ${CMAKE_INSTALL_BINDIR}) +add_executable(unittest_rgw_throttle test_rgw_throttle.cc) +add_ceph_unittest(unittest_rgw_throttle) +target_link_libraries(unittest_rgw_throttle ${rgw_libs} ${UNITTEST_LIBS}) add_executable(unittest_rgw_iam_policy test_rgw_iam_policy.cc) add_ceph_unittest(unittest_rgw_iam_policy) diff --git a/src/test/rgw/test_rgw_throttle.cc b/src/test/rgw/test_rgw_throttle.cc index d67f2c6ceb6..72dae286cdd 100644 --- a/src/test/rgw/test_rgw_throttle.cc +++ b/src/test/rgw/test_rgw_throttle.cc @@ -21,43 +21,10 @@ #include #include -struct RadosEnv : public ::testing::Environment { - public: - static constexpr auto poolname = "ceph_test_rgw_throttle"; - - static std::optional rados; - - void SetUp() override { - rados.emplace(g_ceph_context); - const NoDoutPrefix no_dpp(g_ceph_context, 1); - ASSERT_EQ(0, rados->start(null_yield, &no_dpp)); - int r = rados->pool({poolname}).create(&no_dpp); - if (r == -EEXIST) - r = 0; - ASSERT_EQ(0, r); - } - void TearDown() override { - ASSERT_EQ(0, rados->get_rados_handle()->pool_delete(poolname)); - rados->shutdown(); - rados.reset(); - } -}; -std::optional RadosEnv::rados; - -auto *const rados_env = ::testing::AddGlobalTestEnvironment(new RadosEnv); - -// test fixture for global setup/teardown -class RadosFixture : public ::testing::Test { - protected: - RGWSI_RADOS::Obj make_obj(const std::string& oid) { - auto obj = RadosEnv::rados->obj({{RadosEnv::poolname}, oid}); - const NoDoutPrefix no_dpp(g_ceph_context, 1); - ceph_assert_always(0 == obj.open(&no_dpp)); - return obj; - } -}; - -using Aio_Throttle = RadosFixture; +static rgw_raw_obj make_obj(const std::string& oid) +{ + return {{"testpool"}, oid}; +} namespace rgw { @@ -90,7 +57,7 @@ auto wait_for(boost::asio::io_context& context, ceph::timespan duration) { }; } -TEST_F(Aio_Throttle, NoThrottleUpToMax) +TEST(Aio_Throttle, NoThrottleUpToMax) { BlockingAioThrottle throttle(4); auto obj = make_obj(__PRETTY_FUNCTION__); @@ -118,7 +85,7 @@ TEST_F(Aio_Throttle, NoThrottleUpToMax) } } -TEST_F(Aio_Throttle, CostOverWindow) +TEST(Aio_Throttle, CostOverWindow) { BlockingAioThrottle throttle(4); auto obj = make_obj(__PRETTY_FUNCTION__); @@ -129,7 +96,7 @@ TEST_F(Aio_Throttle, CostOverWindow) EXPECT_EQ(-EDEADLK, c.front().result); } -TEST_F(Aio_Throttle, ThrottleOverMax) +TEST(Aio_Throttle, ThrottleOverMax) { constexpr uint64_t window = 4; BlockingAioThrottle throttle(window); @@ -167,7 +134,7 @@ TEST_F(Aio_Throttle, ThrottleOverMax) EXPECT_EQ(window, max_outstanding); } -TEST_F(Aio_Throttle, YieldCostOverWindow) +TEST(Aio_Throttle, YieldCostOverWindow) { auto obj = make_obj(__PRETTY_FUNCTION__); @@ -183,7 +150,7 @@ TEST_F(Aio_Throttle, YieldCostOverWindow) context.run(); } -TEST_F(Aio_Throttle, YieldingThrottleOverMax) +TEST(Aio_Throttle, YieldingThrottleOverMax) { constexpr uint64_t window = 4;