Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rtso committed Jan 31, 2025
1 parent 31b0e55 commit 0d84a54
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
6 changes: 3 additions & 3 deletions rust/Cargo.lock

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

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ anyhow = "1.0.86"
aptos-indexer-processor-sdk = { git = "https://github.com/aptos-labs/aptos-indexer-processor-sdk.git", rev = "b79ed8b5864b2a12a1f9c5fd01579462e029b2ae" }
aptos-indexer-processor-sdk-server-framework = { git = "https://github.com/aptos-labs/aptos-indexer-processor-sdk.git", rev = "b79ed8b5864b2a12a1f9c5fd01579462e029b2ae" }
aptos-protos = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "1d8460a995503574ec4e9699d3442d0150d7f3b9" }
aptos-indexer-test-transactions = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "63eb8945a86521bc0fb0e26b306693e11327c85d" }
aptos-indexer-test-transactions = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "d949a8fb6fe64e5da8f672be52a148f105bbe0cf" }
aptos-indexer-testing-framework = { git = "https://github.com/aptos-labs/aptos-indexer-processor-sdk.git", rev = "b79ed8b5864b2a12a1f9c5fd01579462e029b2ae" }
async-trait = "0.1.53"
backtrace = "0.3.58"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
18 changes: 18 additions & 0 deletions rust/integration-tests/src/sdk_tests/events_processor_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ mod tests {
IMPORTED_DEVNET_TXNS_78753811_COIN_TRANSFER_WITH_V2_EVENTS,
IMPORTED_DEVNET_TXNS_78753831_TOKEN_V1_MINT_TRANSFER_WITH_V2_EVENTS,
IMPORTED_DEVNET_TXNS_78753832_TOKEN_V2_MINT_TRANSFER_WITH_V2_EVENTS,
IMPORTED_MAINNET_TXNS_554229017_EVENTS_WITH_NO_EVENT_SIZE_INFO,
IMPORTED_TESTNET_TXNS_1255836496_V2_FA_METADATA_, IMPORTED_TESTNET_TXNS_1_GENESIS,
IMPORTED_TESTNET_TXNS_278556781_V1_COIN_REGISTER_FA_METADATA,
IMPORTED_TESTNET_TXNS_2_NEW_BLOCK_EVENT, IMPORTED_TESTNET_TXNS_3_EMPTY_TXN,
Expand Down Expand Up @@ -151,6 +152,19 @@ mod tests {
.await;
}

// This is a test for the validator txn with missing events
// This happens because we did not fully backfill validator txn events
// so GRPC can return a txn with event size info but no events
// We expect no events parsed
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn mainnet_events_processor_validator_txn_missing_events() {
process_single_mainnet_event_txn(
IMPORTED_MAINNET_TXNS_554229017_EVENTS_WITH_NO_EVENT_SIZE_INFO, // this is misnamed, but it's the validatortxn with missing events
Some("validator_txn_missing_events".to_string()),
)
.await;
}

// Example 2: Test for multiple transactions handling
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn testnet_events_processor_db_output_scenario_testing() {
Expand Down Expand Up @@ -218,6 +232,10 @@ mod tests {
process_single_event_txn(txn, test_case_name, "imported_testnet_txns").await
}

async fn process_single_mainnet_event_txn(txn: &[u8], test_case_name: Option<String>) {
process_single_event_txn(txn, test_case_name, "imported_mainnet_txns").await
}

// Helper function to abstract out the single transaction processing
async fn process_single_event_txn(
txn: &[u8],
Expand Down

0 comments on commit 0d84a54

Please sign in to comment.