@@ -689,6 +689,7 @@ impl<C: ClockFn + 'static, S: Sleep + 'static> Worker for WorkflowWorker<C, S> {
689689#[ cfg( test) ]
690690pub ( crate ) mod tests {
691691 use super :: * ;
692+ use crate :: activity:: activity_worker:: tests:: compile_activity_stub;
692693 use crate :: {
693694 activity:: activity_worker:: tests:: {
694695 FIBO_10_INPUT , FIBO_10_OUTPUT , compile_activity, spawn_activity_fibo, wasm_file_name,
@@ -1772,8 +1773,6 @@ pub(crate) mod tests {
17721773 async fn stub (
17731774 #[ values( db_tests:: Database :: Memory , db_tests:: Database :: Sqlite ) ] db : db_tests:: Database ,
17741775 ) {
1775- use crate :: activity:: activity_worker:: tests:: compile_activity_stub;
1776-
17771776 const FFQN_WORKFLOW_STUB : FunctionFqn = FunctionFqn :: new_static_tuple (
17781777 test_programs_stub_workflow_builder:: exports:: testing:: stub_workflow:: workflow:: SUBMIT_STUB_AWAIT ,
17791778 ) ;
@@ -1997,4 +1996,83 @@ pub(crate) mod tests {
19971996 drop ( exec_task) ;
19981997 db_pool. close ( ) . await . unwrap ( ) ;
19991998 }
1999+
2000+ #[ rstest:: rstest]
2001+ #[ tokio:: test]
2002+ async fn await_next_produces_all_processed_error (
2003+ #[ values( db_tests:: Database :: Memory , db_tests:: Database :: Sqlite ) ] db : db_tests:: Database ,
2004+ ) {
2005+ const FFQN : FunctionFqn = FunctionFqn :: new_static_tuple (
2006+ test_programs_stub_workflow_builder:: exports:: testing:: stub_workflow:: workflow:: AWAIT_NEXT_PRODUCES_ALL_PROCESSED_ERROR
2007+ ) ;
2008+ test_utils:: set_up ( ) ;
2009+ let sim_clock = SimClock :: epoch ( ) ;
2010+ let ( _guard, db_pool) = db. set_up ( ) . await ;
2011+ let fn_registry = TestingFnRegistry :: new_from_components ( vec ! [
2012+ compile_activity_stub( test_programs_stub_activity_builder:: TEST_PROGRAMS_STUB_ACTIVITY ) ,
2013+ compile_workflow( test_programs_stub_workflow_builder:: TEST_PROGRAMS_STUB_WORKFLOW ) ,
2014+ ] ) ;
2015+
2016+ let worker = compile_workflow_worker (
2017+ test_programs_stub_workflow_builder:: TEST_PROGRAMS_STUB_WORKFLOW ,
2018+ db_pool. clone ( ) ,
2019+ sim_clock. clone ( ) ,
2020+ TokioSleep ,
2021+ JoinNextBlockingStrategy :: Interrupt ,
2022+ & fn_registry,
2023+ ) ;
2024+ let exec_task = ExecTask :: new (
2025+ worker,
2026+ ExecConfig {
2027+ batch_size : 1 ,
2028+ lock_expiry : Duration :: from_secs ( 1 ) ,
2029+ tick_sleep : TICK_SLEEP ,
2030+ component_id : ComponentId :: dummy_workflow ( ) ,
2031+ task_limiter : None ,
2032+ executor_id : ExecutorId :: generate ( ) ,
2033+ } ,
2034+ sim_clock. clone ( ) ,
2035+ db_pool. clone ( ) ,
2036+ Arc :: new ( [ FFQN ] ) ,
2037+ ) ;
2038+
2039+ let execution_id = ExecutionId :: generate ( ) ;
2040+ let db_connection = db_pool. connection ( ) ;
2041+ db_connection
2042+ . create ( CreateRequest {
2043+ created_at : sim_clock. now ( ) ,
2044+ execution_id : execution_id. clone ( ) ,
2045+ ffqn : FFQN ,
2046+ params : Params :: empty ( ) ,
2047+ parent : None ,
2048+ metadata : concepts:: ExecutionMetadata :: empty ( ) ,
2049+ scheduled_at : sim_clock. now ( ) ,
2050+ retry_exp_backoff : Duration :: ZERO ,
2051+ max_retries : u32:: MAX ,
2052+ component_id : ComponentId :: dummy_workflow ( ) ,
2053+ scheduled_by : None ,
2054+ } )
2055+ . await
2056+ . unwrap ( ) ;
2057+
2058+ {
2059+ let task_count = exec_task
2060+ . tick_test ( sim_clock. now ( ) , RunId :: generate ( ) )
2061+ . await
2062+ . unwrap ( )
2063+ . wait_for_tasks ( )
2064+ . await
2065+ . unwrap ( ) ;
2066+ assert_eq ! ( 1 , task_count) ;
2067+ }
2068+
2069+ let res = db_connection. get ( & execution_id) . await . unwrap ( ) ;
2070+ assert_matches ! (
2071+ res. into_finished_result( ) . unwrap( ) . unwrap( ) ,
2072+ SupportedFunctionReturnValue :: None
2073+ ) ;
2074+
2075+ drop ( exec_task) ;
2076+ db_pool. close ( ) . await . unwrap ( ) ;
2077+ }
20002078}
0 commit comments