From: Ronen Friedman Date: Wed, 5 Mar 2025 14:31:43 +0000 (-0600) Subject: tests: replace obsolete get_tracked_conf_keys() X-Git-Tag: v20.3.0~416^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=66077a8a49ebe7bab9b635336dffae6d67c52fbe;p=ceph.git tests: replace obsolete get_tracked_conf_keys() .. 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 --- diff --git a/src/test/librados_test_stub/TestRadosClient.cc b/src/test/librados_test_stub/TestRadosClient.cc index 1f49aba937ebb..d1fb629900baa 100644 --- a/src/test/librados_test_stub/TestRadosClient.cc +++ b/src/test/librados_test_stub/TestRadosClient.cc @@ -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::vectorTestRadosClient::get_tracked_keys() + const noexcept +{ + return { + "librados_thread_count"s + }; } void TestRadosClient::handle_conf_change( diff --git a/src/test/librados_test_stub/TestRadosClient.h b/src/test/librados_test_stub/TestRadosClient.h index e7f8d075175ef..c21f6200ab727 100644 --- a/src/test/librados_test_stub/TestRadosClient.h +++ b/src/test/librados_test_stub/TestRadosClient.h @@ -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 get_tracked_keys() const noexcept override; void handle_conf_change(const ConfigProxy& conf, const std::set &changed) override; diff --git a/src/test/msgr/test_async_networkstack.cc b/src/test/msgr/test_async_networkstack.cc index 14923fd7dfbfd..17c6db33e3560 100644 --- a/src/test/msgr/test_async_networkstack.cc +++ b/src/test/msgr/test_async_networkstack.cc @@ -31,26 +31,16 @@ #include "msg/async/Stack.h" using namespace std; +using namespace std::literals; class NoopConfigObserver : public md_config_obs_t { - std::list options; - const char **ptrs = 0; + std::vector options; public: - NoopConfigObserver(std::list 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 l) : options(l) {} + ~NoopConfigObserver() = default; + std::vector get_tracked_keys() const noexcept override { + return options; } void handle_conf_change(const ConfigProxy& conf, const std::set &changed) override {