Search in sources :

Example 1 with Condition

use of org.hyperledger.besu.tests.acceptance.dsl.condition.Condition in project besu by hyperledger.

the class CliqueProposeRpcAcceptanceTest method shouldRemoveValidators.

@Test
public void shouldRemoveValidators() throws IOException {
    final String[] initialValidators = { "miner1", "miner2", "miner3" };
    final BesuNode minerNode1 = besu.createCliqueNodeWithValidators("miner1", initialValidators);
    final BesuNode minerNode2 = besu.createCliqueNodeWithValidators("miner2", initialValidators);
    final BesuNode minerNode3 = besu.createCliqueNodeWithValidators("miner3", initialValidators);
    cluster.start(minerNode1, minerNode2, minerNode3);
    cluster.verify(clique.validatorsEqual(minerNode1, minerNode2, minerNode3));
    final Condition cliqueValidatorsChanged = clique.awaitSignerSetChange(minerNode1);
    minerNode1.execute(cliqueTransactions.createRemoveProposal(minerNode3));
    minerNode2.execute(cliqueTransactions.createRemoveProposal(minerNode3));
    cluster.verify(cliqueValidatorsChanged);
    cluster.verify(clique.validatorsEqual(minerNode1, minerNode2));
}
Also used : Condition(org.hyperledger.besu.tests.acceptance.dsl.condition.Condition) BesuNode(org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode) Test(org.junit.Test)

Example 2 with Condition

use of org.hyperledger.besu.tests.acceptance.dsl.condition.Condition in project besu by hyperledger.

the class AllowlistWithDnsPersistorAcceptanceTest method addingEnodeWithIp_andThenAddingSameEnodeWithHostname_shouldThrow.

@Test
public void addingEnodeWithIp_andThenAddingSameEnodeWithHostname_shouldThrow() {
    node.verify(perm.addNodesToAllowlist(ENODE_LOCALHOST_IP));
    node.verify(perm.expectPermissioningAllowlistFileKeyValue(ALLOWLIST_TYPE.NODES, tempFile, ENODE_LOCALHOST_DNS));
    // expect an exception when adding using hostname, since this node is already added with IP
    final Condition condition = perm.addNodesToAllowlist(ENODE_LOCALHOST_DNS);
    assertThatThrownBy(() -> node.verify(condition)).isInstanceOf(RuntimeException.class);
}
Also used : Condition(org.hyperledger.besu.tests.acceptance.dsl.condition.Condition) Test(org.junit.Test)

Example 3 with Condition

use of org.hyperledger.besu.tests.acceptance.dsl.condition.Condition in project besu by hyperledger.

the class AllowlistWithDnsPersistorAcceptanceTest method addingEnodeWithHostname_andThenAddingSameEnodeWithIp_shouldThrow.

@Test
public void addingEnodeWithHostname_andThenAddingSameEnodeWithIp_shouldThrow() {
    node.verify(perm.addNodesToAllowlist(ENODE_LOCALHOST_DNS));
    node.verify(perm.expectPermissioningAllowlistFileKeyValue(ALLOWLIST_TYPE.NODES, tempFile, ENODE_LOCALHOST_DNS));
    // expect an exception when adding using IP, since this node is already added with hostname
    final Condition condition = perm.addNodesToAllowlist(ENODE_LOCALHOST_IP);
    assertThatThrownBy(() -> node.verify(condition)).isInstanceOf(RuntimeException.class);
}
Also used : Condition(org.hyperledger.besu.tests.acceptance.dsl.condition.Condition) Test(org.junit.Test)

Example 4 with Condition

use of org.hyperledger.besu.tests.acceptance.dsl.condition.Condition in project besu by hyperledger.

the class BftProposeRpcAcceptanceTest method validatorsCanBeAddedAndThenRemoved.

@Test
public void validatorsCanBeAddedAndThenRemoved() throws Exception {
    final String[] validators = { "validator1", "validator2", "validator3" };
    final BesuNode validator1 = nodeFactory.createNodeWithValidators(besu, "validator1", validators);
    final BesuNode validator2 = nodeFactory.createNodeWithValidators(besu, "validator2", validators);
    final BesuNode validator3 = nodeFactory.createNodeWithValidators(besu, "validator3", validators);
    final BesuNode nonValidatorNode = nodeFactory.createNodeWithValidators(besu, "non-validator", validators);
    cluster.start(validator1, validator2, validator3, nonValidatorNode);
    cluster.verify(bft.validatorsEqual(validator1, validator2, validator3));
    final Condition addedCondition = bft.awaitValidatorSetChange(validator1);
    validator1.execute(bftTransactions.createAddProposal(nonValidatorNode));
    validator2.execute(bftTransactions.createAddProposal(nonValidatorNode));
    cluster.verify(addedCondition);
    cluster.verify(bft.validatorsEqual(validator1, validator2, validator3, nonValidatorNode));
    final Condition removedCondition = bft.awaitValidatorSetChange(validator1);
    validator2.execute(bftTransactions.createRemoveProposal(nonValidatorNode));
    validator3.execute(bftTransactions.createRemoveProposal(nonValidatorNode));
    nonValidatorNode.execute(bftTransactions.createRemoveProposal(nonValidatorNode));
    cluster.verify(removedCondition);
    cluster.verify(bft.validatorsEqual(validator1, validator2, validator3));
}
Also used : Condition(org.hyperledger.besu.tests.acceptance.dsl.condition.Condition) BesuNode(org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode) Test(org.junit.Test)

Aggregations

Condition (org.hyperledger.besu.tests.acceptance.dsl.condition.Condition)4 Test (org.junit.Test)4 BesuNode (org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode)2