]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/rgw: ceph_test_rgw_throttle no longer needs rados
authorCasey Bodley <cbodley@redhat.com>
Thu, 2 Mar 2023 20:18:18 +0000 (15:18 -0500)
committerCasey Bodley <cbodley@redhat.com>
Sun, 12 Mar 2023 22:56:54 +0000 (18:56 -0400)
run it as a unittest instead of a workunit

Signed-off-by: Casey Bodley <cbodley@redhat.com>
qa/suites/rgw/verify/tasks/cls.yaml
qa/workunits/rgw/test_rgw_throttle.sh [deleted file]
src/test/rgw/CMakeLists.txt
src/test/rgw/test_rgw_throttle.cc

index 936c489bfe635f07b601e6bcfcb94dc604a32a58..e185796bc53c9502cef9a730bac253ada13e2f95 100644 (file)
@@ -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 (executable)
index f637b8f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh -e
-
-ceph_test_rgw_throttle
-
-exit 0
index 57d6696c776ae9966734a207bcdd1b7ef5a40a1f..96d157b7ced84335cbda7e13508f620c5ffe5563 100644 (file)
@@ -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_OBJECTS:unit-main>)
-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)
index d67f2c6ceb655e74d62451d376351a328565a1e1..72dae286cdd694ab8051a7cc772bc143737d5d34 100644 (file)
 #include <spawn/spawn.hpp>
 #include <gtest/gtest.h>
 
-struct RadosEnv : public ::testing::Environment {
- public:
-  static constexpr auto poolname = "ceph_test_rgw_throttle";
-
-  static std::optional<RGWSI_RADOS> 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<RGWSI_RADOS> 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;