Skip to content

Commit 2cbe2a2

Browse files
committed
[cluster_test] clang-tidy clustertest.*
* Some utility methods should be static * Use the vbid passed as a parameter rather than vbid{0} * const some variables Change-Id: I0584dc96568358158b6382940c0136c82c3340b5 Reviewed-on: https://review.couchbase.org/c/kv_engine/+/203186 Tested-by: Build Bot <[email protected]> Reviewed-by: Vesko Karaganev <[email protected]>
1 parent 3979895 commit 2cbe2a2

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

tests/testapp_cluster/clustertest.cc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,22 +85,23 @@ void cb::test::ClusterTest::TearDown() {
8585
}
8686

8787
void cb::test::ClusterTest::getReplica(MemcachedConnection& conn,
88-
Vbid vbid,
88+
const Vbid vbid,
8989
const std::string& key) {
9090
BinprotResponse rsp;
9191
do {
9292
BinprotGenericCommand cmd(cb::mcbp::ClientOpcode::GetReplica);
93-
cmd.setVBucket(Vbid(0));
93+
cmd.setVBucket(vbid);
9494
cmd.setKey(key);
9595

9696
rsp = conn.execute(cmd);
9797
} while (rsp.getStatus() == cb::mcbp::Status::KeyEnoent);
98-
EXPECT_TRUE(rsp.isSuccess());
98+
EXPECT_TRUE(rsp.isSuccess())
99+
<< rsp.getStatus() << ": " << rsp.getDataView();
99100
}
100101

101102
cb::test::MemStats cb::test::ClusterTest::getMemStats(
102103
MemcachedConnection& conn) {
103-
auto stats = conn.stats("memory");
104+
const auto stats = conn.stats("memory");
104105
return MemStats{
105106
stats["mem_used"].get<size_t>(),
106107
stats["ep_mem_low_wat"].get<size_t>(),
@@ -111,12 +112,13 @@ cb::test::MemStats cb::test::ClusterTest::getMemStats(
111112
void cb::test::ClusterTest::setFlushParam(MemcachedConnection& conn,
112113
const std::string& paramName,
113114
const std::string& paramValue) {
114-
auto cmd = BinprotSetParamCommand(
115+
const auto cmd = BinprotSetParamCommand(
115116
cb::mcbp::request::SetParamPayload::Type::Flush,
116117
paramName,
117118
paramValue);
118-
const auto resp = BinprotMutationResponse(conn.execute(cmd));
119-
EXPECT_EQ(cb::mcbp::Status::Success, resp.getStatus());
119+
const auto resp = conn.execute(cmd);
120+
EXPECT_EQ(cb::mcbp::Status::Success, resp.getStatus())
121+
<< resp.getDataView();
120122
}
121123

122124
void cb::test::ClusterTest::setMemWatermarks(MemcachedConnection& conn,

tests/testapp_cluster/clustertest.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ class ClusterTest : public ::testing::Test {
6767
// per test tear-down function.
6868
void TearDown() override;
6969

70-
void getReplica(MemcachedConnection& conn,
71-
Vbid vbid,
72-
const std::string& key);
70+
static void getReplica(MemcachedConnection& conn,
71+
Vbid vbid,
72+
const std::string& key);
7373

74-
MemStats getMemStats(MemcachedConnection& conn);
74+
static MemStats getMemStats(MemcachedConnection& conn);
7575

76-
void setFlushParam(MemcachedConnection& conn,
77-
const std::string& paramName,
78-
const std::string& paramValue);
76+
static void setFlushParam(MemcachedConnection& conn,
77+
const std::string& paramName,
78+
const std::string& paramValue);
7979

80-
void setMemWatermarks(MemcachedConnection& conn,
81-
size_t memLowWat,
82-
size_t memHighWat);
80+
static void setMemWatermarks(MemcachedConnection& conn,
81+
size_t memLowWat,
82+
size_t memHighWat);
8383

8484
static std::unique_ptr<Cluster> cluster;
8585
};

0 commit comments

Comments
 (0)