Skip to content

Commit

Permalink
Ensure that spawned nodes know of each other
Browse files Browse the repository at this point in the history
  • Loading branch information
Geod24 authored and AndrejMitrovic committed Jun 28, 2019
1 parent 53cda47 commit 8ffc1b5
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions source/agora/test/Network.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@ import agora.test.Base;
///
unittest
{
import std.algorithm;
import std.format;

const NodeCount = 4;
auto network = makeTestNetwork!TestNetworkManager(NetworkTopology.Simple, NodeCount);
network.start();
assert(network.getDiscoveredNodes().length == NodeCount);
// Check that each node knows of the others
assert(network.apis.byKey().count == NodeCount);
foreach (key, node; network.apis)
{
auto addresses = node.getNetworkInfo().addresses.keys;
assert(addresses.sort.uniq.count == NodeCount - 1,
format("Node %s has %d peers: %s", key, addresses.length, addresses));
}
}

0 comments on commit 8ffc1b5

Please sign in to comment.