[NC-1524] Update clique getSigners acceptance test start with single node to improve reliability

Jason Frame 6 years ago committed by GitHub
parent 3bcdc047a0
commit 3425b1ae7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 40
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueGetSignersRpcTest.java
  2. 2
      acceptance-tests/src/test/resources/clique/clique.json

@ -18,53 +18,39 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode; import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
@Ignore
public class CliqueGetSignersRpcTest extends AcceptanceTestBase { public class CliqueGetSignersRpcTest extends AcceptanceTestBase {
private PantheonNode minerNode1; private PantheonNode minerNode1;
private PantheonNode minerNode2; private PantheonNode minerNode2;
private PantheonNode minerNode3;
private PantheonNode[] allNodes;
private PantheonNode[] initialNodes;
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
final String[] validators = {"miner1", "miner2"}; final String[] validators = {"miner1"};
minerNode1 = pantheon.createCliqueNodeWithValidators("miner1", validators); minerNode1 = pantheon.createCliqueNodeWithValidators("miner1", validators);
minerNode2 = pantheon.createCliqueNodeWithValidators("miner2", validators); minerNode2 = pantheon.createCliqueNodeWithValidators("miner2", validators);
minerNode3 = pantheon.createCliqueNodeWithValidators("miner3", validators); cluster.start(minerNode1, minerNode2);
initialNodes = new PantheonNode[] {minerNode1, minerNode2};
allNodes = new PantheonNode[] {minerNode1, minerNode2, minerNode3};
cluster.start(allNodes);
} }
@Test @Test
public void shouldBeAbleToGetValidatorsForBlockNumber() { public void shouldBeAbleToGetValidatorsForBlockNumber() {
cluster.verify(clique.validatorsAtBlockEqual("0x0", initialNodes)); cluster.verify(clique.validatorsAtBlockEqual("0x0", minerNode1));
cluster.waitUntil(wait.chainHeadIsAt(1)); minerNode1.waitUntil(wait.chainHeadIsAt(1));
minerNode1.execute(cliqueTransactions.createAddProposal(minerNode3));
minerNode2.execute(cliqueTransactions.createAddProposal(minerNode3));
minerNode1.execute(cliqueTransactions.createAddProposal(minerNode2));
cluster.waitUntil(wait.chainHeadHasProgressed(minerNode1, 1)); cluster.waitUntil(wait.chainHeadHasProgressed(minerNode1, 1));
cluster.verify(clique.validatorsAtBlockEqual("0x2", initialNodes)); cluster.verify(clique.validatorsAtBlockEqual("0x2", minerNode1, minerNode2));
cluster.verify(clique.validatorsAtBlockEqual(LATEST, minerNode1, minerNode2));
minerNode1.waitUntil(wait.chainHeadHasProgressed(minerNode1, 1));
cluster.verify(clique.validatorsAtBlockEqual("0x3", allNodes));
cluster.verify(clique.validatorsAtBlockEqual(LATEST, allNodes));
} }
@Test @Test
public void shouldBeAbleToGetValidatorsForBlockHash() { public void shouldBeAbleToGetValidatorsForBlockHash() {
cluster.verify(clique.validatorsAtBlockHashFromBlockNumberEqual(minerNode1, 0, initialNodes)); cluster.verify(clique.validatorsAtBlockHashFromBlockNumberEqual(minerNode1, 0, minerNode1));
minerNode1.execute(cliqueTransactions.createAddProposal(minerNode3)); minerNode1.waitUntil(wait.chainHeadIsAt(1));
minerNode2.execute(cliqueTransactions.createAddProposal(minerNode3));
minerNode1.waitUntil(wait.chainHeadHasProgressed(minerNode1, 1));
cluster.verify(clique.validatorsAtBlockHashFromBlockNumberEqual(minerNode1, 1, initialNodes));
minerNode1.waitUntil(wait.chainHeadHasProgressed(minerNode1, 1)); minerNode1.execute(cliqueTransactions.createAddProposal(minerNode2));
cluster.verify(clique.validatorsAtBlockHashFromBlockNumberEqual(minerNode1, 3, allNodes)); cluster.waitUntil(wait.chainHeadHasProgressed(minerNode1, 1));
cluster.verify(
clique.validatorsAtBlockHashFromBlockNumberEqual(minerNode1, 2, minerNode1, minerNode2));
} }
} }

@ -8,7 +8,7 @@
"eip158Block": 0, "eip158Block": 0,
"byzantiumBlock": 0, "byzantiumBlock": 0,
"clique": { "clique": {
"blockperiodseconds": 5, "blockperiodseconds": 10,
"epochlength": 30000 "epochlength": 30000
} }
}, },

Loading…
Cancel
Save