Fix integration distributed test flakiness

Reviewers: teon.banek, buda

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1702
This commit is contained in:
Matej Ferencevic 2018-10-25 20:27:01 +02:00
parent 30e18026a5
commit 69b666c487
2 changed files with 20 additions and 11 deletions

View File

@ -83,7 +83,10 @@ def execute_test(memgraph_binary, tester_binary, cluster_size, disaster,
# Execute the query if required.
if execute_query:
time.sleep(1)
client = subprocess.Popen([tester_binary])
# Run the `create` step first.
subprocess.run([tester_binary, "--step", "create"], check=True)
# Now execute the query.
client = subprocess.Popen([tester_binary, "--step", "execute"])
# Perform the disaster.
time.sleep(2)

View File

@ -11,6 +11,8 @@ DEFINE_string(username, "", "Username for the database");
DEFINE_string(password, "", "Password for the database");
DEFINE_bool(use_ssl, false, "Set to true to connect with SSL to the server.");
DEFINE_string(step, "", "The step to execute (available: create, execute)");
/**
* This test creates a sample dataset in the database and then executes a query
* that has a long execution time so that we can see what happens if the cluster
@ -30,8 +32,9 @@ int main(int argc, char **argv) {
client.Connect(endpoint, FLAGS_username, FLAGS_password);
if (FLAGS_step == "create") {
client.Execute("UNWIND range(0, 10000) AS x CREATE ()", {});
} else if (FLAGS_step == "execute") {
try {
client.Execute("MATCH (a), (b), (c), (d), (e), (f) RETURN COUNT(*)", {});
LOG(FATAL)
@ -41,6 +44,9 @@ int main(int argc, char **argv) {
} catch (const communication::bolt::ClientFatalException &) {
LOG(WARNING) << "The server closed the connection to us!";
}
} else {
LOG(FATAL) << "Unknown step!";
}
return 0;
}