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 9ddece74a9..bf100a90e7 100644 --- a/crates/starknet_integration_tests/src/end_to_end_integration.rs +++ b/crates/starknet_integration_tests/src/end_to_end_integration.rs @@ -12,11 +12,9 @@ use starknet_types_core::felt::Felt; use tracing::info; use crate::integration_test_setup::IntegrationTestSetup; +use crate::test_identifiers::TestIdentifier; use crate::utils::send_account_txs; -// TODO(Tsabary): create an enum that maps test names to unique indices, replace constants. -const END_TO_END_INTEGRATION_TEST_UNIQUE_ID: u16 = 0; - /// Reads the latest block number from the storage. fn get_latest_block_number(storage_reader: &StorageReader) -> BlockNumber { let txn = storage_reader.begin_ro_txn().unwrap(); @@ -67,7 +65,7 @@ pub async fn end_to_end_integration(mut tx_generator: MultiAccountTransactionGen // Creating the storage for the test. let integration_test_setup = IntegrationTestSetup::new_from_tx_generator( &tx_generator, - END_TO_END_INTEGRATION_TEST_UNIQUE_ID, + TestIdentifier::EndToEndIntegrationTest.into(), ) .await; diff --git a/crates/starknet_integration_tests/src/lib.rs b/crates/starknet_integration_tests/src/lib.rs index d2555c76bd..051acd4df2 100644 --- a/crates/starknet_integration_tests/src/lib.rs +++ b/crates/starknet_integration_tests/src/lib.rs @@ -3,4 +3,5 @@ pub mod end_to_end_integration; pub mod flow_test_setup; pub mod integration_test_setup; pub mod state_reader; +pub mod test_identifiers; pub mod utils; diff --git a/crates/starknet_integration_tests/src/test_identifiers.rs b/crates/starknet_integration_tests/src/test_identifiers.rs new file mode 100644 index 0000000000..b448e34806 --- /dev/null +++ b/crates/starknet_integration_tests/src/test_identifiers.rs @@ -0,0 +1,14 @@ +#[derive(Debug)] +pub enum TestIdentifier { + EndToEndIntegrationTest, + EndToEndFlowTest, +} + +impl From for u16 { + fn from(variant: TestIdentifier) -> Self { + match variant { + TestIdentifier::EndToEndIntegrationTest => 0, + TestIdentifier::EndToEndFlowTest => 1, + } + } +} diff --git a/crates/starknet_integration_tests/tests/end_to_end_flow_test.rs b/crates/starknet_integration_tests/tests/end_to_end_flow_test.rs index 782cbb6d8f..5c8d13c08d 100644 --- a/crates/starknet_integration_tests/tests/end_to_end_flow_test.rs +++ b/crates/starknet_integration_tests/tests/end_to_end_flow_test.rs @@ -17,6 +17,7 @@ use rstest::{fixture, rstest}; use starknet_api::block::{BlockHash, BlockNumber}; use starknet_api::transaction::TransactionHash; use starknet_integration_tests::flow_test_setup::{FlowTestSetup, SequencerSetup}; +use starknet_integration_tests::test_identifiers::TestIdentifier; use starknet_integration_tests::utils::{ create_integration_test_tx_generator, run_integration_test_scenario, @@ -28,9 +29,6 @@ use tracing::debug; const INITIAL_HEIGHT: BlockNumber = BlockNumber(0); const LAST_HEIGHT: BlockNumber = BlockNumber(2); -// TODO(Tsabary): create an enum that maps test names to unique indices, replace constants. -const END_TO_END_FLOW_TEST_UNIQUE_ID: u16 = 1; - #[fixture] fn tx_generator() -> MultiAccountTransactionGenerator { create_integration_test_tx_generator() @@ -44,8 +42,11 @@ async fn end_to_end_flow(mut tx_generator: MultiAccountTransactionGenerator) { const LISTEN_TO_BROADCAST_MESSAGES_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(50); // Setup. - let mut mock_running_system = - FlowTestSetup::new_from_tx_generator(&tx_generator, END_TO_END_FLOW_TEST_UNIQUE_ID).await; + let mut mock_running_system = FlowTestSetup::new_from_tx_generator( + &tx_generator, + TestIdentifier::EndToEndFlowTest.into(), + ) + .await; tokio::join!( wait_for_sequencer_node(&mock_running_system.sequencer_0),