mirror of https://github.com/hyperledger/besu
Acceptance Test and DSL rename for IBFT2 (#1493)
Renaming the Ibft AT to ibft2 Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>pull/2/head
parent
a21f812cda
commit
4ab12ae239
@ -1,43 +0,0 @@ |
||||
/* |
||||
* Copyright 2019 ConsenSys AG. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
*/ |
||||
package tech.pegasys.pantheon.tests.acceptance.ibft; |
||||
|
||||
import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase; |
||||
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; |
||||
|
||||
import java.io.IOException; |
||||
|
||||
import org.junit.Test; |
||||
|
||||
public class IbftDiscardRpcAcceptanceTest extends AcceptanceTestBase { |
||||
|
||||
@Test |
||||
public void shouldDiscardVotes() throws IOException { |
||||
final String[] validators = {"validator1", "validator3"}; |
||||
final PantheonNode validator1 = pantheon.createIbftNodeWithValidators("validator1", validators); |
||||
final PantheonNode validator2 = pantheon.createIbftNodeWithValidators("validator2", validators); |
||||
final PantheonNode validator3 = pantheon.createIbftNodeWithValidators("validator3", validators); |
||||
cluster.start(validator1, validator2, validator3); |
||||
|
||||
validator1.execute(ibftTransactions.createAddProposal(validator2)); |
||||
validator1.execute(ibftTransactions.createRemoveProposal(validator3)); |
||||
validator1.verify( |
||||
ibft.pendingVotesEqual().addProposal(validator2).removeProposal(validator3).build()); |
||||
|
||||
validator1.execute(ibftTransactions.createDiscardProposal(validator2)); |
||||
validator1.verify(ibft.pendingVotesEqual().removeProposal(validator3).build()); |
||||
|
||||
validator1.execute(ibftTransactions.createDiscardProposal(validator3)); |
||||
cluster.verify(ibft.noProposals()); |
||||
} |
||||
} |
@ -0,0 +1,46 @@ |
||||
/* |
||||
* Copyright 2019 ConsenSys AG. |
||||
* |
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
||||
* the License. You may obtain a copy of the License at |
||||
* |
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
||||
* specific language governing permissions and limitations under the License. |
||||
*/ |
||||
package tech.pegasys.pantheon.tests.acceptance.ibft2; |
||||
|
||||
import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase; |
||||
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; |
||||
|
||||
import java.io.IOException; |
||||
|
||||
import org.junit.Test; |
||||
|
||||
public class Ibft2DiscardRpcAcceptanceTest extends AcceptanceTestBase { |
||||
|
||||
@Test |
||||
public void shouldDiscardVotes() throws IOException { |
||||
final String[] validators = {"validator1", "validator3"}; |
||||
final PantheonNode validator1 = |
||||
pantheon.createIbft2NodeWithValidators("validator1", validators); |
||||
final PantheonNode validator2 = |
||||
pantheon.createIbft2NodeWithValidators("validator2", validators); |
||||
final PantheonNode validator3 = |
||||
pantheon.createIbft2NodeWithValidators("validator3", validators); |
||||
cluster.start(validator1, validator2, validator3); |
||||
|
||||
validator1.execute(ibftTwoTransactions.createAddProposal(validator2)); |
||||
validator1.execute(ibftTwoTransactions.createRemoveProposal(validator3)); |
||||
validator1.verify( |
||||
ibftTwo.pendingVotesEqual().addProposal(validator2).removeProposal(validator3).build()); |
||||
|
||||
validator1.execute(ibftTwoTransactions.createDiscardProposal(validator2)); |
||||
validator1.verify(ibftTwo.pendingVotesEqual().removeProposal(validator3).build()); |
||||
|
||||
validator1.execute(ibftTwoTransactions.createDiscardProposal(validator3)); |
||||
cluster.verify(ibftTwo.noProposals()); |
||||
} |
||||
} |
Loading…
Reference in new issue