Skip to content

Commit

Permalink
Allow driver to name the first node (#5876)
Browse files Browse the repository at this point in the history
  • Loading branch information
achamayou authored Dec 19, 2023
1 parent 2faaec3 commit 5daf0c7
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/consensus/aft/test/driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ int main(int argc, char** argv)
switch (shash(in))
{
case shash("start_node"):
assert(items.size() == 1);
driver->create_start_node(lineno);
assert(items.size() == 2);
driver->create_start_node(items[1], lineno);
break;
case shash("trust_node"):
assert(items.size() == 3);
Expand Down
5 changes: 2 additions & 3 deletions src/consensus/aft/test/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,12 @@ class RaftDriver
<< std::endl;
}

void create_start_node(const size_t lineno)
void create_start_node(const std::string& start_node_id, const size_t lineno)
{
if (!_nodes.empty())
{
throw std::logic_error("Start node already exists");
}
const std::string start_node_id = "0";
kv::Configuration::Nodes configuration;
add_node(start_node_id);
configuration.try_emplace(start_node_id);
Expand All @@ -240,7 +239,7 @@ class RaftDriver

void trust_nodes(
const std::string& term,
std::vector<std::string> node_ids,
const std::vector<std::string>& node_ids,
const size_t lineno)
{
for (const auto& node_id : node_ids)
Expand Down
2 changes: 1 addition & 1 deletion tests/raft_scenarios/append
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Create a Start Node, commit initial transaction and signature
# Append transaction to the node's log, observe that they are committed
start_node
start_node,0
assert_is_primary,0
emit_signature,2

Expand Down
2 changes: 1 addition & 1 deletion tests/raft_scenarios/startup
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Create a Start Node, commit initial transaction and signature
# https://microsoft.github.io/CCF/main/operations/start_network.html#starting-the-first-node
start_node
start_node,0
assert_is_primary,0
emit_signature,2

Expand Down

0 comments on commit 5daf0c7

Please sign in to comment.