Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow driver to name the first node #5876

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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