Skip to content

Commit

Permalink
fix(tests): Allow override system services config in tests [NET-576] (#…
Browse files Browse the repository at this point in the history
…1824)

* Allow override system services config in tests

* re-export system services config
  • Loading branch information
kmd-fl committed Oct 11, 2023
1 parent 7ee8efa commit 2c6b6e3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/created-swarm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ mod swarm;

pub use crate::services::*;
pub use crate::swarm::*;

pub use server_config::system_services_config;
7 changes: 7 additions & 0 deletions crates/created-swarm/src/swarm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ pub struct SwarmConfig {
pub allowed_binaries: Vec<String>,
pub enabled_system_services: Vec<String>,
pub extend_system_services: Vec<system_services::PackageDistro>,
pub override_system_services_config: Option<system_services_config::SystemServicesConfig>,
pub http_port: u16,
pub connector_api_endpoint: Option<String>,
}
Expand All @@ -267,6 +268,7 @@ impl SwarmConfig {
allowed_binaries: vec!["/usr/bin/ipfs".to_string(), "/usr/bin/curl".to_string()],
enabled_system_services: vec![],
extend_system_services: vec![],
override_system_services_config: None,
http_port: 0,
connector_api_endpoint: None,
}
Expand Down Expand Up @@ -361,6 +363,11 @@ pub fn create_swarm_with_runtime<RT: AquaRuntime>(
resolved.node_config.particle_execution_timeout = EXECUTION_TIMEOUT;

resolved.node_config.allowed_binaries = config.allowed_binaries.clone();

if let Some(config) = config.override_system_services_config.clone() {
resolved.system_services = config;
}
// `enable_system_services` has higher priority then `enable` field of the SystemServicesConfig
resolved.system_services.enable = config
.enabled_system_services
.iter()
Expand Down

0 comments on commit 2c6b6e3

Please sign in to comment.