diff --git a/tests/integration/distributed/runner.py b/tests/integration/distributed/runner.py index 2ef866d94..90e6086c4 100755 --- a/tests/integration/distributed/runner.py +++ b/tests/integration/distributed/runner.py @@ -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) diff --git a/tests/integration/distributed/tester.cpp b/tests/integration/distributed/tester.cpp index 026ed91a7..797dbfca5 100644 --- a/tests/integration/distributed/tester.cpp +++ b/tests/integration/distributed/tester.cpp @@ -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,16 +32,20 @@ int main(int argc, char **argv) { client.Connect(endpoint, FLAGS_username, FLAGS_password); - client.Execute("UNWIND range(0, 10000) AS x CREATE ()", {}); - - try { - client.Execute("MATCH (a), (b), (c), (d), (e), (f) RETURN COUNT(*)", {}); - LOG(FATAL) - << "The long query shouldn't have finished successfully, but it did!"; - } catch (const communication::bolt::ClientQueryException &e) { - LOG(WARNING) << e.what(); - } catch (const communication::bolt::ClientFatalException &) { - LOG(WARNING) << "The server closed the connection to us!"; + 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) + << "The long query shouldn't have finished successfully, but it did!"; + } catch (const communication::bolt::ClientQueryException &e) { + LOG(WARNING) << e.what(); + } catch (const communication::bolt::ClientFatalException &) { + LOG(WARNING) << "The server closed the connection to us!"; + } + } else { + LOG(FATAL) << "Unknown step!"; } return 0;