mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-02-18 12:13:07 +00:00
Update configs after main repo merge
This commit is contained in:
parent
32b82325f5
commit
0a25bc6533
@ -37,9 +37,10 @@ async fn manual_cluster_api_port_override() -> Result<()> {
|
|||||||
.create_patch(move |mut config| {
|
.create_patch(move |mut config| {
|
||||||
println!("overriding API port to {api_port}");
|
println!("overriding API port to {api_port}");
|
||||||
|
|
||||||
let current_addr = config.http.backend_settings.address;
|
let current_addr = config.user.http.backend_settings.address;
|
||||||
|
|
||||||
config.http.backend_settings.address = SocketAddr::new(current_addr.ip(), api_port);
|
config.user.http.backend_settings.address =
|
||||||
|
SocketAddr::new(current_addr.ip(), api_port);
|
||||||
|
|
||||||
Ok(config)
|
Ok(config)
|
||||||
}),
|
}),
|
||||||
@ -73,9 +74,10 @@ async fn scenario_builder_api_port_override() -> Result<()> {
|
|||||||
.node_config_patch_with(0, move |mut config| {
|
.node_config_patch_with(0, move |mut config| {
|
||||||
println!("overriding API port to {api_port}");
|
println!("overriding API port to {api_port}");
|
||||||
|
|
||||||
let current_addr = config.http.backend_settings.address;
|
let current_addr = config.user.http.backend_settings.address;
|
||||||
|
|
||||||
config.http.backend_settings.address = SocketAddr::new(current_addr.ip(), api_port);
|
config.user.http.backend_settings.address =
|
||||||
|
SocketAddr::new(current_addr.ip(), api_port);
|
||||||
|
|
||||||
Ok(config)
|
Ok(config)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -37,9 +37,9 @@ pub struct Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn apply_node_config_patches<'a>(
|
pub fn apply_node_config_patches<'a>(
|
||||||
mut config: Config,
|
mut config: RunConfig,
|
||||||
patches: impl IntoIterator<Item = &'a NodeConfigPatch>,
|
patches: impl IntoIterator<Item = &'a NodeConfigPatch>,
|
||||||
) -> Result<Config, DynError> {
|
) -> Result<RunConfig, DynError> {
|
||||||
for patch in patches {
|
for patch in patches {
|
||||||
config = patch(config)?;
|
config = patch(config)?;
|
||||||
}
|
}
|
||||||
@ -47,9 +47,9 @@ pub fn apply_node_config_patches<'a>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn apply_node_config_patch(
|
pub fn apply_node_config_patch(
|
||||||
config: Config,
|
config: RunConfig,
|
||||||
patch: &NodeConfigPatch,
|
patch: &NodeConfigPatch,
|
||||||
) -> Result<Config, DynError> {
|
) -> Result<RunConfig, DynError> {
|
||||||
apply_node_config_patches(config, [patch])
|
apply_node_config_patches(config, [patch])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,10 @@ impl Default for StartNodeOptions {
|
|||||||
impl StartNodeOptions {
|
impl StartNodeOptions {
|
||||||
pub fn create_patch<F>(mut self, f: F) -> Self
|
pub fn create_patch<F>(mut self, f: F) -> Self
|
||||||
where
|
where
|
||||||
F: Fn(nomos_node::Config) -> Result<nomos_node::Config, DynError> + Send + Sync + 'static,
|
F: Fn(nomos_node::config::RunConfig) -> Result<nomos_node::config::RunConfig, DynError>
|
||||||
|
+ Send
|
||||||
|
+ Sync
|
||||||
|
+ 'static,
|
||||||
{
|
{
|
||||||
self.config_patch = Some(Arc::new(f));
|
self.config_patch = Some(Arc::new(f));
|
||||||
self
|
self
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
use std::{num::NonZeroUsize, sync::Arc, time::Duration};
|
use std::{num::NonZeroUsize, sync::Arc, time::Duration};
|
||||||
|
|
||||||
use nomos_node::Config as NodeConfig;
|
use nomos_node::config::RunConfig;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
use tracing::{debug, info};
|
use tracing::{debug, info};
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ impl<Caps> TopologyConfigurator<Caps> {
|
|||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn node_config_patch_with<F>(mut self, index: usize, f: F) -> Self
|
pub fn node_config_patch_with<F>(mut self, index: usize, f: F) -> Self
|
||||||
where
|
where
|
||||||
F: Fn(NodeConfig) -> Result<NodeConfig, DynError> + Send + Sync + 'static,
|
F: Fn(RunConfig) -> Result<RunConfig, DynError> + Send + Sync + 'static,
|
||||||
{
|
{
|
||||||
self.builder.topology = self
|
self.builder.topology = self
|
||||||
.builder
|
.builder
|
||||||
|
|||||||
@ -4,7 +4,7 @@ use nomos_core::{
|
|||||||
mantle::GenesisTx as _,
|
mantle::GenesisTx as _,
|
||||||
sdp::{Locator, ServiceType},
|
sdp::{Locator, ServiceType},
|
||||||
};
|
};
|
||||||
use nomos_node::Config as NodeConfig;
|
use nomos_node::config::RunConfig;
|
||||||
use testing_framework_config::topology::{
|
use testing_framework_config::topology::{
|
||||||
configs::{
|
configs::{
|
||||||
api::{ApiConfigError, create_api_configs},
|
api::{ApiConfigError, create_api_configs},
|
||||||
@ -31,7 +31,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
/// Per-node config patch applied after the default node config is generated.
|
/// Per-node config patch applied after the default node config is generated.
|
||||||
pub type NodeConfigPatch = Arc<dyn Fn(NodeConfig) -> Result<NodeConfig, DynError> + Send + Sync>;
|
pub type NodeConfigPatch = Arc<dyn Fn(RunConfig) -> Result<RunConfig, DynError> + Send + Sync>;
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum TopologyBuildError {
|
pub enum TopologyBuildError {
|
||||||
|
|||||||
@ -3,7 +3,7 @@ use std::{
|
|||||||
sync::Mutex,
|
sync::Mutex,
|
||||||
};
|
};
|
||||||
|
|
||||||
use nomos_node::config::RunConfig as NodeConfig;
|
use nomos_node::config::RunConfig;
|
||||||
use testing_framework_config::topology::configs::{consensus, time};
|
use testing_framework_config::topology::configs::{consensus, time};
|
||||||
use testing_framework_core::{
|
use testing_framework_core::{
|
||||||
nodes::{
|
nodes::{
|
||||||
@ -266,7 +266,7 @@ impl LocalDynamicNodes {
|
|||||||
&self,
|
&self,
|
||||||
node_name: &str,
|
node_name: &str,
|
||||||
network_port: u16,
|
network_port: u16,
|
||||||
config: NodeConfig,
|
config: RunConfig,
|
||||||
) -> Result<ApiClient, LocalDynamicError> {
|
) -> Result<ApiClient, LocalDynamicError> {
|
||||||
let node = Node::spawn(config, node_name)
|
let node = Node::spawn(config, node_name)
|
||||||
.await
|
.await
|
||||||
@ -290,7 +290,7 @@ fn build_node_config(
|
|||||||
general_config: testing_framework_config::topology::configs::GeneralConfig,
|
general_config: testing_framework_config::topology::configs::GeneralConfig,
|
||||||
descriptor_patch: Option<&testing_framework_core::topology::config::NodeConfigPatch>,
|
descriptor_patch: Option<&testing_framework_core::topology::config::NodeConfigPatch>,
|
||||||
options_patch: Option<&testing_framework_core::topology::config::NodeConfigPatch>,
|
options_patch: Option<&testing_framework_core::topology::config::NodeConfigPatch>,
|
||||||
) -> Result<NodeConfig, LocalDynamicError> {
|
) -> Result<RunConfig, LocalDynamicError> {
|
||||||
let mut config = create_node_config(general_config);
|
let mut config = create_node_config(general_config);
|
||||||
config = apply_patch_if_needed(config, descriptor_patch)?;
|
config = apply_patch_if_needed(config, descriptor_patch)?;
|
||||||
config = apply_patch_if_needed(config, options_patch)?;
|
config = apply_patch_if_needed(config, options_patch)?;
|
||||||
@ -299,9 +299,9 @@ fn build_node_config(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn apply_patch_if_needed(
|
fn apply_patch_if_needed(
|
||||||
config: NodeConfig,
|
config: RunConfig,
|
||||||
patch: Option<&testing_framework_core::topology::config::NodeConfigPatch>,
|
patch: Option<&testing_framework_core::topology::config::NodeConfigPatch>,
|
||||||
) -> Result<NodeConfig, LocalDynamicError> {
|
) -> Result<RunConfig, LocalDynamicError> {
|
||||||
let Some(patch) = patch else {
|
let Some(patch) = patch else {
|
||||||
return Ok(config);
|
return Ok(config);
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user