diff --git a/Cargo.lock b/Cargo.lock index 546c487a4e..a0f1300273 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10704,7 +10704,6 @@ dependencies = [ "starknet_sierra_compile", "starknet_state_sync", "starknet_state_sync_types", - "thiserror", "tokio", "tracing", "validator", diff --git a/crates/starknet_integration_tests/src/end_to_end_integration.rs b/crates/starknet_integration_tests/src/end_to_end_integration.rs index 99fa814e97..cb2fdaf87c 100644 --- a/crates/starknet_integration_tests/src/end_to_end_integration.rs +++ b/crates/starknet_integration_tests/src/end_to_end_integration.rs @@ -6,7 +6,7 @@ use papyrus_storage::StorageReader; use starknet_api::block::BlockNumber; use starknet_api::core::{ContractAddress, Nonce}; use starknet_api::state::StateNumber; -use starknet_sequencer_node::test_utils::compilation::{get_node_executable_path, spawn_run_node}; +use starknet_sequencer_node::test_utils::node_runner::{get_node_executable_path, spawn_run_node}; use starknet_types_core::felt::Felt; use tracing::info; diff --git a/crates/starknet_sequencer_node/Cargo.toml b/crates/starknet_sequencer_node/Cargo.toml index c2707768ba..cf979a25e5 100644 --- a/crates/starknet_sequencer_node/Cargo.toml +++ b/crates/starknet_sequencer_node/Cargo.toml @@ -6,7 +6,7 @@ repository.workspace = true license.workspace = true [features] -testing = ["papyrus_proc_macros", "thiserror"] +testing = ["papyrus_proc_macros"] [lints] workspace = true @@ -40,7 +40,6 @@ starknet_sequencer_infra.workspace = true starknet_sierra_compile.workspace = true starknet_state_sync.workspace = true starknet_state_sync_types.workspace = true -thiserror = { workspace = true, optional = true } tokio.workspace = true tracing.workspace = true validator.workspace = true diff --git a/crates/starknet_sequencer_node/src/test_utils/compilation_test.rs b/crates/starknet_sequencer_node/src/test_utils/compilation_test.rs deleted file mode 100644 index 3e2f6b6200..0000000000 --- a/crates/starknet_sequencer_node/src/test_utils/compilation_test.rs +++ /dev/null @@ -1,9 +0,0 @@ -use rstest::rstest; - -use crate::test_utils::compilation::compile_node_result; - -#[rstest] -#[tokio::test] -async fn test_compile_node() { - assert!(compile_node_result().await.is_ok(), "Compilation failed"); -} diff --git a/crates/starknet_sequencer_node/src/test_utils/mod.rs b/crates/starknet_sequencer_node/src/test_utils/mod.rs index 8753047299..3296934736 100644 --- a/crates/starknet_sequencer_node/src/test_utils/mod.rs +++ b/crates/starknet_sequencer_node/src/test_utils/mod.rs @@ -1 +1 @@ -pub mod compilation; +pub mod node_runner; diff --git a/crates/starknet_sequencer_node/src/test_utils/compilation.rs b/crates/starknet_sequencer_node/src/test_utils/node_runner.rs similarity index 60% rename from crates/starknet_sequencer_node/src/test_utils/compilation.rs rename to crates/starknet_sequencer_node/src/test_utils/node_runner.rs index 0b57a91a10..e929f15872 100644 --- a/crates/starknet_sequencer_node/src/test_utils/compilation.rs +++ b/crates/starknet_sequencer_node/src/test_utils/node_runner.rs @@ -1,6 +1,5 @@ -use std::io; use std::path::PathBuf; -use std::process::{ExitStatus, Stdio}; +use std::process::Stdio; use infra_utils::command::create_shell_command; use infra_utils::path::resolve_project_relative_path; @@ -10,48 +9,6 @@ use tracing::{error, info}; pub const NODE_EXECUTABLE_PATH: &str = "target/debug/starknet_sequencer_node"; -#[cfg(test)] -#[path = "compilation_test.rs"] -mod compilation_test; - -#[derive(thiserror::Error, Debug)] -pub enum NodeCompilationError { - #[error(transparent)] - IO(#[from] io::Error), - #[error("Exit status: {0}.")] - Status(ExitStatus), -} - -/// Compiles the node using `cargo build` for testing purposes. -async fn compile_node() -> io::Result { - info!( - "Compiling the starknet_sequencer_node binary, expected destination: \ - {NODE_EXECUTABLE_PATH}" - ); - - // Run `cargo build` to compile the project - let compilation_result = create_shell_command("cargo") - .arg("build") - .arg("--bin") - .arg("starknet_sequencer_node") - .arg("--quiet") - .stderr(Stdio::inherit()) - .stdout(Stdio::inherit()) - .status() - .await?; - - info!("Compilation result: {:?}", compilation_result); - Ok(compilation_result) -} - -pub async fn compile_node_result() -> Result<(), NodeCompilationError> { - match compile_node().await { - Ok(status) if status.success() => Ok(()), - Ok(status) => Err(NodeCompilationError::Status(status)), - Err(e) => Err(NodeCompilationError::IO(e)), - } -} - pub async fn spawn_run_node(node_config_path: PathBuf) -> JoinHandle<()> { task::spawn(async move { info!("Running the node from its spawned task.");