From cd83ef2b5745b445e8f39b0fd69cd5bab5f41dae Mon Sep 17 00:00:00 2001 From: Moncef AOUDIA Date: Tue, 17 Oct 2023 18:23:55 +0200 Subject: [PATCH] refactor: enhanced async pool test --- massa-grpc/src/tests/stream.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/massa-grpc/src/tests/stream.rs b/massa-grpc/src/tests/stream.rs index 47f09463bc..ef63d76a23 100644 --- a/massa-grpc/src/tests/stream.rs +++ b/massa-grpc/src/tests/stream.rs @@ -1210,12 +1210,21 @@ async fn new_slot_execution_outputs() { }; filters.push(filter); // async pool changes filter + let can_be_executed = match async_pool_changes.0.iter().next().unwrap().1 { + massa_ledger_exports::SetUpdateOrDelete::Set(value) => Some(value.can_be_executed), + massa_ledger_exports::SetUpdateOrDelete::Update(value) => match value.can_be_executed { + massa_ledger_exports::SetOrKeep::Set(value) => Some(value), + massa_ledger_exports::SetOrKeep::Keep => None, + }, + massa_ledger_exports::SetUpdateOrDelete::Delete => None, + }; + filter = grpc_api::NewSlotExecutionOutputsFilter { filter: Some( grpc_api::new_slot_execution_outputs_filter::Filter::AsyncPoolChangesFilter( grpc_api::AsyncPoolChangesFilter { - filter: Some(grpc_api::async_pool_changes_filter::Filter::None( - grpc_model::Empty {}, + filter: Some(grpc_api::async_pool_changes_filter::Filter::CanBeExecuted( + can_be_executed.unwrap(), )), }, ), @@ -1291,7 +1300,7 @@ async fn new_slot_execution_outputs() { .unwrap() .state_changes .unwrap(); - assert!(state_changes.async_pool_changes.is_empty()); + assert!(state_changes.async_pool_changes.len() == 2); assert!(state_changes.executed_ops_changes.len() == 1); assert!(state_changes.executed_denunciations_changes.is_empty()); assert!(state_changes.ledger_changes.is_empty());