Skip to content

Commit

Permalink
chore(starknet_integration_tests): removing sequencer node compilatio…
Browse files Browse the repository at this point in the history
…n from the e2e integration test

commit-id:9d699df3
  • Loading branch information
lev-starkware committed Dec 16, 2024
1 parent 3821842 commit ec3fb5b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/sequencer_integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ jobs:
- uses: ./.github/actions/bootstrap
- run: |
cargo build --bin e2e_integration_test
cargo build --bin starknet_sequencer_node
target/debug/e2e_integration_test
13 changes: 10 additions & 3 deletions crates/starknet_integration_tests/src/end_to_end_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ 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::spawn_run_node;
use starknet_sequencer_node::test_utils::compilation::{
check_node_executable_present,
spawn_run_node,
};
use starknet_types_core::felt::Felt;
use tracing::info;
use tracing::{error, info};

use crate::integration_test_setup::IntegrationTestSetup;
use crate::utils::send_account_txs;
Expand Down Expand Up @@ -51,8 +54,12 @@ async fn await_block(
pub async fn end_to_end_integration(mut tx_generator: MultiAccountTransactionGenerator) {
const EXPECTED_BLOCK_NUMBER: BlockNumber = BlockNumber(15);

info!("Running integration test setup.");
info!("Checking that the sequencer node executable is present.");
if !check_node_executable_present() {
panic!("Node executable is not present.");
}

info!("Running integration test setup.");
// Creating the storage for the test.
let integration_test_setup = IntegrationTestSetup::new_from_tx_generator(&tx_generator).await;

Expand Down
24 changes: 18 additions & 6 deletions crates/starknet_sequencer_node/src/test_utils/compilation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,8 @@ pub async fn spawn_run_node(node_config_path: PathBuf) -> JoinHandle<()> {

async fn spawn_node_child_task(node_config_path: PathBuf) -> Child {
// TODO(Tsabary): Capture output to a log file, and present it in case of a failure.
info!("Compiling the node.");
compile_node_result().await.expect("Failed to compile the sequencer node.");
let node_executable = resolve_project_relative_path(NODE_EXECUTABLE_PATH)
.expect("Node executable should be available")
.to_string_lossy()
.to_string();
info!("Getting the node executable.");
let node_executable = get_node_executable_path().expect("Node executable should be available");

info!("Running the node from: {}", node_executable);
create_shell_command(node_executable.as_str())
Expand All @@ -82,3 +78,19 @@ async fn spawn_node_child_task(node_config_path: PathBuf) -> Child {
.spawn()
.expect("Failed to spawn the sequencer node.")
}

fn get_node_executable_path() -> Result<String, io::Error> {
resolve_project_relative_path(NODE_EXECUTABLE_PATH)
.map(|path| path.to_string_lossy().to_string())
}

pub fn check_node_executable_present() -> bool {
if get_node_executable_path().is_err() {
error!(
"Sequencer node binary is not present. Please compile it using 'cargo build --bin \
starknet_sequencer_node' command."
);
return false;
}
true
}

0 comments on commit ec3fb5b

Please sign in to comment.