Skip to content

Commit 3bb3e0b

Browse files
style: clang-tidy auto fixes (#2930)
Fixes #2929.
1 parent a72e5a1 commit 3bb3e0b

File tree

8 files changed

+38
-52
lines changed

8 files changed

+38
-52
lines changed

src/cluster/Backend.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,8 @@
2323
#include "data/BackendInterface.hpp"
2424
#include "etl/WriterState.hpp"
2525

26-
#include <boost/asio/bind_cancellation_slot.hpp>
27-
#include <boost/asio/cancellation_type.hpp>
28-
#include <boost/asio/error.hpp>
29-
#include <boost/asio/execution_context.hpp>
30-
#include <boost/asio/executor.hpp>
3126
#include <boost/asio/spawn.hpp>
32-
#include <boost/asio/steady_timer.hpp>
3327
#include <boost/asio/thread_pool.hpp>
34-
#include <boost/asio/use_future.hpp>
3528
#include <boost/json/parse.hpp>
3629
#include <boost/json/serialize.hpp>
3730
#include <boost/json/value.hpp>

src/cluster/ClusterCommunicationService.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,6 @@
2222
#include "data/BackendInterface.hpp"
2323
#include "etl/WriterState.hpp"
2424

25-
#include <boost/asio/bind_cancellation_slot.hpp>
26-
#include <boost/asio/cancellation_type.hpp>
27-
#include <boost/asio/error.hpp>
28-
#include <boost/asio/spawn.hpp>
29-
#include <boost/asio/steady_timer.hpp>
30-
#include <boost/asio/use_future.hpp>
31-
#include <boost/json/parse.hpp>
32-
#include <boost/json/serialize.hpp>
33-
#include <boost/json/value.hpp>
34-
#include <boost/json/value_from.hpp>
35-
#include <boost/json/value_to.hpp>
36-
#include <boost/uuid/random_generator.hpp>
37-
#include <boost/uuid/uuid.hpp>
38-
3925
#include <chrono>
4026
#include <ctime>
4127
#include <memory>

tests/unit/cluster/BackendTests.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,9 @@
2626

2727
#include <boost/asio/thread_pool.hpp>
2828
#include <boost/json/parse.hpp>
29-
#include <boost/json/serialize.hpp>
30-
#include <boost/json/value.hpp>
31-
#include <boost/json/value_from.hpp>
3229
#include <boost/json/value_to.hpp>
3330
#include <boost/uuid/random_generator.hpp>
3431
#include <boost/uuid/uuid.hpp>
35-
#include <boost/uuid/uuid_io.hpp>
3632
#include <gmock/gmock.h>
3733
#include <gtest/gtest.h>
3834

@@ -91,7 +87,7 @@ TEST_F(ClusterBackendTest, SubscribeToNewState)
9187
EXPECT_CALL(callbackMock, Call)
9288
.Times(testing::AtLeast(1))
9389
.WillRepeatedly([this](ClioNode::CUuid selfId, std::shared_ptr<Backend::ClusterData const> clusterData) {
94-
SemaphoreReleaseGuard guard{semaphore};
90+
SemaphoreReleaseGuard const guard{semaphore};
9591
ASSERT_TRUE(clusterData->has_value());
9692
EXPECT_EQ(clusterData->value().size(), 1);
9793
auto const& nodeData = clusterData->value().front();
@@ -141,7 +137,7 @@ TEST_F(ClusterBackendTest, FetchClioNodesDataThrowsException)
141137
EXPECT_CALL(callbackMock, Call)
142138
.Times(testing::AtLeast(1))
143139
.WillRepeatedly([this](ClioNode::CUuid, std::shared_ptr<Backend::ClusterData const> clusterData) {
144-
SemaphoreReleaseGuard guard{semaphore};
140+
SemaphoreReleaseGuard const guard{semaphore};
145141
ASSERT_FALSE(clusterData->has_value());
146142
EXPECT_EQ(clusterData->error(), "Failed to fetch Clio nodes data");
147143
});
@@ -181,7 +177,7 @@ TEST_F(ClusterBackendTest, FetchClioNodesDataReturnsDataWithOtherNodes)
181177
EXPECT_CALL(callbackMock, Call)
182178
.Times(testing::AtLeast(1))
183179
.WillRepeatedly([&](ClioNode::CUuid selfId, std::shared_ptr<Backend::ClusterData const> clusterData) {
184-
SemaphoreReleaseGuard guard{semaphore};
180+
SemaphoreReleaseGuard const guard{semaphore};
185181
ASSERT_TRUE(clusterData->has_value()) << clusterData->error();
186182
EXPECT_EQ(clusterData->value().size(), 2);
187183
EXPECT_EQ(selfId, clusterBackend.selfId());
@@ -231,7 +227,7 @@ TEST_F(ClusterBackendTest, FetchClioNodesDataReturnsOnlySelfData)
231227
EXPECT_CALL(callbackMock, Call)
232228
.Times(testing::AtLeast(1))
233229
.WillRepeatedly([this](ClioNode::CUuid selfId, std::shared_ptr<Backend::ClusterData const> clusterData) {
234-
SemaphoreReleaseGuard guard{semaphore};
230+
SemaphoreReleaseGuard const guard{semaphore};
235231
ASSERT_TRUE(clusterData->has_value());
236232
EXPECT_EQ(clusterData->value().size(), 1);
237233
auto const& nodeData = clusterData->value().front();
@@ -269,7 +265,7 @@ TEST_F(ClusterBackendTest, FetchClioNodesDataReturnsInvalidJson)
269265
EXPECT_CALL(callbackMock, Call)
270266
.Times(testing::AtLeast(1))
271267
.WillRepeatedly([this, invalidJson](ClioNode::CUuid, std::shared_ptr<Backend::ClusterData const> clusterData) {
272-
SemaphoreReleaseGuard guard{semaphore};
268+
SemaphoreReleaseGuard const guard{semaphore};
273269
ASSERT_FALSE(clusterData->has_value());
274270
EXPECT_THAT(clusterData->error(), testing::HasSubstr("Error parsing json from DB"));
275271
EXPECT_THAT(clusterData->error(), testing::HasSubstr(invalidJson));
@@ -307,7 +303,7 @@ TEST_F(ClusterBackendTest, FetchClioNodesDataReturnsValidJsonButCannotConvertToC
307303
EXPECT_CALL(callbackMock, Call)
308304
.Times(testing::AtLeast(1))
309305
.WillRepeatedly([this](ClioNode::CUuid, std::shared_ptr<Backend::ClusterData const> clusterData) {
310-
SemaphoreReleaseGuard guard{semaphore};
306+
SemaphoreReleaseGuard const guard{semaphore};
311307
ASSERT_FALSE(clusterData->has_value());
312308
EXPECT_THAT(clusterData->error(), testing::HasSubstr("Error converting json to ClioNode"));
313309
});
@@ -334,7 +330,7 @@ TEST_F(ClusterBackendTest, WriteNodeMessageWritesSelfDataWithRecentTimestampAndD
334330
EXPECT_CALL(*backend_, writeNodeMessage)
335331
.Times(testing::AtLeast(1))
336332
.WillRepeatedly([&](boost::uuids::uuid const& uuid, std::string message) {
337-
SemaphoreReleaseGuard guard{semaphore};
333+
SemaphoreReleaseGuard const guard{semaphore};
338334
auto const afterWrite = std::chrono::system_clock::now();
339335

340336
EXPECT_EQ(uuid, *clusterBackend.selfId());

tests/unit/cluster/ClusterCommunicationServiceTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct ClusterCommunicationServiceTest : util::prometheus::WithPrometheus, MockB
7272
static std::string
7373
nodeToJson(ClioNode const& node)
7474
{
75-
boost::json::value v = boost::json::value_from(node);
75+
boost::json::value const v = boost::json::value_from(node);
7676
return boost::json::serialize(v);
7777
}
7878

tests/unit/cluster/MetricsTests.cpp

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ TEST_F(MetricsTest, InitializesMetricsOnConstruction)
5555
EXPECT_CALL(nodesInClusterMock, set(1));
5656
EXPECT_CALL(isHealthyMock, set(1));
5757

58-
Metrics metrics;
58+
Metrics const metrics;
5959
}
6060

6161
TEST_F(MetricsTest, OnNewStateWithValidClusterData)
@@ -68,14 +68,18 @@ TEST_F(MetricsTest, OnNewStateWithValidClusterData)
6868

6969
Metrics metrics;
7070

71-
ClioNode node1{.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer};
72-
ClioNode node2{.uuid = uuid2, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::ReadOnly};
73-
ClioNode node3{
71+
ClioNode const node1{
72+
.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer
73+
};
74+
ClioNode const node2{
75+
.uuid = uuid2, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::ReadOnly
76+
};
77+
ClioNode const node3{
7478
.uuid = uuid3, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::NotWriter
7579
};
7680

77-
std::vector<ClioNode> nodes = {node1, node2, node3};
78-
Backend::ClusterData clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
81+
std::vector<ClioNode> const nodes = {node1, node2, node3};
82+
Backend::ClusterData const clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
7983
auto sharedClusterData = std::make_shared<Backend::ClusterData>(clusterData);
8084

8185
EXPECT_CALL(isHealthyMock, set(1));
@@ -94,8 +98,8 @@ TEST_F(MetricsTest, OnNewStateWithEmptyClusterData)
9498

9599
Metrics metrics;
96100

97-
std::vector<ClioNode> nodes = {};
98-
Backend::ClusterData clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
101+
std::vector<ClioNode> const nodes = {};
102+
Backend::ClusterData const clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
99103
auto sharedClusterData = std::make_shared<Backend::ClusterData>(clusterData);
100104

101105
EXPECT_CALL(isHealthyMock, set(1));
@@ -114,7 +118,7 @@ TEST_F(MetricsTest, OnNewStateWithFailedClusterData)
114118

115119
Metrics metrics;
116120

117-
Backend::ClusterData clusterData =
121+
Backend::ClusterData const clusterData =
118122
std::expected<std::vector<ClioNode>, std::string>(std::unexpected("Connection failed"));
119123
auto sharedClusterData = std::make_shared<Backend::ClusterData>(clusterData);
120124

@@ -134,10 +138,12 @@ TEST_F(MetricsTest, OnNewStateWithSingleNode)
134138

135139
Metrics metrics;
136140

137-
ClioNode node1{.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer};
141+
ClioNode const node1{
142+
.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer
143+
};
138144

139-
std::vector<ClioNode> nodes = {node1};
140-
Backend::ClusterData clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
145+
std::vector<ClioNode> const nodes = {node1};
146+
Backend::ClusterData const clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
141147
auto sharedClusterData = std::make_shared<Backend::ClusterData>(clusterData);
142148

143149
EXPECT_CALL(isHealthyMock, set(1));
@@ -156,7 +162,7 @@ TEST_F(MetricsTest, OnNewStateRecoveryFromFailure)
156162

157163
Metrics metrics;
158164

159-
Backend::ClusterData clusterData1 =
165+
Backend::ClusterData const clusterData1 =
160166
std::expected<std::vector<ClioNode>, std::string>(std::unexpected("Connection timeout"));
161167
auto sharedClusterData1 = std::make_shared<Backend::ClusterData>(clusterData1);
162168

@@ -165,11 +171,15 @@ TEST_F(MetricsTest, OnNewStateRecoveryFromFailure)
165171

166172
metrics.onNewState(uuid1, sharedClusterData1);
167173

168-
ClioNode node1{.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer};
169-
ClioNode node2{.uuid = uuid2, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::ReadOnly};
174+
ClioNode const node1{
175+
.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer
176+
};
177+
ClioNode const node2{
178+
.uuid = uuid2, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::ReadOnly
179+
};
170180

171-
std::vector<ClioNode> nodes = {node1, node2};
172-
Backend::ClusterData clusterData2 = std::expected<std::vector<ClioNode>, std::string>(nodes);
181+
std::vector<ClioNode> const nodes = {node1, node2};
182+
Backend::ClusterData const clusterData2 = std::expected<std::vector<ClioNode>, std::string>(nodes);
173183
auto sharedClusterData2 = std::make_shared<Backend::ClusterData>(clusterData2);
174184

175185
EXPECT_CALL(isHealthyMock, set(1));

tests/unit/etl/ETLServiceTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -898,7 +898,7 @@ TEST_F(ETLServiceTests, WriteCommandsAreSerializedOnStrand)
898898
// Set up expectations for the sequence of write commands
899899
// The signals should be processed in order: StartWriting, StopWriting, StartWriting
900900
{
901-
testing::InSequence seq;
901+
testing::InSequence const seq;
902902

903903
// First StartWriting
904904
EXPECT_CALL(mockWriteSignalCommandCallback_, Call(etl::SystemState::WriteCommand::StartWriting));

tests/unit/etl/LoadingTests.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include "data/Types.hpp"
2121
#include "etl/InitialLoadObserverInterface.hpp"
22+
#include "etl/LoaderInterface.hpp"
2223
#include "etl/Models.hpp"
2324
#include "etl/RegistryInterface.hpp"
2425
#include "etl/SystemState.hpp"

tests/unit/etl/RegistryTests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ struct RegistryTest : util::prometheus::WithPrometheus {
260260
}
261261

262262
protected:
263-
etl::SystemState state_{};
263+
etl::SystemState state_;
264264
};
265265

266266
} // namespace

0 commit comments

Comments
 (0)