From 335cae2249f2ea147490345c15cbcebed6d23515 Mon Sep 17 00:00:00 2001 From: Trent Mohay <37158202+rain-on@users.noreply.github.com> Date: Wed, 5 Jun 2019 09:21:59 +1000 Subject: [PATCH] Add AT to ensure 0-miner Clique/IBFT are valid (#1525) Signed-off-by: Adrian Sutton --- .../clique/CliqueZeroValidators.java | 34 +++++++++++++++++++ .../acceptance/ibft2/Ibft2ZeroValidators.java | 34 +++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueZeroValidators.java create mode 100644 acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ZeroValidators.java diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueZeroValidators.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueZeroValidators.java new file mode 100644 index 0000000000..ff67527dcb --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/clique/CliqueZeroValidators.java @@ -0,0 +1,34 @@ +/* + * 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.clique; + +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 CliqueZeroValidators extends AcceptanceTestBase { + + @Test + public void zeroValidatorsFormValidCluster() throws IOException { + final String[] signers = {}; + final PantheonNode node1 = pantheon.createCliqueNodeWithValidators("node1", signers); + final PantheonNode node2 = pantheon.createCliqueNodeWithValidators("node2", signers); + + cluster.start(node1, node2); + + cluster.verify(net.awaitPeerCount(1)); + } +} diff --git a/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ZeroValidators.java b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ZeroValidators.java new file mode 100644 index 0000000000..759648cf48 --- /dev/null +++ b/acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/ibft2/Ibft2ZeroValidators.java @@ -0,0 +1,34 @@ +/* + * 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 Ibft2ZeroValidators extends AcceptanceTestBase { + + @Test + public void zeroValidatorsFormValidCluster() throws IOException { + final String[] validators = {}; + final PantheonNode node1 = pantheon.createIbft2NodeWithValidators("node1", validators); + final PantheonNode node2 = pantheon.createIbft2NodeWithValidators("node2", validators); + + cluster.start(node1, node2); + + cluster.verify(net.awaitPeerCount(1)); + } +}