BFT soak test - use both db modes (#7496)

* For test node runners use provided data storage config

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

* Make the BFT soak mining tests use both Forest and Bonsai DBs

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>

---------

Signed-off-by: Matthew Whitehead <matthew1001@gmail.com>
pull/7508/head
Matt Whitehead 3 months ago committed by GitHub
parent d7656b9899
commit 0ec335fbf1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 19
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java
  2. 15
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/bft/BftAcceptanceTestParameterization.java
  3. 9
      acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/bftsoak/BftMiningSoakTest.java

@ -32,7 +32,9 @@ import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters; import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.permissioning.LocalPermissioningConfiguration; import org.hyperledger.besu.ethereum.permissioning.LocalPermissioningConfiguration;
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration; import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.pki.keystore.KeyStoreWrapper; import org.hyperledger.besu.pki.keystore.KeyStoreWrapper;
import org.hyperledger.besu.plugin.services.storage.DataStorageFormat;
import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode;
import org.hyperledger.besu.tests.acceptance.dsl.node.Node; import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
import org.hyperledger.besu.tests.acceptance.dsl.node.RunnableNode; import org.hyperledger.besu.tests.acceptance.dsl.node.RunnableNode;
@ -476,7 +478,9 @@ public class BesuNodeFactory {
.build()); .build());
} }
public BesuNode createIbft2Node(final String name, final boolean fixedPort) throws IOException { public BesuNode createIbft2Node(
final String name, final boolean fixedPort, final DataStorageFormat storageFormat)
throws IOException {
JsonRpcConfiguration rpcConfig = node.createJsonRpcWithIbft2EnabledConfig(false); JsonRpcConfiguration rpcConfig = node.createJsonRpcWithIbft2EnabledConfig(false);
rpcConfig.addRpcApi("ADMIN,TXPOOL"); rpcConfig.addRpcApi("ADMIN,TXPOOL");
if (fixedPort) { if (fixedPort) {
@ -484,6 +488,7 @@ public class BesuNodeFactory {
Math.abs(name.hashCode() % 60000) Math.abs(name.hashCode() % 60000)
+ 1024); // Generate a consistent port for p2p based on node name + 1024); // Generate a consistent port for p2p based on node name
} }
BesuNodeConfigurationBuilder builder = BesuNodeConfigurationBuilder builder =
new BesuNodeConfigurationBuilder() new BesuNodeConfigurationBuilder()
.name(name) .name(name)
@ -491,6 +496,10 @@ public class BesuNodeFactory {
.jsonRpcConfiguration(rpcConfig) .jsonRpcConfiguration(rpcConfig)
.webSocketConfiguration(node.createWebSocketEnabledConfig()) .webSocketConfiguration(node.createWebSocketEnabledConfig())
.devMode(false) .devMode(false)
.dataStorageConfiguration(
storageFormat == DataStorageFormat.FOREST
? DataStorageConfiguration.DEFAULT_FOREST_CONFIG
: DataStorageConfiguration.DEFAULT_BONSAI_CONFIG)
.genesisConfigProvider(GenesisConfigurationFactory::createIbft2GenesisConfig); .genesisConfigProvider(GenesisConfigurationFactory::createIbft2GenesisConfig);
if (fixedPort) { if (fixedPort) {
builder.p2pPort( builder.p2pPort(
@ -527,7 +536,9 @@ public class BesuNodeFactory {
return createQbftNodeWithTLS(name, KeyStoreWrapper.KEYSTORE_TYPE_PKCS11); return createQbftNodeWithTLS(name, KeyStoreWrapper.KEYSTORE_TYPE_PKCS11);
} }
public BesuNode createQbftNode(final String name, final boolean fixedPort) throws IOException { public BesuNode createQbftNode(
final String name, final boolean fixedPort, final DataStorageFormat storageFormat)
throws IOException {
JsonRpcConfiguration rpcConfig = node.createJsonRpcWithQbftEnabledConfig(false); JsonRpcConfiguration rpcConfig = node.createJsonRpcWithQbftEnabledConfig(false);
rpcConfig.addRpcApi("ADMIN,TXPOOL"); rpcConfig.addRpcApi("ADMIN,TXPOOL");
if (fixedPort) { if (fixedPort) {
@ -543,6 +554,10 @@ public class BesuNodeFactory {
.jsonRpcConfiguration(rpcConfig) .jsonRpcConfiguration(rpcConfig)
.webSocketConfiguration(node.createWebSocketEnabledConfig()) .webSocketConfiguration(node.createWebSocketEnabledConfig())
.devMode(false) .devMode(false)
.dataStorageConfiguration(
storageFormat == DataStorageFormat.FOREST
? DataStorageConfiguration.DEFAULT_FOREST_CONFIG
: DataStorageConfiguration.DEFAULT_BONSAI_CONFIG)
.genesisConfigProvider(GenesisConfigurationFactory::createQbftGenesisConfig); .genesisConfigProvider(GenesisConfigurationFactory::createQbftGenesisConfig);
if (fixedPort) { if (fixedPort) {
builder.p2pPort( builder.p2pPort(

@ -14,6 +14,7 @@
*/ */
package org.hyperledger.besu.tests.acceptance.bft; package org.hyperledger.besu.tests.acceptance.bft;
import org.hyperledger.besu.plugin.services.storage.DataStorageFormat;
import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode; import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode;
import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeFactory; import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeFactory;
@ -38,7 +39,9 @@ public class BftAcceptanceTestParameterization {
@FunctionalInterface @FunctionalInterface
public interface NodeCreator { public interface NodeCreator {
BesuNode create(BesuNodeFactory factory, String name, boolean fixedPort) throws Exception; BesuNode create(
BesuNodeFactory factory, String name, boolean fixedPort, DataStorageFormat storageFormat)
throws Exception;
} }
@FunctionalInterface @FunctionalInterface
@ -64,11 +67,15 @@ public class BftAcceptanceTestParameterization {
} }
public BesuNode createNode(BesuNodeFactory factory, String name) throws Exception { public BesuNode createNode(BesuNodeFactory factory, String name) throws Exception {
return creatorFn.create(factory, name, false); return creatorFn.create(factory, name, false, DataStorageFormat.FOREST);
}
public BesuNode createBonsaiNodeFixedPort(BesuNodeFactory factory, String name) throws Exception {
return creatorFn.create(factory, name, true, DataStorageFormat.BONSAI);
} }
public BesuNode createNodeFixedPort(BesuNodeFactory factory, String name) throws Exception { public BesuNode createForestNodeFixedPort(BesuNodeFactory factory, String name) throws Exception {
return creatorFn.create(factory, name, true); return creatorFn.create(factory, name, true, DataStorageFormat.FOREST);
} }
public BesuNode createNodeWithValidators( public BesuNode createNodeWithValidators(

@ -60,10 +60,11 @@ public class BftMiningSoakTest extends ParameterizedBftTestBase {
// in between certain steps. There should be no upper-limit to how long the test is run for // in between certain steps. There should be no upper-limit to how long the test is run for
assertThat(getTestDurationMins()).isGreaterThanOrEqualTo(MIN_TEST_TIME_MINS); assertThat(getTestDurationMins()).isGreaterThanOrEqualTo(MIN_TEST_TIME_MINS);
final BesuNode minerNode1 = nodeFactory.createNodeFixedPort(besu, "miner1"); // Create a mix of Bonsai and Forest DB nodes
final BesuNode minerNode2 = nodeFactory.createNodeFixedPort(besu, "miner2"); final BesuNode minerNode1 = nodeFactory.createBonsaiNodeFixedPort(besu, "miner1");
final BesuNode minerNode3 = nodeFactory.createNodeFixedPort(besu, "miner3"); final BesuNode minerNode2 = nodeFactory.createForestNodeFixedPort(besu, "miner2");
final BesuNode minerNode4 = nodeFactory.createNodeFixedPort(besu, "miner4"); final BesuNode minerNode3 = nodeFactory.createBonsaiNodeFixedPort(besu, "miner3");
final BesuNode minerNode4 = nodeFactory.createForestNodeFixedPort(besu, "miner4");
// Each step should be given a minimum of 3 minutes to complete successfully. If the time // Each step should be given a minimum of 3 minutes to complete successfully. If the time
// give to run the soak test results in a time-per-step lower than this then the time // give to run the soak test results in a time-per-step lower than this then the time

Loading…
Cancel
Save