Skip to content

Commit

Permalink
upgrade: Upgrade nuraft to 2.1.0
Browse files Browse the repository at this point in the history
Also repairs an assumption made by a unit test

Signed-off-by: Michael Maurer <[email protected]>
  • Loading branch information
maurermi committed Oct 28, 2024
1 parent cf9060e commit 4b3f319
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion scripts/setup-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ make -j$CPUS
make install
cd ..

NURAFT_VERSION="1.3.0"
NURAFT_VERSION="2.1.0"
echo -e "${green}Building NuRaft from sources...${end}"
wget https://github.com/eBay/NuRaft/archive/v${NURAFT_VERSION}.tar.gz
rm -rf "NuRaft-${NURAFT_VERSION}-${CMAKE_BUILD_TYPE}"
Expand Down
13 changes: 8 additions & 5 deletions tests/unit/raft_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ class raft_test : public ::testing::Test {
auto new_log
= cbdc::make_buffer<uint64_t, nuraft::ptr<nuraft::buffer>>(1);

auto res = nodes[0]->replicate_sync(new_log);
ASSERT_TRUE(res.has_value());
ASSERT_EQ(nodes[0]->last_log_idx(), 2UL);

cbdc::raft::callback_type result_fn = nullptr;
auto result_done = std::atomic<bool>(false);
if(!blocking) {
Expand All @@ -194,7 +190,14 @@ class raft_test : public ::testing::Test {
while(!result_done) {
std::this_thread::sleep_for(std::chrono::milliseconds(250));
}
ASSERT_EQ(nodes[0]->last_log_idx(), 3UL);
ASSERT_EQ(nodes[0]->last_log_idx(), 2UL);

if(blocking) {
// Replicate sync will only return a value in the blocking context
auto res = nodes[0]->replicate_sync(new_log);
ASSERT_TRUE(res.has_value());
ASSERT_EQ(nodes[0]->last_log_idx(), 3UL);
}

for(size_t i{0}; i < nodes.size(); i++) {
ASSERT_EQ(nodes[i]->get_sm(), sms[i].get());
Expand Down

0 comments on commit 4b3f319

Please sign in to comment.