Skip to content

Commit

Permalink
test(tests-integration): send txs in e2e integration test
Browse files Browse the repository at this point in the history
commit-id:4e30381d
Itay-Tsabary-Starkware committed Nov 10, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 4b939a7 commit 88838f0
Showing 4 changed files with 22 additions and 48 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.

1 change: 0 additions & 1 deletion crates/tests-integration/Cargo.toml
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ chrono.workspace = true
indexmap.workspace = true
mempool_test_utils.workspace = true
papyrus_common.workspace = true
papyrus_config.workspace = true
papyrus_consensus.workspace = true
papyrus_rpc.workspace = true
papyrus_storage = { workspace = true, features = ["testing"] }
45 changes: 0 additions & 45 deletions crates/tests-integration/src/bin/run_test_tx_generator.rs

This file was deleted.

23 changes: 22 additions & 1 deletion crates/tests-integration/tests/end_to_end_integration_test.rs
Original file line number Diff line number Diff line change
@@ -5,10 +5,13 @@ use std::process::Stdio;

use mempool_test_utils::starknet_api_test_utils::MultiAccountTransactionGenerator;
use rstest::{fixture, rstest};
use starknet_http_server::config::HttpServerConfig;
use starknet_integration_tests::integration_test_config_utils::dump_config_file_changes;
use starknet_integration_tests::integration_test_utils::{
create_config,
create_integration_test_tx_generator,
run_transaction_generator_test_scenario,
HttpTestClient,
};
use starknet_integration_tests::state_reader::{spawn_test_rpc_state_reader, StorageTestSetup};
use starknet_monitoring_endpoint::config::MonitoringEndpointConfig;
@@ -83,9 +86,27 @@ async fn test_end_to_end_integration(tx_generator: MultiAccountTransactionGenera
let (node_config_path, _) = dump_config_file_changes(&config, required_params, &temp_dir);

info!("Running sequencer node.");
let _node_run_handle = spawn_run_node(node_config_path).await;
let node_run_handle = spawn_run_node(node_config_path).await;

// Wait for the node to start.
let MonitoringEndpointConfig { ip, port } = config.monitoring_endpoint_config;
let is_alive_test_client = IsAliveClient::new(SocketAddr::from((ip, port)));
is_alive_test_client.await_alive().await;

info!("Running integration test simulator.");
let HttpServerConfig { ip, port } = config.http_server_config;
let http_test_client = HttpTestClient::new(SocketAddr::from((ip, port)));

let send_rpc_tx_fn = &|rpc_tx| http_test_client.assert_add_tx_success(rpc_tx);
let n_txs = 50;
info!("Sending {n_txs} txs.");
run_transaction_generator_test_scenario(tx_generator, n_txs, send_rpc_tx_fn).await;

info!("Shutting down.");
node_run_handle.abort();
let res = node_run_handle.await;
assert!(
res.expect_err("Node should have been stopped.").is_cancelled(),
"Node should have been stopped."
);
}

0 comments on commit 88838f0

Please sign in to comment.