From bd5be78dfdb7c9a19987b209837fda621920b92f Mon Sep 17 00:00:00 2001
From: Marko Budiselic <marko.budiselic@memgraph.com>
Date: Tue, 14 Mar 2023 13:42:39 +0000
Subject: [PATCH] Add dummy shard_rsm simulation test

---
 tests/simulation/common.hpp    |  1 +
 tests/simulation/shard_rsm.cpp | 31 +++++++++++++++++++------------
 2 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/tests/simulation/common.hpp b/tests/simulation/common.hpp
index 6471fe92c..2d49fe344 100644
--- a/tests/simulation/common.hpp
+++ b/tests/simulation/common.hpp
@@ -120,6 +120,7 @@ class MockedShardRsm {
 
   msgs::GraphResponse ReadImpl(msgs::GraphRequest rqst) {
     msgs::GraphResponse resp;
+    SPDLOG_INFO("MockedShardRsm::ReadImpl");
     return resp;
   }
 
diff --git a/tests/simulation/shard_rsm.cpp b/tests/simulation/shard_rsm.cpp
index 5c35b822a..de1f16b93 100644
--- a/tests/simulation/shard_rsm.cpp
+++ b/tests/simulation/shard_rsm.cpp
@@ -33,32 +33,21 @@
 #include "utils/result.hpp"
 
 namespace memgraph::storage::v3::tests {
-
 using io::Address;
 using io::Io;
-using io::ResponseEnvelope;
 using io::ResponseFuture;
 using io::Time;
-using io::TimedOut;
 using io::rsm::Raft;
-using io::rsm::ReadRequest;
-using io::rsm::ReadResponse;
 using io::rsm::RsmClient;
-using io::rsm::WriteRequest;
-using io::rsm::WriteResponse;
 using io::simulator::Simulator;
 using io::simulator::SimulatorConfig;
 using io::simulator::SimulatorStats;
 using io::simulator::SimulatorTransport;
-using utils::BasicResult;
-
 using msgs::ReadRequests;
 using msgs::ReadResponses;
 using msgs::WriteRequests;
 using msgs::WriteResponses;
-
 using ShardClient = RsmClient<SimulatorTransport, WriteRequests, WriteResponses, ReadRequests, ReadResponses>;
-
 using ConcreteShardRsm = Raft<SimulatorTransport, ShardRsm, WriteRequests, WriteResponses, ReadRequests, ReadResponses>;
 
 // TODO(gvolfing) test vertex deletion with DETACH_DELETE as well
@@ -1462,6 +1451,21 @@ void TestGetProperties(ShardClient &client) {
   }
 }
 
+void TestGetGraph(ShardClient &client) {
+  SPDLOG_WARN("shard_rsm.cpp:TestGetGraph(ShardClient) not yet implemented");
+  msgs::GraphRequest req{};
+  while (true) {
+    auto read_res = client.SendReadRequest(req);
+    if (read_res.HasError()) {
+      continue;
+    }
+    auto res = read_res.GetValue();
+    auto graph_res = std::get<msgs::GraphResponse>(res);
+    MG_ASSERT(graph_res.error == std::nullopt);
+    return;
+  }
+}
+
 }  // namespace
 
 int TestMessages() {
@@ -1549,8 +1553,11 @@ int TestMessages() {
 
   // GetProperties tests
   TestGetProperties(client);
-  simulator.ShutDown();
 
+  // GetGraph tests
+  TestGetGraph(client);
+
+  simulator.ShutDown();
   SimulatorStats stats = simulator.Stats();
 
   std::cout << "total messages:     " << stats.total_messages << std::endl;