Improve large log entries integration test

Summary:
- Server ids are now 1-indexed in logs
- All created nodes have distinct is properties which helps with debugging

Reviewers: msantl

Reviewed By: msantl

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D2109
This commit is contained in:
Ivan Paljak 2019-06-04 14:22:44 +02:00
parent c775688aa7
commit 45413c0612
2 changed files with 11 additions and 9 deletions

View File

@ -17,12 +17,13 @@ from ha_test import HaTestBase
class HaLargeLogEntriesTest(HaTestBase):
def execute_step(self, step, node_count):
def execute_step(self, step, node_count, offset_nodes=None):
if step == "create":
print("Executing create query")
client = subprocess.Popen([self.tester_binary, "--step", "create",
"--cluster_size", str(self.cluster_size),
"--create_nodes", str(node_count)])
"--cluster-size", str(self.cluster_size),
"--create-nodes", str(node_count),
"--offset-nodes", str(offset_nodes)])
elif step == "check":
print("Executing check query")
@ -50,18 +51,18 @@ class HaLargeLogEntriesTest(HaTestBase):
self.start_cluster()
for i in range(self.cluster_size):
assert self.execute_step("create", nodes) == 0, \
assert self.execute_step("create", nodes, i * nodes) == 0, \
"Error while executing create query"
# Kill worker.
print("Killing worker {}".format(i))
print("Killing worker {}".format(i + 1))
self.kill_worker(i)
assert self.execute_step("check", (i + 1) * nodes) == 0, \
"Error while executing check query"
# Bring worker back to life.
print("Starting worker {}".format(i))
print("Starting worker {}".format(i + 1))
self.start_worker(i)

View File

@ -14,6 +14,7 @@ DEFINE_string(address, "127.0.0.1", "Server address");
DEFINE_int32(port, 7687, "Server port");
DEFINE_int32(cluster_size, 3, "Size of the raft cluster.");
DEFINE_int32(create_nodes, 250000, "Number of nodes to be created.");
DEFINE_int32(offset_nodes, 0, "Initial ID of created nodes");
DEFINE_int32(check_nodes, -1, "Number of nodes that should be in the database");
DEFINE_string(username, "", "Username for the database");
DEFINE_string(password, "", "Password for the database");
@ -38,9 +39,9 @@ int main(int argc, char **argv) {
FLAGS_password, 60, retry_delay);
if (FLAGS_step == "create") {
client.Execute("UNWIND RANGE(1, " + std::to_string(FLAGS_create_nodes) +
") AS x CREATE(:Node {id:x})",
{});
client.Execute("UNWIND RANGE($start, $stop) AS x CREATE(:Node {id: x})",
{{"start", FLAGS_offset_nodes},
{"stop", FLAGS_offset_nodes + FLAGS_create_nodes - 1}});
return 0;
} else if (FLAGS_step == "check") {
auto result = client.Execute("MATCH (n) RETURN COUNT(n)", {});