Skip to content

Commit 30d3f27

Browse files
committed
Isolate no-filter test funcs
1 parent d8154ef commit 30d3f27

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

tests/durabletask-azuremanaged/test_dts_work_item_filters_e2e.py

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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

110130
def 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

132153
def 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

Comments
 (0)