]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests: replace obsolete get_tracked_conf_keys() 62133/head
authorRonen Friedman <rfriedma@redhat.com>
Wed, 5 Mar 2025 14:31:43 +0000 (08:31 -0600)
committerRonen Friedman <rfriedma@redhat.com>
Wed, 5 Mar 2025 14:31:43 +0000 (08:31 -0600)
.. with get_tracked_keys().

Following https://github.com/ceph/ceph/pull/61394,
all uses of the deprecated interface will be updated,
and that old interface will be removed.

Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
src/test/librados_test_stub/TestRadosClient.cc
src/test/librados_test_stub/TestRadosClient.h
src/test/msgr/test_async_networkstack.cc

index 1f49aba937ebb25a2082a48d60edba08dafee398..d1fb629900baa74aa7732b6ded2dfe5b210605e3 100644 (file)
@@ -32,18 +32,10 @@ static int get_concurrency() {
 }
 
 using namespace std::placeholders;
+using namespace std::literals;
 
 namespace librados {
 
-namespace {
-
-const char *config_keys[] = {
-  "librados_thread_count",
-  NULL
-};
-
-} // anonymous namespace
-
 static void finish_aio_completion(AioCompletionImpl *c, int r) {
   c->lock.lock();
   c->complete = true;
@@ -142,8 +134,12 @@ boost::asio::io_context& TestRadosClient::get_io_context() {
   return m_io_context_pool->get_io_context();
 }
 
-const char** TestRadosClient::get_tracked_conf_keys() const {
-  return config_keys;
+std::vector<std::string>TestRadosClient::get_tracked_keys()
+    const noexcept
+{
+  return {
+    "librados_thread_count"s
+  };
 }
 
 void TestRadosClient::handle_conf_change(
index e7f8d075175ef87d788bc692ef5730098c890745..c21f6200ab7276f4bf3a3e73edbba42f121db805 100644 (file)
@@ -136,7 +136,7 @@ protected:
   virtual void transaction_finish(const std::string& nspace,
                                   const std::string &oid) = 0;
 
-  const char** get_tracked_conf_keys() const override;
+  std::vector<std::string> get_tracked_keys() const noexcept override;
   void handle_conf_change(const ConfigProxy& conf,
                           const std::set<std::string> &changed) override;
 
index 14923fd7dfbfd385aa9a576d85fa1dc20da29f0a..17c6db33e3560e41e5acb6becaa4374deb239cd7 100644 (file)
 #include "msg/async/Stack.h"
 
 using namespace std;
+using namespace std::literals;
 
 class NoopConfigObserver : public md_config_obs_t {
-  std::list<std::string> options;
-  const char **ptrs = 0;
+  std::vector<std::string> options;
 
 public:
-  NoopConfigObserver(std::list<std::string> l) : options(l) {
-    ptrs = new const char*[options.size() + 1];
-    unsigned j = 0;
-    for (auto& i : options) {
-      ptrs[j++] = i.c_str();
-    }
-    ptrs[j] = 0;
-  }
-  ~NoopConfigObserver() {
-    delete[] ptrs;
-  }
-
-  const char** get_tracked_conf_keys() const override {
-    return ptrs;
+  NoopConfigObserver(std::vector<std::string> l) : options(l) {}
+  ~NoopConfigObserver() = default;
+  std::vector<std::string> get_tracked_keys() const noexcept override {
+    return options;
   }
   void handle_conf_change(const ConfigProxy& conf,
                          const std::set <std::string> &changed) override {