Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
undertome committed Jul 1, 2021
1 parent 3a95c3f commit 90c2126
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/test/rpc/NodeToShardRPC_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class NodeToShardRPC_test : public beast::unit_test::suite
env.close();
}

auto shardStore = env.app().getShardStore();
BEAST_EXPECT(shardStore);

{
// Initiate a shard store import via the RPC
// interface.
Expand All @@ -75,6 +78,12 @@ class NodeToShardRPC_test : public beast::unit_test::suite
result[jss::message] == "Database import initiated...");
}

while (!shardStore->getDatabaseImportSequence())
{
// Wait until the import starts
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}

{
// Verify that the import is in progress with
// the node_to_shard status RPC command
Expand All @@ -85,10 +94,8 @@ class NodeToShardRPC_test : public beast::unit_test::suite
auto const result = env.rpc(
"json", "node_to_shard", to_string(jvParams))[jss::result];

BEAST_EXPECT(result[jss::status] == "success");

auto shardStore = env.app().getShardStore();
BEAST_EXPECT(shardStore);
if (!BEAST_EXPECT(result[jss::status] == "success"))
std::cout << "no success: " << std::endl << result << std::endl;

std::chrono::seconds const maxWait{30};
auto const start = std::chrono::system_clock::now();
Expand All @@ -110,6 +117,9 @@ class NodeToShardRPC_test : public beast::unit_test::suite

BEAST_EXPECT(result[jss::firstShardIndex] == 1);
BEAST_EXPECT(result[jss::lastShardIndex] == 10);

std::cout << "status result: " << std::endl
<< result << std::endl;
}

if (boost::icl::contains(completeShards, 1))
Expand All @@ -120,6 +130,11 @@ class NodeToShardRPC_test : public beast::unit_test::suite
to_string(jvParams))[jss::result];

BEAST_EXPECT(result[jss::currentShardIndex] >= 1);

std::cout << "(current index check) - status result: "
<< std::endl
<< result << std::endl;

break;
}

Expand Down

0 comments on commit 90c2126

Please sign in to comment.