mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-01-04 06:13:09 +00:00
Scaffold shared node modules and deduplicate binary resolution
This commit is contained in:
parent
a5e6ebf5e6
commit
b1ee4b5898
4
testing-framework/core/src/nodes/common/api/client.rs
Normal file
4
testing-framework/core/src/nodes/common/api/client.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
/// Shared API client wrappers (placeholder).
|
||||||
|
pub struct SharedApiClient;
|
||||||
2
testing-framework/core/src/nodes/common/api/mod.rs
Normal file
2
testing-framework/core/src/nodes/common/api/mod.rs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
pub mod client;
|
||||||
|
pub mod proxy;
|
||||||
4
testing-framework/core/src/nodes/common/api/proxy.rs
Normal file
4
testing-framework/core/src/nodes/common/api/proxy.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
/// Shared API proxy helpers (placeholder).
|
||||||
|
pub struct ApiProxy;
|
||||||
35
testing-framework/core/src/nodes/common/binary.rs
Normal file
35
testing-framework/core/src/nodes/common/binary.rs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
use std::{env, path::PathBuf};
|
||||||
|
|
||||||
|
pub struct BinaryConfig {
|
||||||
|
pub env_var: &'static str,
|
||||||
|
pub binary_name: &'static str,
|
||||||
|
pub fallback_path: &'static str,
|
||||||
|
pub shared_bin_subpath: &'static str,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct BinaryResolver;
|
||||||
|
|
||||||
|
impl BinaryResolver {
|
||||||
|
pub fn resolve_path(config: &BinaryConfig) -> PathBuf {
|
||||||
|
if let Some(path) = env::var_os(config.env_var) {
|
||||||
|
return PathBuf::from(path);
|
||||||
|
}
|
||||||
|
if let Some(path) = Self::which_on_path(config.binary_name) {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
let shared_bin = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(config.shared_bin_subpath);
|
||||||
|
if shared_bin.exists() {
|
||||||
|
return shared_bin;
|
||||||
|
}
|
||||||
|
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
||||||
|
.join("../../")
|
||||||
|
.join(config.fallback_path)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn which_on_path(bin: &str) -> Option<PathBuf> {
|
||||||
|
let path_env = env::var_os("PATH")?;
|
||||||
|
env::split_paths(&path_env)
|
||||||
|
.map(|p| p.join(bin))
|
||||||
|
.find(|candidate| candidate.is_file())
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
/// Shared cryptarchia/IBD config injection utilities (placeholder).
|
||||||
|
pub struct CryptarchiaConfigInjector;
|
||||||
3
testing-framework/core/src/nodes/common/config/mod.rs
Normal file
3
testing-framework/core/src/nodes/common/config/mod.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
pub mod injection;
|
||||||
|
pub mod paths;
|
||||||
|
pub mod validation;
|
||||||
4
testing-framework/core/src/nodes/common/config/paths.rs
Normal file
4
testing-framework/core/src/nodes/common/config/paths.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
/// Shared config path helpers (placeholder).
|
||||||
|
pub struct RecoveryPathsSetup;
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
/// Shared config validation helpers (placeholder).
|
||||||
|
pub struct ConfigValidator;
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
/// Shared cleanup helpers (placeholder).
|
||||||
|
pub struct CleanupManager;
|
||||||
3
testing-framework/core/src/nodes/common/lifecycle/mod.rs
Normal file
3
testing-framework/core/src/nodes/common/lifecycle/mod.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
pub mod cleanup;
|
||||||
|
pub mod monitor;
|
||||||
|
pub mod spawn;
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
/// Shared monitoring helpers (placeholder).
|
||||||
|
pub struct Monitor;
|
||||||
@ -0,0 +1,4 @@
|
|||||||
|
#![allow(dead_code)]
|
||||||
|
|
||||||
|
/// Shared spawn helpers (placeholder).
|
||||||
|
pub struct SpawnManager;
|
||||||
4
testing-framework/core/src/nodes/common/mod.rs
Normal file
4
testing-framework/core/src/nodes/common/mod.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
pub mod api;
|
||||||
|
pub mod binary;
|
||||||
|
pub mod config;
|
||||||
|
pub mod lifecycle;
|
||||||
@ -1,6 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::HashSet,
|
collections::HashSet,
|
||||||
env,
|
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::{Child, Command, Stdio},
|
process::{Child, Command, Stdio},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
@ -26,33 +25,24 @@ use serde_yaml::{Mapping, Number as YamlNumber, Value};
|
|||||||
pub use testing_framework_config::nodes::executor::create_executor_config;
|
pub use testing_framework_config::nodes::executor::create_executor_config;
|
||||||
|
|
||||||
use super::{ApiClient, create_tempdir, persist_tempdir, should_persist_tempdir};
|
use super::{ApiClient, create_tempdir, persist_tempdir, should_persist_tempdir};
|
||||||
use crate::{IS_DEBUG_TRACING, adjust_timeout, nodes::LOGS_PREFIX};
|
use crate::{
|
||||||
|
IS_DEBUG_TRACING, adjust_timeout,
|
||||||
|
nodes::{
|
||||||
|
LOGS_PREFIX,
|
||||||
|
common::binary::{BinaryConfig, BinaryResolver},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const BIN_PATH: &str = "target/debug/nomos-executor";
|
const BIN_PATH: &str = "target/debug/nomos-executor";
|
||||||
|
|
||||||
fn binary_path() -> PathBuf {
|
fn binary_path() -> PathBuf {
|
||||||
if let Some(path) = env::var_os("NOMOS_EXECUTOR_BIN") {
|
let cfg = BinaryConfig {
|
||||||
return PathBuf::from(path);
|
env_var: "NOMOS_EXECUTOR_BIN",
|
||||||
}
|
binary_name: "nomos-executor",
|
||||||
if let Some(path) = which_on_path("nomos-executor") {
|
fallback_path: BIN_PATH,
|
||||||
return path;
|
shared_bin_subpath: "testing-framework/assets/stack/bin/nomos-executor",
|
||||||
}
|
};
|
||||||
// Default to the shared bin staging area; fall back to workspace target.
|
BinaryResolver::resolve_path(&cfg)
|
||||||
let shared_bin = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.join("../../testing-framework/assets/stack/bin/nomos-executor");
|
|
||||||
if shared_bin.exists() {
|
|
||||||
return shared_bin;
|
|
||||||
}
|
|
||||||
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.join("../../")
|
|
||||||
.join(BIN_PATH)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn which_on_path(bin: &str) -> Option<PathBuf> {
|
|
||||||
let path_env = env::var_os("PATH")?;
|
|
||||||
env::split_paths(&path_env)
|
|
||||||
.map(|p| p.join(bin))
|
|
||||||
.find(|candidate| candidate.is_file())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Executor {
|
pub struct Executor {
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
mod api_client;
|
mod api_client;
|
||||||
|
pub mod common;
|
||||||
pub mod executor;
|
pub mod executor;
|
||||||
pub mod validator;
|
pub mod validator;
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::HashSet,
|
collections::HashSet,
|
||||||
env,
|
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::{Child, Command, Stdio},
|
process::{Child, Command, Stdio},
|
||||||
time::Duration,
|
time::Duration,
|
||||||
@ -25,33 +24,24 @@ use tokio::time::error::Elapsed;
|
|||||||
use tx_service::MempoolMetrics;
|
use tx_service::MempoolMetrics;
|
||||||
|
|
||||||
use super::{ApiClient, create_tempdir, persist_tempdir, should_persist_tempdir};
|
use super::{ApiClient, create_tempdir, persist_tempdir, should_persist_tempdir};
|
||||||
use crate::{IS_DEBUG_TRACING, adjust_timeout, nodes::LOGS_PREFIX};
|
use crate::{
|
||||||
|
IS_DEBUG_TRACING, adjust_timeout,
|
||||||
|
nodes::{
|
||||||
|
LOGS_PREFIX,
|
||||||
|
common::binary::{BinaryConfig, BinaryResolver},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
const BIN_PATH: &str = "target/debug/nomos-node";
|
const BIN_PATH: &str = "target/debug/nomos-node";
|
||||||
|
|
||||||
fn binary_path() -> PathBuf {
|
fn binary_path() -> PathBuf {
|
||||||
if let Some(path) = env::var_os("NOMOS_NODE_BIN") {
|
let cfg = BinaryConfig {
|
||||||
return PathBuf::from(path);
|
env_var: "NOMOS_NODE_BIN",
|
||||||
}
|
binary_name: "nomos-node",
|
||||||
if let Some(path) = which_on_path("nomos-node") {
|
fallback_path: BIN_PATH,
|
||||||
return path;
|
shared_bin_subpath: "testing-framework/assets/stack/bin/nomos-node",
|
||||||
}
|
};
|
||||||
// Default to the shared bin staging area; fall back to workspace target.
|
BinaryResolver::resolve_path(&cfg)
|
||||||
let shared_bin = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.join("../../testing-framework/assets/stack/bin/nomos-node");
|
|
||||||
if shared_bin.exists() {
|
|
||||||
return shared_bin;
|
|
||||||
}
|
|
||||||
PathBuf::from(env!("CARGO_MANIFEST_DIR"))
|
|
||||||
.join("../../")
|
|
||||||
.join(BIN_PATH)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn which_on_path(bin: &str) -> Option<PathBuf> {
|
|
||||||
let path_env = env::var_os("PATH")?;
|
|
||||||
env::split_paths(&path_env)
|
|
||||||
.map(|p| p.join(bin))
|
|
||||||
.find(|candidate| candidate.is_file())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum Pool {
|
pub enum Pool {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user