@@ -46,6 +46,26 @@ def _other_orchestrator(ctx: task.OrchestrationContext, _):
4646 return "other"
4747
4848
49+ # Dedicated helpers for no-filter tests to avoid emulator filter-cache
50+ # interference from prior tests that registered filters for the shared helpers.
51+ def _nf_plus_one (_ : task .ActivityContext , input : int ) -> int :
52+ return input + 1
53+
54+
55+ def _nf_orchestrator (ctx : task .OrchestrationContext , start_val : int ):
56+ result = yield ctx .call_activity (_nf_plus_one , input = start_val )
57+ return result
58+
59+
60+ def _cf_plus_one (_ : task .ActivityContext , input : int ) -> int :
61+ return input + 1
62+
63+
64+ def _cf_orchestrator (ctx : task .OrchestrationContext , start_val : int ):
65+ result = yield ctx .call_activity (_cf_plus_one , input = start_val )
66+ return result
67+
68+
4969# ------------------------------------------------------------------
5070# Tests: auto-generated filters
5171# ------------------------------------------------------------------
@@ -109,15 +129,16 @@ def test_explicit_filters_matching():
109129
110130def test_no_filters_processes_all ():
111131 """Without filters the worker processes all work items."""
132+ time .sleep (2 ) # Allow emulator filter cache to settle
112133 with DurableTaskSchedulerWorker (host_address = endpoint , secure_channel = True ,
113134 taskhub = taskhub_name , token_credential = None ) as w :
114- w .add_orchestrator (_orchestrator_with_activity )
115- w .add_activity (_plus_one )
135+ w .add_orchestrator (_nf_orchestrator )
136+ w .add_activity (_nf_plus_one )
116137 w .start ()
117138
118139 c = DurableTaskSchedulerClient (host_address = endpoint , secure_channel = True ,
119140 taskhub = taskhub_name , token_credential = None )
120- id = c .schedule_new_orchestration (_orchestrator_with_activity , input = 7 )
141+ id = c .schedule_new_orchestration (_nf_orchestrator , input = 7 )
121142 state = c .wait_for_orchestration_completion (id , timeout = 30 )
122143
123144 assert state is not None
@@ -131,17 +152,18 @@ def test_no_filters_processes_all():
131152
132153def test_cleared_filters_processes_all ():
133154 """Clearing filters with None restores process-all behavior."""
155+ time .sleep (2 ) # Allow emulator filter cache to settle
134156 with DurableTaskSchedulerWorker (host_address = endpoint , secure_channel = True ,
135157 taskhub = taskhub_name , token_credential = None ) as w :
136- w .add_orchestrator (_orchestrator_with_activity )
137- w .add_activity (_plus_one )
158+ w .add_orchestrator (_cf_orchestrator )
159+ w .add_activity (_cf_plus_one )
138160 w .use_work_item_filters ()
139161 w .use_work_item_filters (None )
140162 w .start ()
141163
142164 c = DurableTaskSchedulerClient (host_address = endpoint , secure_channel = True ,
143165 taskhub = taskhub_name , token_credential = None )
144- id = c .schedule_new_orchestration (_orchestrator_with_activity , input = 3 )
166+ id = c .schedule_new_orchestration (_cf_orchestrator , input = 3 )
145167 state = c .wait_for_orchestration_completion (id , timeout = 30 )
146168
147169 assert state is not None
0 commit comments