Add clang tidy (#864)

Fixes #863
This commit is contained in:
Sergey Kuznetsov
2023-10-03 10:43:54 +01:00
committed by GitHub
parent 69f5025a29
commit 4b53bef1f5
198 changed files with 2168 additions and 1288 deletions

View File

@@ -33,7 +33,7 @@ using namespace data::cassandra;
class BackendCassandraBaseTest : public NoLoggerFixture
{
protected:
Handle
static Handle
createHandle(std::string_view contactPoints, std::string_view keyspace)
{
Handle handle{contactPoints};
@@ -50,14 +50,14 @@ protected:
return handle;
}
void
static void
dropKeyspace(Handle const& handle, std::string_view keyspace)
{
std::string query = "DROP KEYSPACE " + std::string{keyspace};
std::string const query = "DROP KEYSPACE " + std::string{keyspace};
ASSERT_TRUE(handle.execute(query));
}
void
static void
prepStringsTable(Handle const& handle)
{
auto const entries = std::vector<std::string>{
@@ -79,12 +79,13 @@ protected:
auto const rc = f1.await();
ASSERT_TRUE(rc) << rc.error();
std::string q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
std::string const q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
auto const insert = handle.prepare(q2);
std::vector<Statement> statements;
int64_t idx = 1000;
statements.reserve(entries.size());
for (auto const& entry : entries)
statements.push_back(insert.bind(entry, idx++));
@@ -95,7 +96,7 @@ protected:
TEST_F(BackendCassandraBaseTest, ConnectionSuccess)
{
Handle handle{"127.0.0.1"};
Handle const handle{"127.0.0.1"};
auto const f = handle.asyncConnect();
auto const res = f.await();
@@ -104,7 +105,7 @@ TEST_F(BackendCassandraBaseTest, ConnectionSuccess)
TEST_F(BackendCassandraBaseTest, ConnectionFailFormat)
{
Handle handle{"127.0.0."};
Handle const handle{"127.0.0."};
auto const f = handle.asyncConnect();
auto const res = f.await();
@@ -119,7 +120,7 @@ TEST_F(BackendCassandraBaseTest, ConnectionFailTimeout)
settings.connectionTimeout = std::chrono::milliseconds{30};
settings.connectionInfo = Settings::ContactPoints{"127.0.0.2"};
Handle handle{settings};
Handle const handle{settings};
auto const f = handle.asyncConnect();
auto const res = f.await();
@@ -132,7 +133,7 @@ TEST_F(BackendCassandraBaseTest, ConnectionFailTimeout)
TEST_F(BackendCassandraBaseTest, FutureCallback)
{
Handle handle{"127.0.0.1"};
Handle const handle{"127.0.0.1"};
ASSERT_TRUE(handle.connect());
auto const statement = handle.prepare("SELECT keyspace_name FROM system_schema.keyspaces").bind();
@@ -153,7 +154,7 @@ TEST_F(BackendCassandraBaseTest, FutureCallback)
TEST_F(BackendCassandraBaseTest, FutureCallbackSurviveMove)
{
Handle handle{"127.0.0.1"};
Handle const handle{"127.0.0.1"};
ASSERT_TRUE(handle.connect());
auto const statement = handle.prepare("SELECT keyspace_name FROM system_schema.keyspaces").bind();
@@ -180,7 +181,7 @@ TEST_F(BackendCassandraBaseTest, FutureCallbackSurviveMove)
TEST_F(BackendCassandraBaseTest, KeyspaceManipulation)
{
Handle handle{"127.0.0.1"};
Handle const handle{"127.0.0.1"};
std::string keyspace = "test_keyspace_manipulation";
{
@@ -245,7 +246,7 @@ TEST_F(BackendCassandraBaseTest, CreateTableWithStrings)
ASSERT_TRUE(rc) << rc.error();
}
std::string q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
std::string const q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
auto insert = handle.prepare(q2);
// write data
@@ -253,6 +254,7 @@ TEST_F(BackendCassandraBaseTest, CreateTableWithStrings)
std::vector<Future> futures;
int64_t idx = 1000;
futures.reserve(entries.size());
for (auto const& entry : entries)
futures.push_back(handle.asyncExecute(insert, entry, idx++));
@@ -308,7 +310,7 @@ TEST_F(BackendCassandraBaseTest, BatchInsert)
ASSERT_TRUE(rc) << rc.error();
}
std::string q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
std::string const q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
auto const insert = handle.prepare(q2);
// write data in bulk
@@ -316,6 +318,7 @@ TEST_F(BackendCassandraBaseTest, BatchInsert)
std::vector<Statement> statements;
int64_t idx = 1000;
statements.reserve(entries.size());
for (auto const& entry : entries)
statements.push_back(insert.bind(entry, idx++));
@@ -363,7 +366,7 @@ TEST_F(BackendCassandraBaseTest, BatchInsertAsync)
auto const rc = f1.await();
ASSERT_TRUE(rc) << rc.error();
std::string q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
std::string const q2 = "INSERT INTO strings (hash, sequence) VALUES (?, ?)";
auto const insert = handle.prepare(q2);
// write data in bulk
@@ -375,6 +378,7 @@ TEST_F(BackendCassandraBaseTest, BatchInsertAsync)
std::vector<Statement> statements;
int64_t idx = 1000;
statements.reserve(entries.size());
for (auto const& entry : entries)
statements.push_back(insert.bind(entry, idx++));
@@ -405,7 +409,7 @@ TEST_F(BackendCassandraBaseTest, AlterTableAddColumn)
5000);
ASSERT_TRUE(handle.execute(q1));
std::string update = "ALTER TABLE strings ADD tmp blob";
std::string const update = "ALTER TABLE strings ADD tmp blob";
ASSERT_TRUE(handle.execute(update));
dropKeyspace(handle, "test");