Skip to content

Commit

Permalink
chore(starknet_integration_tests): removing node compilation
Browse files Browse the repository at this point in the history
commit-id:7e8a7075
  • Loading branch information
lev-starkware committed Dec 17, 2024
1 parent c5ee791 commit 6fbe62e
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 58 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions crates/starknet_sequencer_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repository.workspace = true
license.workspace = true

[features]
testing = ["papyrus_proc_macros", "thiserror"]
testing = ["papyrus_proc_macros"]

[lints]
workspace = true
Expand Down Expand Up @@ -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
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion crates/starknet_sequencer_node/src/test_utils/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod compilation;
pub mod node_runner;
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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<ExitStatus> {
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.");
Expand Down

0 comments on commit 6fbe62e

Please sign in to comment.