Skip to content

Commit

Permalink
Fix ValidatorRecurringEnrollment test to account for FullNode
Browse files Browse the repository at this point in the history
Previously, we were using 'clients', which means we would try to enroll full nodes,
and timeout when our (empty) enrollment was rejected.
The assert makes sure we get a valid enrollment back, and the new function conveniently
filters out full nodes and might be useful for others tests.
  • Loading branch information
Geod24 authored and omerfirmak committed Sep 28, 2021
1 parent 0e2301e commit d1b1fd1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 7 additions & 0 deletions source/agora/test/Base.d
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,13 @@ public class TestAPIManager
return this.nodes.map!(np => np.client);
}

/// Convenience function to get a range of all nodes instantiated as validators
public auto validators ()
{
// This is a crude way to get validators, but it works
return this.nodes.filter!(n => n.address.startsWith("Validator-")).map!(np => np.client);
}

/// Registry holding the nodes
protected AnyRegistry registry;

Expand Down
5 changes: 3 additions & 2 deletions source/agora/test/ValidatorRecurringEnrollment.d
Original file line number Diff line number Diff line change
Expand Up @@ -319,10 +319,11 @@ unittest
network.generateBlocks(Height(GenesisValidatorCycle - 1));

// set the recurring enrollment option to true and check in enrollment pools
network.clients.each!((node)
network.validators.each!((node)
{
Enrollment enroll = node.setRecurringEnrollment(true);
network.clients.each!(n =>
assert(enroll !is Enrollment.init);
network.validators.each!(n =>
retryFor(n.getEnrollment(enroll.utxo_key) == enroll, 5.seconds));
});
network.generateBlocks(Height(GenesisValidatorCycle));
Expand Down

0 comments on commit d1b1fd1

Please sign in to comment.