refactored perm ATs to remove dupe (#2230)

* refactored tests to remove dupe

Signed-off-by: Sally MacFarlane <sally.macfarlane@consensys.net>
pull/2234/head
Sally MacFarlane 4 years ago committed by GitHub
parent b4e14bc356
commit c0a1c7081c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeSmartContractPermissioningAcceptanceTest.java

@ -46,6 +46,9 @@ public class NodeSmartContractPermissioningAcceptanceTest
permissionedNode.execute(allowNode(permissionedNode)); permissionedNode.execute(allowNode(permissionedNode));
permissionedNode.verify(nodeIsAllowed(permissionedNode)); permissionedNode.verify(nodeIsAllowed(permissionedNode));
permissionedNode.verify(admin.addPeer(bootnode));
permissionedNode.verify(admin.addPeer(allowedNode));
} }
@Test @Test
@ -58,38 +61,18 @@ public class NodeSmartContractPermissioningAcceptanceTest
@Test @Test
public void permissionedNodeShouldDisconnectFromNodeNotPermittedAnymore() { public void permissionedNodeShouldDisconnectFromNodeNotPermittedAnymore() {
permissionedNode.verify(admin.addPeer(bootnode));
permissionedNode.verify(admin.addPeer(allowedNode));
permissionedNode.verify(net.awaitPeerCount(2));
permissionedNode.execute(forbidNode(allowedNode)); permissionedNode.execute(forbidNode(allowedNode));
permissionedNode.verify(connectionIsForbidden(permissionedNode, allowedNode)); permissionedNode.verify(connectionIsForbidden(permissionedNode, allowedNode));
permissionedNode.verify(net.awaitPeerCount(1)); permissionedNode.verify(net.awaitPeerCount(1));
} }
@Test
public void permissionedNodeShouldConnectToNewlyPermittedNode() {
permissionedNode.verify(admin.addPeer(bootnode));
permissionedNode.verify(admin.addPeer(allowedNode));
permissionedNode.verify(net.awaitPeerCount(2));
permissionedNode.execute(allowNode(forbiddenNode));
permissionedNode.verify(connectionIsAllowed(permissionedNode, forbiddenNode));
permissionedNode.verify(admin.addPeer(forbiddenNode));
permissionedNode.verify(net.awaitPeerCount(3));
}
@Test @Test
public void permissioningUpdatesPropagateThroughNetwork() { public void permissioningUpdatesPropagateThroughNetwork() {
permissionedNode.verify(admin.addPeer(bootnode)); // connection to newly permitted node is allowed
permissionedNode.verify(admin.addPeer(allowedNode));
permissionedNode.verify(net.awaitPeerCount(2));
// permissioning changes in peer should propagate to permissioned node
allowedNode.execute(allowNode(forbiddenNode)); allowedNode.execute(allowNode(forbiddenNode));
allowedNode.verify(connectionIsAllowed(permissionedNode, forbiddenNode)); allowedNode.verify(connectionIsAllowed(permissionedNode, forbiddenNode));
// permissioning changes in peer should propagate to permissioned node
permissionedNode.verify(connectionIsAllowed(permissionedNode, forbiddenNode)); permissionedNode.verify(connectionIsAllowed(permissionedNode, forbiddenNode));
permissionedNode.verify(admin.addPeer(forbiddenNode)); permissionedNode.verify(admin.addPeer(forbiddenNode));

Loading…
Cancel
Save