Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update commit hash for imported txn #536

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
548 changes: 280 additions & 268 deletions rust/Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ aptos-indexer-processor-sdk = { git = "https://github.com/aptos-labs/aptos-index
aptos-indexer-processor-sdk-server-framework = { git = "https://github.com/aptos-labs/aptos-indexer-processor-sdk.git", rev = "9ecd252ccff53023664562001dd04c2886488c0d" }
aptos-protos = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "5c48aee129b5a141be2792ffa3d9bd0a1a61c9cb" }
aptos-system-utils = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "202bdccff2b2d333a385ae86a4fcf23e89da9f62" }
aptos-indexer-test-transactions = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "82a8e2bfff1e822781462da83f3abd6cda3f44eb" }
aptos-indexer-test-transactions = { git = "https://github.com/aptos-labs/aptos-core.git", rev = "7246f0536d599789d7dd5e9fb776554abbe11eac" }
async-trait = "0.1.53"
backtrace = "0.3.58"
base64 = "0.13.0"
Expand Down
21 changes: 9 additions & 12 deletions rust/integration-tests/src/diff_tests/all_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ mod test {
ProcessorTestHelper,
},
diff_tests::{
get_expected_generated_txns, get_expected_imported_mainnet_txns,
get_expected_imported_testnet_txns, remove_inserted_at,
get_expected_imported_mainnet_txns, get_expected_imported_testnet_txns,
get_expected_scripted_txns, remove_inserted_at, remove_transaction_timestamp,
},
DiffTest, TestContext, TestProcessorConfig, TestType,
};
use aptos_indexer_test_transactions::{
ALL_GENERATED_TXNS, ALL_IMPORTED_MAINNET_TXNS, ALL_IMPORTED_TESTNET_TXNS,
ALL_IMPORTED_MAINNET_TXNS, ALL_IMPORTED_TESTNET_TXNS, ALL_SCRIPTED_TRANSACTIONS,
};
use assert_json_diff::assert_json_eq;
use diesel::pg::PgConnection;
Expand Down Expand Up @@ -52,16 +52,11 @@ mod test {
}

#[tokio::test]
async fn test_all_generated_txns_schema_output_for_all_processors() {
async fn test_all_scripted_txns_schema_output_for_all_processors() {
let processor_configs = get_processor_configs();
let test_context = TestContext::new(ALL_GENERATED_TXNS).await.unwrap();
let test_context = TestContext::new(ALL_SCRIPTED_TRANSACTIONS).await.unwrap();

run_processor_tests(
processor_configs,
&test_context,
get_expected_generated_txns,
)
.await;
run_processor_tests(processor_configs, &test_context, get_expected_scripted_txns).await;
}

// Helper function to reduce duplicate code for running tests on all processors
Expand Down Expand Up @@ -93,7 +88,7 @@ mod test {
};

let expected_json_path = get_expected_json_path_fn(processor_name, txn_version);
let expected_json = match read_and_parse_json(&expected_json_path) {
let mut expected_json = match read_and_parse_json(&expected_json_path) {
Ok(json) => json,
Err(e) => {
eprintln!(
Expand All @@ -106,6 +101,8 @@ mod test {

// TODO: we need to enhance json diff, as we might have more complex diffs.
remove_inserted_at(&mut json_data);
remove_transaction_timestamp(&mut json_data);
remove_transaction_timestamp(&mut expected_json);
assert_json_eq!(&json_data, &expected_json);

println!(
Expand Down
15 changes: 13 additions & 2 deletions rust/integration-tests/src/diff_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ pub fn remove_inserted_at(value: &mut Value) {
}
}

#[allow(dead_code)]
pub fn remove_transaction_timestamp(value: &mut Value) {
if let Some(array) = value.as_array_mut() {
for item in array.iter_mut() {
if let Some(obj) = item.as_object_mut() {
obj.remove("transaction_timestamp");
}
}
}
}

#[allow(dead_code)]
pub fn get_expected_imported_testnet_txns(processor_name: &str, txn_version: &str) -> String {
format!(
Expand All @@ -30,9 +41,9 @@ pub fn get_expected_imported_mainnet_txns(processor_name: &str, txn_version: &st
}

#[allow(dead_code)]
pub fn get_expected_generated_txns(processor_name: &str, txn_version: &str) -> String {
pub fn get_expected_scripted_txns(processor_name: &str, txn_version: &str) -> String {
format!(
"expected_db_output_files/generated_txns/{}/{}_{}.json",
"expected_db_output_files/scripted_txns/{}/{}_{}.json",
processor_name, processor_name, txn_version
)
}
Loading