style: clang-tidy auto fixes (#2930)

Fixes #2929.
This commit is contained in:
github-actions[bot]
2026-01-22 11:34:04 +00:00
committed by GitHub
parent a72e5a180f
commit 3bb3e0b9f9
8 changed files with 38 additions and 52 deletions

View File

@@ -23,15 +23,8 @@
#include "data/BackendInterface.hpp"
#include "etl/WriterState.hpp"
#include <boost/asio/bind_cancellation_slot.hpp>
#include <boost/asio/cancellation_type.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/execution_context.hpp>
#include <boost/asio/executor.hpp>
#include <boost/asio/spawn.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/asio/thread_pool.hpp>
#include <boost/asio/use_future.hpp>
#include <boost/json/parse.hpp>
#include <boost/json/serialize.hpp>
#include <boost/json/value.hpp>

View File

@@ -22,20 +22,6 @@
#include "data/BackendInterface.hpp"
#include "etl/WriterState.hpp"
#include <boost/asio/bind_cancellation_slot.hpp>
#include <boost/asio/cancellation_type.hpp>
#include <boost/asio/error.hpp>
#include <boost/asio/spawn.hpp>
#include <boost/asio/steady_timer.hpp>
#include <boost/asio/use_future.hpp>
#include <boost/json/parse.hpp>
#include <boost/json/serialize.hpp>
#include <boost/json/value.hpp>
#include <boost/json/value_from.hpp>
#include <boost/json/value_to.hpp>
#include <boost/uuid/random_generator.hpp>
#include <boost/uuid/uuid.hpp>
#include <chrono>
#include <ctime>
#include <memory>

View File

@@ -26,13 +26,9 @@
#include <boost/asio/thread_pool.hpp>
#include <boost/json/parse.hpp>
#include <boost/json/serialize.hpp>
#include <boost/json/value.hpp>
#include <boost/json/value_from.hpp>
#include <boost/json/value_to.hpp>
#include <boost/uuid/random_generator.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
@@ -91,7 +87,7 @@ TEST_F(ClusterBackendTest, SubscribeToNewState)
EXPECT_CALL(callbackMock, Call)
.Times(testing::AtLeast(1))
.WillRepeatedly([this](ClioNode::CUuid selfId, std::shared_ptr<Backend::ClusterData const> clusterData) {
SemaphoreReleaseGuard guard{semaphore};
SemaphoreReleaseGuard const guard{semaphore};
ASSERT_TRUE(clusterData->has_value());
EXPECT_EQ(clusterData->value().size(), 1);
auto const& nodeData = clusterData->value().front();
@@ -141,7 +137,7 @@ TEST_F(ClusterBackendTest, FetchClioNodesDataThrowsException)
EXPECT_CALL(callbackMock, Call)
.Times(testing::AtLeast(1))
.WillRepeatedly([this](ClioNode::CUuid, std::shared_ptr<Backend::ClusterData const> clusterData) {
SemaphoreReleaseGuard guard{semaphore};
SemaphoreReleaseGuard const guard{semaphore};
ASSERT_FALSE(clusterData->has_value());
EXPECT_EQ(clusterData->error(), "Failed to fetch Clio nodes data");
});
@@ -181,7 +177,7 @@ TEST_F(ClusterBackendTest, FetchClioNodesDataReturnsDataWithOtherNodes)
EXPECT_CALL(callbackMock, Call)
.Times(testing::AtLeast(1))
.WillRepeatedly([&](ClioNode::CUuid selfId, std::shared_ptr<Backend::ClusterData const> clusterData) {
SemaphoreReleaseGuard guard{semaphore};
SemaphoreReleaseGuard const guard{semaphore};
ASSERT_TRUE(clusterData->has_value()) << clusterData->error();
EXPECT_EQ(clusterData->value().size(), 2);
EXPECT_EQ(selfId, clusterBackend.selfId());
@@ -231,7 +227,7 @@ TEST_F(ClusterBackendTest, FetchClioNodesDataReturnsOnlySelfData)
EXPECT_CALL(callbackMock, Call)
.Times(testing::AtLeast(1))
.WillRepeatedly([this](ClioNode::CUuid selfId, std::shared_ptr<Backend::ClusterData const> clusterData) {
SemaphoreReleaseGuard guard{semaphore};
SemaphoreReleaseGuard const guard{semaphore};
ASSERT_TRUE(clusterData->has_value());
EXPECT_EQ(clusterData->value().size(), 1);
auto const& nodeData = clusterData->value().front();
@@ -269,7 +265,7 @@ TEST_F(ClusterBackendTest, FetchClioNodesDataReturnsInvalidJson)
EXPECT_CALL(callbackMock, Call)
.Times(testing::AtLeast(1))
.WillRepeatedly([this, invalidJson](ClioNode::CUuid, std::shared_ptr<Backend::ClusterData const> clusterData) {
SemaphoreReleaseGuard guard{semaphore};
SemaphoreReleaseGuard const guard{semaphore};
ASSERT_FALSE(clusterData->has_value());
EXPECT_THAT(clusterData->error(), testing::HasSubstr("Error parsing json from DB"));
EXPECT_THAT(clusterData->error(), testing::HasSubstr(invalidJson));
@@ -307,7 +303,7 @@ TEST_F(ClusterBackendTest, FetchClioNodesDataReturnsValidJsonButCannotConvertToC
EXPECT_CALL(callbackMock, Call)
.Times(testing::AtLeast(1))
.WillRepeatedly([this](ClioNode::CUuid, std::shared_ptr<Backend::ClusterData const> clusterData) {
SemaphoreReleaseGuard guard{semaphore};
SemaphoreReleaseGuard const guard{semaphore};
ASSERT_FALSE(clusterData->has_value());
EXPECT_THAT(clusterData->error(), testing::HasSubstr("Error converting json to ClioNode"));
});
@@ -334,7 +330,7 @@ TEST_F(ClusterBackendTest, WriteNodeMessageWritesSelfDataWithRecentTimestampAndD
EXPECT_CALL(*backend_, writeNodeMessage)
.Times(testing::AtLeast(1))
.WillRepeatedly([&](boost::uuids::uuid const& uuid, std::string message) {
SemaphoreReleaseGuard guard{semaphore};
SemaphoreReleaseGuard const guard{semaphore};
auto const afterWrite = std::chrono::system_clock::now();
EXPECT_EQ(uuid, *clusterBackend.selfId());

View File

@@ -72,7 +72,7 @@ struct ClusterCommunicationServiceTest : util::prometheus::WithPrometheus, MockB
static std::string
nodeToJson(ClioNode const& node)
{
boost::json::value v = boost::json::value_from(node);
boost::json::value const v = boost::json::value_from(node);
return boost::json::serialize(v);
}

View File

@@ -55,7 +55,7 @@ TEST_F(MetricsTest, InitializesMetricsOnConstruction)
EXPECT_CALL(nodesInClusterMock, set(1));
EXPECT_CALL(isHealthyMock, set(1));
Metrics metrics;
Metrics const metrics;
}
TEST_F(MetricsTest, OnNewStateWithValidClusterData)
@@ -68,14 +68,18 @@ TEST_F(MetricsTest, OnNewStateWithValidClusterData)
Metrics metrics;
ClioNode node1{.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer};
ClioNode node2{.uuid = uuid2, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::ReadOnly};
ClioNode node3{
ClioNode const node1{
.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer
};
ClioNode const node2{
.uuid = uuid2, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::ReadOnly
};
ClioNode const node3{
.uuid = uuid3, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::NotWriter
};
std::vector<ClioNode> nodes = {node1, node2, node3};
Backend::ClusterData clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
std::vector<ClioNode> const nodes = {node1, node2, node3};
Backend::ClusterData const clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
auto sharedClusterData = std::make_shared<Backend::ClusterData>(clusterData);
EXPECT_CALL(isHealthyMock, set(1));
@@ -94,8 +98,8 @@ TEST_F(MetricsTest, OnNewStateWithEmptyClusterData)
Metrics metrics;
std::vector<ClioNode> nodes = {};
Backend::ClusterData clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
std::vector<ClioNode> const nodes = {};
Backend::ClusterData const clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
auto sharedClusterData = std::make_shared<Backend::ClusterData>(clusterData);
EXPECT_CALL(isHealthyMock, set(1));
@@ -114,7 +118,7 @@ TEST_F(MetricsTest, OnNewStateWithFailedClusterData)
Metrics metrics;
Backend::ClusterData clusterData =
Backend::ClusterData const clusterData =
std::expected<std::vector<ClioNode>, std::string>(std::unexpected("Connection failed"));
auto sharedClusterData = std::make_shared<Backend::ClusterData>(clusterData);
@@ -134,10 +138,12 @@ TEST_F(MetricsTest, OnNewStateWithSingleNode)
Metrics metrics;
ClioNode node1{.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer};
ClioNode const node1{
.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer
};
std::vector<ClioNode> nodes = {node1};
Backend::ClusterData clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
std::vector<ClioNode> const nodes = {node1};
Backend::ClusterData const clusterData = std::expected<std::vector<ClioNode>, std::string>(nodes);
auto sharedClusterData = std::make_shared<Backend::ClusterData>(clusterData);
EXPECT_CALL(isHealthyMock, set(1));
@@ -156,7 +162,7 @@ TEST_F(MetricsTest, OnNewStateRecoveryFromFailure)
Metrics metrics;
Backend::ClusterData clusterData1 =
Backend::ClusterData const clusterData1 =
std::expected<std::vector<ClioNode>, std::string>(std::unexpected("Connection timeout"));
auto sharedClusterData1 = std::make_shared<Backend::ClusterData>(clusterData1);
@@ -165,11 +171,15 @@ TEST_F(MetricsTest, OnNewStateRecoveryFromFailure)
metrics.onNewState(uuid1, sharedClusterData1);
ClioNode node1{.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer};
ClioNode node2{.uuid = uuid2, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::ReadOnly};
ClioNode const node1{
.uuid = uuid1, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::Writer
};
ClioNode const node2{
.uuid = uuid2, .updateTime = std::chrono::system_clock::now(), .dbRole = ClioNode::DbRole::ReadOnly
};
std::vector<ClioNode> nodes = {node1, node2};
Backend::ClusterData clusterData2 = std::expected<std::vector<ClioNode>, std::string>(nodes);
std::vector<ClioNode> const nodes = {node1, node2};
Backend::ClusterData const clusterData2 = std::expected<std::vector<ClioNode>, std::string>(nodes);
auto sharedClusterData2 = std::make_shared<Backend::ClusterData>(clusterData2);
EXPECT_CALL(isHealthyMock, set(1));

View File

@@ -898,7 +898,7 @@ TEST_F(ETLServiceTests, WriteCommandsAreSerializedOnStrand)
// Set up expectations for the sequence of write commands
// The signals should be processed in order: StartWriting, StopWriting, StartWriting
{
testing::InSequence seq;
testing::InSequence const seq;
// First StartWriting
EXPECT_CALL(mockWriteSignalCommandCallback_, Call(etl::SystemState::WriteCommand::StartWriting));

View File

@@ -19,6 +19,7 @@
#include "data/Types.hpp"
#include "etl/InitialLoadObserverInterface.hpp"
#include "etl/LoaderInterface.hpp"
#include "etl/Models.hpp"
#include "etl/RegistryInterface.hpp"
#include "etl/SystemState.hpp"

View File

@@ -260,7 +260,7 @@ struct RegistryTest : util::prometheus::WithPrometheus {
}
protected:
etl::SystemState state_{};
etl::SystemState state_;
};
} // namespace