Skip to content

Commit

Permalink
Fix (e2e-test): Fix full_node_tests (#3798)
Browse files Browse the repository at this point in the history
* Fix (test): Remove depreciated InputObject and ChangedObject filters

* fix(iota-e2e-tests): make test_full_node_event_read_api_ok assert stronger

---------

Co-authored-by: miker83z <[email protected]>
Co-authored-by: Mirko Zichichi <[email protected]>
  • Loading branch information
3 people authored Oct 31, 2024
1 parent ab851b5 commit 37a6009
Showing 1 changed file with 9 additions and 36 deletions.
45 changes: 9 additions & 36 deletions crates/iota-e2e-tests/tests/full_node_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,32 +271,7 @@ async fn test_full_node_indexes() -> Result<(), anyhow::Error> {
let node = &test_cluster.fullnode_handle.iota_node;
let context = &mut test_cluster.wallet;

let (transferred_object, sender, receiver, digest, _) = transfer_coin(context).await?;

let txes = node
.state()
.get_transactions_for_tests(
Some(TransactionFilter::InputObject(transferred_object)),
None,
None,
false,
)
.await?;

assert_eq!(txes.len(), 1);
assert_eq!(txes[0], digest);

let txes = node
.state()
.get_transactions_for_tests(
Some(TransactionFilter::ChangedObject(transferred_object)),
None,
None,
false,
)
.await?;
assert_eq!(txes.len(), 2);
assert_eq!(txes[1], digest);
let (_, sender, receiver, digest, _) = transfer_coin(context).await?;

let txes = node
.state()
Expand Down Expand Up @@ -641,28 +616,26 @@ async fn test_full_node_event_read_api_ok() {
let node = &test_cluster.fullnode_handle.iota_node;
let jsonrpc_client = &test_cluster.fullnode_handle.rpc_client;

let (package_id, gas_id_1, _) = publish_nfts_package(context).await;
let (package_id, _, publish_digest) = publish_nfts_package(context).await;

let (transferred_object, _, _, digest, _) = transfer_coin(context).await.unwrap();
let (_, sender, _, transfer_digest, _) = transfer_coin(context).await.unwrap();

let txes = node
.state()
.get_transactions_for_tests(
Some(TransactionFilter::InputObject(transferred_object)),
Some(TransactionFilter::FromAddress(sender)),
None,
None,
false,
)
.await
.unwrap();

if gas_id_1 == transferred_object {
assert_eq!(txes.len(), 2);
assert!(txes[0] == digest || txes[1] == digest);
} else {
assert_eq!(txes.len(), 1);
assert_eq!(txes[0], digest);
}
assert_eq!(txes.len(), 2);
assert!(
(txes[0] == publish_digest && txes[1] == transfer_digest)
|| (txes[0] == transfer_digest && txes[1] == publish_digest)
);

// This is a poor substitute for the post processing taking some time
sleep(Duration::from_millis(1000)).await;
Expand Down

0 comments on commit 37a6009

Please sign in to comment.