Implement cypher query based simulation testing
Make the Interpreter be able to handle SimulatorTransport as well. This includes introducing changes that make it possible to use the different transport types in a semi-polymorphic way with the introduction of factory methods in the RequestRouter. The reason for this solution is that the classes that represent the different transport types have member function templates, that we can not make virtual. This solution seemed to be the least convoluted. In the testing itself now it is possible to pass a set of cypher queried to the interpreter which would run these queries against the interpreter and the individual shards that are managed and started up by the MachineManager with the different entities communicating over the simulated network.
This commit is contained in:
@@ -607,15 +607,15 @@ int main(int argc, char **argv) {
|
||||
// to minimize the impact of their failure on the main storage.
|
||||
|
||||
memgraph::io::local_transport::LocalSystem ls;
|
||||
auto unique_local_addr_query = memgraph::coordinator::Address::UniqueLocalAddress();
|
||||
auto io = ls.Register(unique_local_addr_query);
|
||||
auto unique_local_coord_addr_query = memgraph::coordinator::Address::UniqueLocalAddress();
|
||||
auto io = ls.Register(unique_local_coord_addr_query);
|
||||
|
||||
memgraph::machine_manager::MachineConfig config{
|
||||
.coordinator_addresses = std::vector<memgraph::io::Address>{unique_local_addr_query},
|
||||
.coordinator_addresses = std::vector<memgraph::io::Address>{unique_local_coord_addr_query},
|
||||
.is_storage = true,
|
||||
.is_coordinator = true,
|
||||
.listen_ip = unique_local_addr_query.last_known_ip,
|
||||
.listen_port = unique_local_addr_query.last_known_port,
|
||||
.listen_ip = unique_local_coord_addr_query.last_known_ip,
|
||||
.listen_port = unique_local_coord_addr_query.last_known_port,
|
||||
};
|
||||
|
||||
memgraph::coordinator::ShardMap sm;
|
||||
@@ -640,6 +640,8 @@ int main(int argc, char **argv) {
|
||||
memgraph::machine_manager::MachineManager<memgraph::io::local_transport::LocalTransport> mm{io, config, coordinator};
|
||||
std::jthread mm_thread([&mm] { mm.Run(); });
|
||||
|
||||
auto rr_factory = std::make_unique<memgraph::query::v2::LocalRequestRouterFactory>(ls.GetTransportHandle());
|
||||
|
||||
memgraph::query::v2::InterpreterContext interpreter_context{
|
||||
(memgraph::storage::v3::Shard *)(nullptr),
|
||||
{.query = {.allow_load_csv = FLAGS_allow_load_csv},
|
||||
@@ -650,7 +652,7 @@ int main(int argc, char **argv) {
|
||||
.stream_transaction_conflict_retries = FLAGS_stream_transaction_conflict_retries,
|
||||
.stream_transaction_retry_interval = std::chrono::milliseconds(FLAGS_stream_transaction_retry_interval)},
|
||||
FLAGS_data_directory,
|
||||
std::move(io),
|
||||
std::move(rr_factory),
|
||||
mm.CoordinatorAddress()};
|
||||
|
||||
SessionData session_data{&interpreter_context};
|
||||
|
||||
Reference in New Issue
Block a user