Add suport for --plugins option in acceptance tests (#7713)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
pull/7732/head
Fabio Di Fabio 2 months ago committed by GitHub
parent 9310e1031d
commit 94099d18f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/BesuNode.java
  2. 5
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ProcessBesuNodeRunner.java
  3. 15
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/ThreadBesuNodeRunner.java
  4. 7
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfiguration.java
  5. 8
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeConfigurationBuilder.java
  6. 1
      acceptance-tests/dsl/src/main/java/org/hyperledger/besu/tests/acceptance/dsl/node/configuration/BesuNodeFactory.java

@ -128,6 +128,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable
private boolean useWsForJsonRpc = false;
private String token = null;
private final List<String> plugins = new ArrayList<>();
private final List<String> requestedPlugins;
private final List<String> extraCLIOptions;
private final List<String> staticNodes;
private boolean isDnsEnabled = false;
@ -163,6 +164,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable
final boolean secp256k1Native,
final boolean altbn128Native,
final List<String> plugins,
final List<String> requestedPlugins,
final List<String> extraCLIOptions,
final List<String> staticNodes,
final boolean isDnsEnabled,
@ -224,6 +226,7 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable
LOG.error("Could not find plugin \"{}\" in resources", pluginName);
}
});
this.requestedPlugins = requestedPlugins;
engineRpcConfiguration.ifPresent(
config -> MergeConfigOptions.setMergeEnabled(config.isEnabled()));
this.extraCLIOptions = extraCLIOptions;
@ -738,6 +741,10 @@ public class BesuNode implements NodeConfiguration, RunnableNode, AutoCloseable
return plugins;
}
public List<String> getRequestedPlugins() {
return requestedPlugins;
}
@Override
public List<String> getExtraCLIOptions() {
return extraCLIOptions;

@ -451,6 +451,11 @@ public class ProcessBesuNodeRunner implements BesuNodeRunner {
params.add("--logging=" + level);
}
if (!node.getRequestedPlugins().isEmpty()) {
params.add(
"--plugins=" + node.getRequestedPlugins().stream().collect(Collectors.joining(",")));
}
params.addAll(node.getRunCommand());
return params;
}

@ -39,6 +39,7 @@ import org.hyperledger.besu.ethereum.chain.Blockchain;
import org.hyperledger.besu.ethereum.core.ImmutableMiningParameters;
import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.plugins.PluginConfiguration;
import org.hyperledger.besu.ethereum.core.plugins.PluginInfo;
import org.hyperledger.besu.ethereum.eth.EthProtocolConfiguration;
import org.hyperledger.besu.ethereum.eth.sync.SynchronizerConfiguration;
import org.hyperledger.besu.ethereum.eth.transactions.BlobCacheModule;
@ -302,6 +303,12 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
return toProvide.getExtraCLIOptions();
}
@Provides
@Named("RequestedPlugins")
public List<String> provideRequestedPlugins() {
return toProvide.getRequestedPlugins();
}
@Provides
Path provideDataDir() {
return toProvide.homeDirectory();
@ -469,7 +476,8 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
final RpcEndpointServiceImpl rpcEndpointServiceImpl,
final BesuConfiguration commonPluginConfiguration,
final PermissioningServiceImpl permissioningService,
final @Named("ExtraCLIOptions") List<String> extraCLIOptions) {
final @Named("ExtraCLIOptions") List<String> extraCLIOptions,
final @Named("RequestedPlugins") List<String> requestedPlugins) {
final CommandLine commandLine = new CommandLine(CommandSpec.create());
final BesuPluginContextImpl besuPluginContext = new BesuPluginContextImpl();
besuPluginContext.addService(StorageService.class, storageService);
@ -504,7 +512,10 @@ public class ThreadBesuNodeRunner implements BesuNodeRunner {
besuPluginContext.addService(PrivacyPluginService.class, new PrivacyPluginServiceImpl());
besuPluginContext.initialize(
new PluginConfiguration.Builder().pluginsDir(pluginsPath).build());
new PluginConfiguration.Builder()
.pluginsDir(pluginsPath)
.requestedPlugins(requestedPlugins.stream().map(PluginInfo::new).toList())
.build());
besuPluginContext.registerPlugins();
commandLine.parseArgs(extraCLIOptions.toArray(new String[0]));

@ -64,6 +64,7 @@ public class BesuNodeConfiguration {
private final boolean secp256k1Native;
private final boolean altbn128Native;
private final List<String> plugins;
private final List<String> requestedPlugins;
private final List<String> extraCLIOptions;
private final List<String> staticNodes;
private final boolean isDnsEnabled;
@ -102,6 +103,7 @@ public class BesuNodeConfiguration {
final boolean secp256k1Native,
final boolean altbn128Native,
final List<String> plugins,
final List<String> requestedPlugins,
final List<String> extraCLIOptions,
final List<String> staticNodes,
final boolean isDnsEnabled,
@ -137,6 +139,7 @@ public class BesuNodeConfiguration {
this.secp256k1Native = secp256k1Native;
this.altbn128Native = altbn128Native;
this.plugins = plugins;
this.requestedPlugins = requestedPlugins;
this.extraCLIOptions = extraCLIOptions;
this.staticNodes = staticNodes;
this.isDnsEnabled = isDnsEnabled;
@ -239,6 +242,10 @@ public class BesuNodeConfiguration {
return plugins;
}
public List<String> getRequestedPlugins() {
return requestedPlugins;
}
public List<String> getExtraCLIOptions() {
return extraCLIOptions;
}

@ -93,6 +93,7 @@ public class BesuNodeConfigurationBuilder {
private boolean secp256K1Native = true;
private boolean altbn128Native = true;
private final List<String> plugins = new ArrayList<>();
private final List<String> requestedPlugins = new ArrayList<>();
private final List<String> extraCLIOptions = new ArrayList<>();
private List<String> staticNodes = new ArrayList<>();
private boolean isDnsEnabled = false;
@ -448,6 +449,12 @@ public class BesuNodeConfigurationBuilder {
return this;
}
public BesuNodeConfigurationBuilder requestedPlugins(final List<String> requestedPlugins) {
this.requestedPlugins.clear();
this.requestedPlugins.addAll(requestedPlugins);
return this;
}
public BesuNodeConfigurationBuilder extraCLIOptions(final List<String> extraCLIOptions) {
this.extraCLIOptions.clear();
this.extraCLIOptions.addAll(extraCLIOptions);
@ -545,6 +552,7 @@ public class BesuNodeConfigurationBuilder {
secp256K1Native,
altbn128Native,
plugins,
requestedPlugins,
extraCLIOptions,
staticNodes,
isDnsEnabled,

@ -77,6 +77,7 @@ public class BesuNodeFactory {
config.isSecp256k1Native(),
config.isAltbn128Native(),
config.getPlugins(),
config.getRequestedPlugins(),
config.getExtraCLIOptions(),
config.getStaticNodes(),
config.isDnsEnabled(),

Loading…
Cancel
Save