Skip to content

Commit 55cbb16

Browse files
matthew1001gconnect
authored andcommitted
BFT soak test - use both db modes (hyperledger#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> Signed-off-by: gconnect <agatevureglory@gmail.com>
1 parent 87119fe commit 55cbb16

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java

+17-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
3333
import org.hyperledger.besu.ethereum.permissioning.LocalPermissioningConfiguration;
3434
import org.hyperledger.besu.ethereum.permissioning.PermissioningConfiguration;
35+
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
3536
import org.hyperledger.besu.pki.keystore.KeyStoreWrapper;
37+
import org.hyperledger.besu.plugin.services.storage.DataStorageFormat;
3638
import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode;
3739
import org.hyperledger.besu.tests.acceptance.dsl.node.Node;
3840
import org.hyperledger.besu.tests.acceptance.dsl.node.RunnableNode;
@@ -476,21 +478,28 @@ public BesuNode createIbft2Node(final String name, final String genesisFile) thr
476478
.build());
477479
}
478480

479-
public BesuNode createIbft2Node(final String name, final boolean fixedPort) throws IOException {
481+
public BesuNode createIbft2Node(
482+
final String name, final boolean fixedPort, final DataStorageFormat storageFormat)
483+
throws IOException {
480484
JsonRpcConfiguration rpcConfig = node.createJsonRpcWithIbft2EnabledConfig(false);
481485
rpcConfig.addRpcApi("ADMIN,TXPOOL");
482486
if (fixedPort) {
483487
rpcConfig.setPort(
484488
Math.abs(name.hashCode() % 60000)
485489
+ 1024); // Generate a consistent port for p2p based on node name
486490
}
491+
487492
BesuNodeConfigurationBuilder builder =
488493
new BesuNodeConfigurationBuilder()
489494
.name(name)
490495
.miningEnabled()
491496
.jsonRpcConfiguration(rpcConfig)
492497
.webSocketConfiguration(node.createWebSocketEnabledConfig())
493498
.devMode(false)
499+
.dataStorageConfiguration(
500+
storageFormat == DataStorageFormat.FOREST
501+
? DataStorageConfiguration.DEFAULT_FOREST_CONFIG
502+
: DataStorageConfiguration.DEFAULT_BONSAI_CONFIG)
494503
.genesisConfigProvider(GenesisConfigurationFactory::createIbft2GenesisConfig);
495504
if (fixedPort) {
496505
builder.p2pPort(
@@ -527,7 +536,9 @@ public BesuNode createQbftNodeWithTLSPKCS11(final String name) throws IOExceptio
527536
return createQbftNodeWithTLS(name, KeyStoreWrapper.KEYSTORE_TYPE_PKCS11);
528537
}
529538

530-
public BesuNode createQbftNode(final String name, final boolean fixedPort) throws IOException {
539+
public BesuNode createQbftNode(
540+
final String name, final boolean fixedPort, final DataStorageFormat storageFormat)
541+
throws IOException {
531542
JsonRpcConfiguration rpcConfig = node.createJsonRpcWithQbftEnabledConfig(false);
532543
rpcConfig.addRpcApi("ADMIN,TXPOOL");
533544
if (fixedPort) {
@@ -543,6 +554,10 @@ public BesuNode createQbftNode(final String name, final boolean fixedPort) throw
543554
.jsonRpcConfiguration(rpcConfig)
544555
.webSocketConfiguration(node.createWebSocketEnabledConfig())
545556
.devMode(false)
557+
.dataStorageConfiguration(
558+
storageFormat == DataStorageFormat.FOREST
559+
? DataStorageConfiguration.DEFAULT_FOREST_CONFIG
560+
: DataStorageConfiguration.DEFAULT_BONSAI_CONFIG)
546561
.genesisConfigProvider(GenesisConfigurationFactory::createQbftGenesisConfig);
547562
if (fixedPort) {
548563
builder.p2pPort(

acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/bft/BftAcceptanceTestParameterization.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515
package org.hyperledger.besu.tests.acceptance.bft;
1616

17+
import org.hyperledger.besu.plugin.services.storage.DataStorageFormat;
1718
import org.hyperledger.besu.tests.acceptance.dsl.node.BesuNode;
1819
import org.hyperledger.besu.tests.acceptance.dsl.node.configuration.BesuNodeFactory;
1920

@@ -38,7 +39,9 @@ public static Stream<Arguments> getFactories() {
3839
@FunctionalInterface
3940
public interface NodeCreator {
4041

41-
BesuNode create(BesuNodeFactory factory, String name, boolean fixedPort) throws Exception;
42+
BesuNode create(
43+
BesuNodeFactory factory, String name, boolean fixedPort, DataStorageFormat storageFormat)
44+
throws Exception;
4245
}
4346

4447
@FunctionalInterface
@@ -64,11 +67,15 @@ public BftAcceptanceTestParameterization(
6467
}
6568

6669
public BesuNode createNode(BesuNodeFactory factory, String name) throws Exception {
67-
return creatorFn.create(factory, name, false);
70+
return creatorFn.create(factory, name, false, DataStorageFormat.FOREST);
71+
}
72+
73+
public BesuNode createBonsaiNodeFixedPort(BesuNodeFactory factory, String name) throws Exception {
74+
return creatorFn.create(factory, name, true, DataStorageFormat.BONSAI);
6875
}
6976

70-
public BesuNode createNodeFixedPort(BesuNodeFactory factory, String name) throws Exception {
71-
return creatorFn.create(factory, name, true);
77+
public BesuNode createForestNodeFixedPort(BesuNodeFactory factory, String name) throws Exception {
78+
return creatorFn.create(factory, name, true, DataStorageFormat.FOREST);
7279
}
7380

7481
public BesuNode createNodeWithValidators(

acceptance-tests/tests/src/test/java/org/hyperledger/besu/tests/acceptance/bftsoak/BftMiningSoakTest.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ public void shouldBeStableDuringLongTest(
6060
// in between certain steps. There should be no upper-limit to how long the test is run for
6161
assertThat(getTestDurationMins()).isGreaterThanOrEqualTo(MIN_TEST_TIME_MINS);
6262

63-
final BesuNode minerNode1 = nodeFactory.createNodeFixedPort(besu, "miner1");
64-
final BesuNode minerNode2 = nodeFactory.createNodeFixedPort(besu, "miner2");
65-
final BesuNode minerNode3 = nodeFactory.createNodeFixedPort(besu, "miner3");
66-
final BesuNode minerNode4 = nodeFactory.createNodeFixedPort(besu, "miner4");
63+
// Create a mix of Bonsai and Forest DB nodes
64+
final BesuNode minerNode1 = nodeFactory.createBonsaiNodeFixedPort(besu, "miner1");
65+
final BesuNode minerNode2 = nodeFactory.createForestNodeFixedPort(besu, "miner2");
66+
final BesuNode minerNode3 = nodeFactory.createBonsaiNodeFixedPort(besu, "miner3");
67+
final BesuNode minerNode4 = nodeFactory.createForestNodeFixedPort(besu, "miner4");
6768

6869
// Each step should be given a minimum of 3 minutes to complete successfully. If the time
6970
// give to run the soak test results in a time-per-step lower than this then the time

0 commit comments

Comments
 (0)