From 149e3b62fd4fe8885cfe52142d8beed382c33c46 Mon Sep 17 00:00:00 2001 From: Lev Roitman Date: Tue, 17 Dec 2024 10:51:18 +0200 Subject: [PATCH] chore(starknet_integration_tests): removing node compilation commit-id:7e8a7075 --- Cargo.lock | 1 - .../src/end_to_end_integration.rs | 2 +- crates/starknet_sequencer_node/Cargo.toml | 3 +- .../src/test_utils/compilation_test.rs | 9 ---- .../src/test_utils/mod.rs | 2 +- .../{compilation.rs => node_runner.rs} | 45 +------------------ 6 files changed, 4 insertions(+), 58 deletions(-) delete mode 100644 crates/starknet_sequencer_node/src/test_utils/compilation_test.rs rename crates/starknet_sequencer_node/src/test_utils/{compilation.rs => node_runner.rs} (60%) diff --git a/Cargo.lock b/Cargo.lock index 5d9e9d4161..19f243ef04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10705,7 +10705,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.");