Port permissioning acceptance tests to JUnit 5 (#6959)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
pull/6964/head
Fabio Di Fabio 7 months ago committed by GitHub
parent 960145683f
commit 4dd9c65ff7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/AccountLocalAndOnchainPermissioningAcceptanceTest.java
  2. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/AccountLocalConfigPermissioningAcceptanceTest.java
  3. 31
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/AccountLocalConfigPermissioningImportAcceptanceTest.java
  4. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/AccountSmartContractPermissioningAcceptanceTest.java
  5. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/AllowlistPersistorAcceptanceTest.java
  6. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/AllowlistWithDnsPersistorAcceptanceTest.java
  7. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeLocalAndOnchainPermissioningAcceptanceTest.java
  8. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeLocalConfigPermissioningAcceptanceTest.java
  9. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeSmartContractPermissioningAcceptanceTest.java
  10. 2
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeSmartContractPermissioningIbft2StallAcceptanceTest.java
  11. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeSmartContractPermissioningOutOfSyncAcceptanceTest.java
  12. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeSmartContractPermissioningV2AcceptanceTest.java
  13. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodeSmartContractPermissioningV2DNSAcceptanceTest.java
  14. 6
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/permissioning/NodesSmartContractPermissioningStaticNodesAcceptanceTest.java

@ -21,15 +21,15 @@ import org.hyperledger.besu.tests.acceptance.dsl.transaction.account.TransferTra
import java.math.BigInteger;
import java.util.Arrays;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class AccountLocalAndOnchainPermissioningAcceptanceTest
extends AccountSmartContractPermissioningAcceptanceTestBase {
private Account senderC;
@Before
@BeforeEach
public void setUp() {
senderC = accounts.createAccount("Account-C");
}

@ -22,8 +22,8 @@ import org.hyperledger.besu.tests.acceptance.dsl.transaction.account.TransferTra
import java.math.BigInteger;
import java.util.Collections;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class AccountLocalConfigPermissioningAcceptanceTest extends AcceptanceTestBase {
@ -31,7 +31,7 @@ public class AccountLocalConfigPermissioningAcceptanceTest extends AcceptanceTes
private Account senderA;
private Account senderB;
@Before
@BeforeEach
public void setUp() throws Exception {
senderA = accounts.getPrimaryBenefactor();
senderB = accounts.getSecondaryBenefactor();

@ -21,20 +21,19 @@ import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode;
import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.Cluster;
import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.ClusterConfigurationBuilder;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
public class AccountLocalConfigPermissioningImportAcceptanceTest extends AcceptanceTestBase {
@Rule public TemporaryFolder folder = new TemporaryFolder();
@TempDir Path folder;
private static final String GENESIS_FILE = "/ibft/ibft.json";
@ -45,20 +44,20 @@ public class AccountLocalConfigPermissioningImportAcceptanceTest extends Accepta
private BesuNode nodeB;
private Cluster permissionedCluster;
@Before
@BeforeEach
public void setUp() throws IOException {
sender = accounts.getPrimaryBenefactor();
beneficiary = accounts.createAccount("beneficiary");
final List<String> allowList = List.of(sender.getAddress(), beneficiary.getAddress());
final File sharedFile = folder.newFile();
persistAllowList(allowList, sharedFile.toPath());
final Path sharedFile = Files.createFile(folder.resolve("sharedFile"));
persistAllowList(allowList, sharedFile);
bootnode = besu.createIbft2NonValidatorBootnode("bootnode", GENESIS_FILE);
nodeA =
besu.createIbft2NodeWithLocalAccountPermissioning(
"nodeA", GENESIS_FILE, allowList, sharedFile);
"nodeA", GENESIS_FILE, allowList, sharedFile.toFile());
nodeB =
besu.createIbft2NodeWithLocalAccountPermissioning(
"nodeB", GENESIS_FILE, allowList, sharedFile);
"nodeB", GENESIS_FILE, allowList, sharedFile.toFile());
permissionedCluster =
new Cluster(new ClusterConfigurationBuilder().awaitPeerDiscovery(false).build(), net);
@ -67,12 +66,12 @@ public class AccountLocalConfigPermissioningImportAcceptanceTest extends Accepta
@Test
public void transactionFromDeniedAccountShouldNotBreakBlockImport() throws IOException {
final File newPermissionsFile = folder.newFile();
final Path newPermissionsFile = Files.createFile(folder.resolve("newPermissionsFile"));
final List<String> allowList = List.of(beneficiary.getAddress());
persistAllowList(allowList, newPermissionsFile.toPath());
persistAllowList(allowList, newPermissionsFile);
final BesuNode nodeC =
besu.createIbft2NodeWithLocalAccountPermissioning(
"nodeC", GENESIS_FILE, allowList, newPermissionsFile);
"nodeC", GENESIS_FILE, allowList, newPermissionsFile.toFile());
waitForBlockHeight(bootnode, 2);
@ -91,7 +90,7 @@ public class AccountLocalConfigPermissioningImportAcceptanceTest extends Accepta
AllowlistPersistor.ALLOWLIST_TYPE.ACCOUNTS, allowList, path);
}
@After
@AfterEach
public void tearDown() {
permissionedCluster.stop();
}

@ -21,8 +21,8 @@ import org.hyperledger.besu.tests.acceptance.dsl.transaction.account.TransferTra
import java.math.BigInteger;
import java.util.Collections;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class AccountSmartContractPermissioningAcceptanceTest
extends AccountSmartContractPermissioningAcceptanceTestBase {
@ -31,7 +31,7 @@ public class AccountSmartContractPermissioningAcceptanceTest
private Account allowedSender;
private Account otherAccount;
@Before
@BeforeEach
public void setUp() {
node = permissionedNode("node1", Collections.emptyList());
permissionedCluster.start(node);

@ -26,8 +26,8 @@ import java.util.ArrayList;
import java.util.Collections;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class AllowlistPersistorAcceptanceTest extends AcceptanceTestBase {
@ -45,7 +45,7 @@ public class AllowlistPersistorAcceptanceTest extends AcceptanceTestBase {
private Account senderB;
private Path tempFile;
@Before
@BeforeEach
public void setUp() throws Exception {
senderA = accounts.getPrimaryBenefactor();
senderB = accounts.getSecondaryBenefactor();

@ -31,8 +31,8 @@ import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class AllowlistWithDnsPersistorAcceptanceTest extends AcceptanceTestBase {
@ -48,7 +48,7 @@ public class AllowlistWithDnsPersistorAcceptanceTest extends AcceptanceTestBase
private Account senderA;
private Path tempFile;
@Before
@BeforeEach
public void setUp() throws Exception {
ENODE_LOCALHOST_DNS = ENODE_PREFIX + InetAddress.getLocalHost().getHostName() + PORT_SUFFIX;
ENODE_LOCALHOST_IP = ENODE_PREFIX + "127.0.0.1" + PORT_SUFFIX;

@ -16,8 +16,8 @@ package org.hyperledger.besu.tests.acceptance.permissioning;
import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class NodeLocalAndOnchainPermissioningAcceptanceTest
extends NodeSmartContractPermissioningAcceptanceTestBase {
@ -27,7 +27,7 @@ public class NodeLocalAndOnchainPermissioningAcceptanceTest
private Node allowedNode;
private Node forbiddenNode;
@Before
@BeforeEach
public void setUp() {
bootnode = bootnode("bootnode");
forbiddenNode = node("forbidden-node");

@ -20,8 +20,8 @@ import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.Cluster;
import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.ClusterConfiguration;
import org.hyperledger.besu.tests.acceptance.dsl.node.cluster.ClusterConfigurationBuilder;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class NodeLocalConfigPermissioningAcceptanceTest extends AcceptanceTestBase {
@ -31,7 +31,7 @@ public class NodeLocalConfigPermissioningAcceptanceTest extends AcceptanceTestBa
private Node allowedNode;
private Node permissionedNode;
@Before
@BeforeEach
public void setUp() throws Exception {
final ClusterConfiguration clusterConfiguration =
new ClusterConfigurationBuilder().awaitPeerDiscovery(false).build();

@ -16,8 +16,8 @@ package org.hyperledger.besu.tests.acceptance.permissioning;
import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class NodeSmartContractPermissioningAcceptanceTest
extends NodeSmartContractPermissioningAcceptanceTestBase {
@ -27,7 +27,7 @@ public class NodeSmartContractPermissioningAcceptanceTest
private Node allowedNode;
private Node forbiddenNode;
@Before
@BeforeEach
public void setUp() {
bootnode = bootnode("bootnode");
forbiddenNode = node("forbidden-node");

@ -22,7 +22,7 @@ import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode;
import java.io.IOException;
import java.util.Optional;
import org.junit.Test;
import org.junit.jupiter.api.Test;
public class NodeSmartContractPermissioningIbft2StallAcceptanceTest
extends NodeSmartContractPermissioningAcceptanceTestBase {

@ -16,8 +16,8 @@ package org.hyperledger.besu.tests.acceptance.permissioning;
import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class NodeSmartContractPermissioningOutOfSyncAcceptanceTest
extends NodeSmartContractPermissioningAcceptanceTestBase {
@ -25,7 +25,7 @@ public class NodeSmartContractPermissioningOutOfSyncAcceptanceTest
private Node permissionedNodeA;
private Node permissionedNodeB;
@Before
@BeforeEach
public void setUp() throws InterruptedException {
bootnode = bootnode("bootnode");
permissionedNodeA = permissionedNode("permissioned-node-A");

@ -16,8 +16,8 @@ package org.hyperledger.besu.tests.acceptance.permissioning;
import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class NodeSmartContractPermissioningV2AcceptanceTest
extends NodeSmartContractPermissioningV2AcceptanceTestBase {
@ -27,7 +27,7 @@ public class NodeSmartContractPermissioningV2AcceptanceTest
private Node allowedNode;
private Node forbiddenNode;
@Before
@BeforeEach
public void setUp() {
bootnode = bootnode("bootnode");
forbiddenNode = node("forbidden-node");

@ -24,8 +24,8 @@ import java.net.InetAddress;
import java.net.UnknownHostException;
import org.assertj.core.api.Assertions;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class NodeSmartContractPermissioningV2DNSAcceptanceTest
extends NodeSmartContractPermissioningV2AcceptanceTestBase {
@ -38,7 +38,7 @@ public class NodeSmartContractPermissioningV2DNSAcceptanceTest
final ImmutableEnodeDnsConfiguration enodeDnsConfiguration =
ImmutableEnodeDnsConfiguration.builder().dnsEnabled(true).updateEnabled(true).build();
@Before
@BeforeEach
public void setUp() {
bootnode = bootnode("bootnode");
forbiddenNode = node("forbidden-node");

@ -24,8 +24,8 @@ import java.util.Arrays;
import java.util.List;
import javax.annotation.Nonnull;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
public class NodesSmartContractPermissioningStaticNodesAcceptanceTest
extends NodeSmartContractPermissioningAcceptanceTestBase {
@ -33,7 +33,7 @@ public class NodesSmartContractPermissioningStaticNodesAcceptanceTest
private Node miner;
private Node permissionedNode;
@Before
@BeforeEach
public void setUp() {
miner = miner("miner");
permissionedCluster.start(miner);

Loading…
Cancel
Save