Skip to content

Commit 66077a8

Browse files
committed
tests: replace obsolete get_tracked_conf_keys()
.. with get_tracked_keys(). Following ceph#61394, all uses of the deprecated interface will be updated, and that old interface will be removed. Signed-off-by: Ronen Friedman <[email protected]>
1 parent aed35de commit 66077a8

File tree

3 files changed

+14
-28
lines changed

3 files changed

+14
-28
lines changed

src/test/librados_test_stub/TestRadosClient.cc

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,10 @@ static int get_concurrency() {
3232
}
3333

3434
using namespace std::placeholders;
35+
using namespace std::literals;
3536

3637
namespace librados {
3738

38-
namespace {
39-
40-
const char *config_keys[] = {
41-
"librados_thread_count",
42-
NULL
43-
};
44-
45-
} // anonymous namespace
46-
4739
static void finish_aio_completion(AioCompletionImpl *c, int r) {
4840
c->lock.lock();
4941
c->complete = true;
@@ -142,8 +134,12 @@ boost::asio::io_context& TestRadosClient::get_io_context() {
142134
return m_io_context_pool->get_io_context();
143135
}
144136

145-
const char** TestRadosClient::get_tracked_conf_keys() const {
146-
return config_keys;
137+
std::vector<std::string>TestRadosClient::get_tracked_keys()
138+
const noexcept
139+
{
140+
return {
141+
"librados_thread_count"s
142+
};
147143
}
148144

149145
void TestRadosClient::handle_conf_change(

src/test/librados_test_stub/TestRadosClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ class TestRadosClient : public md_config_obs_t {
136136
virtual void transaction_finish(const std::string& nspace,
137137
const std::string &oid) = 0;
138138

139-
const char** get_tracked_conf_keys() const override;
139+
std::vector<std::string> get_tracked_keys() const noexcept override;
140140
void handle_conf_change(const ConfigProxy& conf,
141141
const std::set<std::string> &changed) override;
142142

src/test/msgr/test_async_networkstack.cc

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,16 @@
3131
#include "msg/async/Stack.h"
3232

3333
using namespace std;
34+
using namespace std::literals;
3435

3536
class NoopConfigObserver : public md_config_obs_t {
36-
std::list<std::string> options;
37-
const char **ptrs = 0;
37+
std::vector<std::string> options;
3838

3939
public:
40-
NoopConfigObserver(std::list<std::string> l) : options(l) {
41-
ptrs = new const char*[options.size() + 1];
42-
unsigned j = 0;
43-
for (auto& i : options) {
44-
ptrs[j++] = i.c_str();
45-
}
46-
ptrs[j] = 0;
47-
}
48-
~NoopConfigObserver() {
49-
delete[] ptrs;
50-
}
51-
52-
const char** get_tracked_conf_keys() const override {
53-
return ptrs;
40+
NoopConfigObserver(std::vector<std::string> l) : options(l) {}
41+
~NoopConfigObserver() = default;
42+
std::vector<std::string> get_tracked_keys() const noexcept override {
43+
return options;
5444
}
5545
void handle_conf_change(const ConfigProxy& conf,
5646
const std::set <std::string> &changed) override {

0 commit comments

Comments
 (0)