Skip to content

Commit

Permalink
fix clang-tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
empiredan committed Jan 23, 2025
1 parent 5e7105a commit 179299f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
1 change: 0 additions & 1 deletion src/server/pegasus_write_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ class pegasus_write_service : dsn::replication::replica_base
private:
void clear_up_batch_states();

private:
friend class pegasus_write_service_test;
friend class PegasusWriteServiceImplTest;
friend class pegasus_server_write_test;
Expand Down
1 change: 0 additions & 1 deletion src/server/pegasus_write_service_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,6 @@ class pegasus_write_service::impl : public dsn::replication::replica_base
return false;
}

private:
friend class pegasus_write_service_test;
friend class pegasus_server_write_test;
friend class PegasusWriteServiceImplTest;
Expand Down
27 changes: 12 additions & 15 deletions src/server/test/pegasus_write_service_impl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
#include "server/pegasus_write_service_impl.h"
#include "server/rocksdb_wrapper.h"
#include "utils/blob.h"
#include "utils/defer.h"
#include "utils/fail_point.h"
#include <string_view>

namespace pegasus {
namespace server {
namespace pegasus::server {

class PegasusWriteServiceImplTest : public pegasus_server_test_base
{
Expand Down Expand Up @@ -150,18 +150,18 @@ class IncrTest : public PegasusWriteServiceImplTest
}

// Test if the result in response is correct while no error is returned.
virtual void test_incr(const int64_t base, const int64_t increment) = 0;
virtual void test_incr(int64_t base, int64_t increment) = 0;

// Test if both the result in response and the value in db are correct while no error
// is returned.
void test_incr_and_check_db_record(const int64_t base, const int64_t increment)
void test_incr_and_check_db_record(int64_t base, int64_t increment)
{
test_incr(base, increment);
check_db_record(base + increment);
}

// Test if incr could be executed correctly while the key does not exist in db previously.
void test_incr_on_absent_record(const int64_t increment)
void test_incr_on_absent_record(int64_t increment)
{
// Ensure that the key is absent.
db_get_context get_ctx;
Expand All @@ -173,7 +173,7 @@ class IncrTest : public PegasusWriteServiceImplTest
}

// Test if incr could be executed correctly while the key has existed in db.
void test_incr_on_existing_record(const int64_t base, const int64_t increment)
void test_incr_on_existing_record(int64_t base, int64_t increment)
{
// Load a record beforehand as the existing one.
single_set(req.key, dsn::blob::create_from_numeric(base));
Expand All @@ -188,16 +188,14 @@ class IncrTest : public PegasusWriteServiceImplTest
class NonIdempotentIncrTest : public IncrTest
{
public:
void test_non_idempotent_incr(const int64_t increment,
const int expected_ret_err,
const int expected_resp_err)
void test_non_idempotent_incr(int64_t increment, int expected_ret_err, int expected_resp_err)
{
req.increment = increment;
ASSERT_EQ(expected_ret_err, _write_impl->incr(0, req, resp));
ASSERT_EQ(expected_resp_err, resp.error);
}

void test_incr(const int64_t base, const int64_t increment) override
void test_incr(int64_t base, int64_t increment) override
{
test_non_idempotent_incr(increment, rocksdb::Status::kOk, rocksdb::Status::kOk);
ASSERT_EQ(base + increment, resp.new_value);
Expand Down Expand Up @@ -292,7 +290,7 @@ class IdempotentIncrTest : public IncrTest
{
public:
// Test make_idempotent for incr.
void test_make_idempotent(const int64_t increment, const int expected_err)
void test_make_idempotent(int64_t increment, int expected_err)
{
req.increment = increment;
const int err = _write_impl->make_idempotent(req, err_resp, update);
Expand All @@ -306,7 +304,7 @@ class IdempotentIncrTest : public IncrTest

// Test if make_idempotent for incr is successful; then, write the idempotent put
// request into db.
void test_idempotent_incr(const int64_t increment, const int expected_err)
void test_idempotent_incr(int64_t increment, int expected_err)
{
test_make_idempotent(increment, rocksdb::Status::kOk);

Expand All @@ -315,7 +313,7 @@ class IdempotentIncrTest : public IncrTest
ASSERT_EQ(expected_err, resp.error);
}

void test_incr(const int64_t base, const int64_t increment) override
void test_incr(int64_t base, int64_t increment) override
{
test_idempotent_incr(increment, rocksdb::Status::kOk);
ASSERT_EQ(base + increment, resp.new_value);
Expand Down Expand Up @@ -404,5 +402,4 @@ INSTANTIATE_TEST_SUITE_P(PegasusWriteServiceImplTest,
IdempotentIncrTest,
testing::Values(false, true));

} // namespace server
} // namespace pegasus
} // namespace pegasus::server

0 comments on commit 179299f

Please sign in to comment.