diff --git a/crates/starknet_infra_utils/Cargo.toml b/crates/starknet_infra_utils/Cargo.toml index de9fa0b1f1..704b98b876 100644 --- a/crates/starknet_infra_utils/Cargo.toml +++ b/crates/starknet_infra_utils/Cargo.toml @@ -7,7 +7,7 @@ license-file.workspace = true description = "Infrastructure utility." [features] -testing = [] +testing = ["tokio/net"] [lints] workspace = true diff --git a/crates/starknet_infra_utils/src/lib.rs b/crates/starknet_infra_utils/src/lib.rs index ed5c7d9a11..1a16c90970 100644 --- a/crates/starknet_infra_utils/src/lib.rs +++ b/crates/starknet_infra_utils/src/lib.rs @@ -5,5 +5,7 @@ pub mod run_until; pub mod tasks; #[cfg(any(feature = "testing", test))] pub mod test_identifiers; +#[cfg(any(feature = "testing", test))] +pub mod test_utils; pub mod tracing; pub mod type_name; diff --git a/crates/starknet_sequencer_infra/src/test_utils.rs b/crates/starknet_infra_utils/src/test_utils.rs similarity index 100% rename from crates/starknet_sequencer_infra/src/test_utils.rs rename to crates/starknet_infra_utils/src/test_utils.rs diff --git a/crates/starknet_integration_tests/src/flow_test_setup.rs b/crates/starknet_integration_tests/src/flow_test_setup.rs index 2ba0614c0a..3b93be6702 100644 --- a/crates/starknet_integration_tests/src/flow_test_setup.rs +++ b/crates/starknet_integration_tests/src/flow_test_setup.rs @@ -18,10 +18,10 @@ use starknet_consensus_manager::config::ConsensusManagerConfig; use starknet_gateway_types::errors::GatewaySpecError; use starknet_http_server::config::HttpServerConfig; use starknet_http_server::test_utils::HttpTestClient; +use starknet_infra_utils::test_utils::AvailablePorts; use starknet_mempool_p2p::config::MempoolP2pConfig; use starknet_monitoring_endpoint::config::MonitoringEndpointConfig; use starknet_monitoring_endpoint::test_utils::MonitoringClient; -use starknet_sequencer_infra::test_utils::AvailablePorts; use starknet_sequencer_node::config::component_config::ComponentConfig; use starknet_sequencer_node::config::node_config::SequencerNodeConfig; use starknet_sequencer_node::servers::run_component_servers; diff --git a/crates/starknet_integration_tests/src/integration_test_setup.rs b/crates/starknet_integration_tests/src/integration_test_setup.rs index 7d47929672..2087d94d75 100644 --- a/crates/starknet_integration_tests/src/integration_test_setup.rs +++ b/crates/starknet_integration_tests/src/integration_test_setup.rs @@ -9,10 +9,10 @@ use starknet_api::transaction::TransactionHash; use starknet_consensus_manager::config::ConsensusManagerConfig; use starknet_http_server::config::HttpServerConfig; use starknet_http_server::test_utils::HttpTestClient; +use starknet_infra_utils::test_utils::AvailablePorts; use starknet_mempool_p2p::config::MempoolP2pConfig; use starknet_monitoring_endpoint::config::MonitoringEndpointConfig; use starknet_monitoring_endpoint::test_utils::MonitoringClient; -use starknet_sequencer_infra::test_utils::AvailablePorts; use starknet_sequencer_node::config::component_config::ComponentConfig; use starknet_sequencer_node::test_utils::node_runner::NodeRunner; use starknet_state_sync::config::StateSyncConfig; diff --git a/crates/starknet_integration_tests/src/sequencer_manager.rs b/crates/starknet_integration_tests/src/sequencer_manager.rs index 02d8d20258..16ba104f6c 100644 --- a/crates/starknet_integration_tests/src/sequencer_manager.rs +++ b/crates/starknet_integration_tests/src/sequencer_manager.rs @@ -16,8 +16,8 @@ use starknet_api::state::StateNumber; use starknet_api::transaction::TransactionHash; use starknet_infra_utils::run_until::run_until; use starknet_infra_utils::test_identifiers::TestIdentifier; +use starknet_infra_utils::test_utils::{AvailablePorts, MAX_NUMBER_OF_INSTANCES_PER_TEST}; use starknet_infra_utils::tracing::{CustomLogger, TraceLevel}; -use starknet_sequencer_infra::test_utils::{AvailablePorts, MAX_NUMBER_OF_INSTANCES_PER_TEST}; use starknet_sequencer_node::config::component_config::ComponentConfig; use starknet_sequencer_node::config::component_execution_config::{ ActiveComponentExecutionConfig, diff --git a/crates/starknet_integration_tests/src/utils.rs b/crates/starknet_integration_tests/src/utils.rs index 6ca4b9332a..cec8f08554 100644 --- a/crates/starknet_integration_tests/src/utils.rs +++ b/crates/starknet_integration_tests/src/utils.rs @@ -34,9 +34,9 @@ use starknet_gateway::config::{ StatelessTransactionValidatorConfig, }; use starknet_http_server::test_utils::create_http_server_config; +use starknet_infra_utils::test_utils::AvailablePorts; use starknet_mempool_p2p::config::MempoolP2pConfig; use starknet_monitoring_endpoint::config::MonitoringEndpointConfig; -use starknet_sequencer_infra::test_utils::AvailablePorts; use starknet_sequencer_node::config::component_config::ComponentConfig; use starknet_sequencer_node::config::config_utils::{ EthereumBaseLayerConfigRequiredParams, diff --git a/crates/starknet_sequencer_infra/Cargo.toml b/crates/starknet_sequencer_infra/Cargo.toml index 08d60b14e8..d45bd7d25a 100644 --- a/crates/starknet_sequencer_infra/Cargo.toml +++ b/crates/starknet_sequencer_infra/Cargo.toml @@ -31,3 +31,4 @@ validator.workspace = true assert_matches.workspace = true pretty_assertions.workspace = true starknet-types-core.workspace = true +starknet_infra_utils = { workspace = true, features = ["testing"] } diff --git a/crates/starknet_sequencer_infra/src/lib.rs b/crates/starknet_sequencer_infra/src/lib.rs index 306085d44a..5edaa82788 100644 --- a/crates/starknet_sequencer_infra/src/lib.rs +++ b/crates/starknet_sequencer_infra/src/lib.rs @@ -3,8 +3,6 @@ pub mod component_definitions; pub mod component_server; pub mod errors; pub mod serde_utils; -#[cfg(any(feature = "testing", test))] -pub mod test_utils; #[cfg(test)] pub mod tests; pub mod trace_util; diff --git a/crates/starknet_sequencer_infra/src/tests/remote_component_client_server_test.rs b/crates/starknet_sequencer_infra/src/tests/remote_component_client_server_test.rs index c0284a71a7..6b3e31b312 100644 --- a/crates/starknet_sequencer_infra/src/tests/remote_component_client_server_test.rs +++ b/crates/starknet_sequencer_infra/src/tests/remote_component_client_server_test.rs @@ -10,6 +10,7 @@ use hyper::{Body, Client, Request, Response, Server, StatusCode, Uri}; use rstest::rstest; use serde::de::DeserializeOwned; use serde::Serialize; +use starknet_infra_utils::test_utils::get_available_socket; use starknet_types_core::felt::Felt; use tokio::sync::mpsc::channel; use tokio::sync::Mutex; @@ -34,7 +35,6 @@ use crate::component_server::{ RemoteComponentServer, }; use crate::serde_utils::SerdeWrapper; -use crate::test_utils::get_available_socket; use crate::tests::{ test_a_b_functionality, ComponentA,