Skip to content

Commit 4507f64

Browse files
committed
Remove duplicate test
1 parent 0ca7325 commit 4507f64

File tree

2 files changed

+0
-110
lines changed

2 files changed

+0
-110
lines changed

tests/durabletask-azuremanaged/test_dts_rewind_e2e.py

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -268,62 +268,6 @@ def parent_orchestrator(ctx: task.OrchestrationContext, input: str):
268268
assert child_call_count == 2
269269

270270

271-
def test_rewind_does_not_rerun_successful_activities():
272-
"""Successful activities must not be re-executed during rewind.
273-
274-
The orchestration calls two activities in sequence. The first
275-
succeeds and the second fails. After rewind, only the failed
276-
activity is retried; the successful activity's result is replayed
277-
from history and its body is never called again.
278-
"""
279-
success_call_count = 0
280-
fail_call_count = 0
281-
282-
def success_activity(_: task.ActivityContext, input: str) -> str:
283-
nonlocal success_call_count
284-
success_call_count += 1
285-
return f"ok:{input}"
286-
287-
def fail_activity(_: task.ActivityContext, input: str) -> str:
288-
nonlocal fail_call_count
289-
fail_call_count += 1
290-
if fail_call_count == 1:
291-
raise RuntimeError("Temporary failure")
292-
return f"recovered:{input}"
293-
294-
def orchestrator(ctx: task.OrchestrationContext, input: str):
295-
r1 = yield ctx.call_activity(success_activity, input=input)
296-
r2 = yield ctx.call_activity(fail_activity, input=input)
297-
return [r1, r2]
298-
299-
with DurableTaskSchedulerWorker(host_address=endpoint, secure_channel=True,
300-
taskhub=taskhub_name, token_credential=None) as w:
301-
w.add_orchestrator(orchestrator)
302-
w.add_activity(success_activity)
303-
w.add_activity(fail_activity)
304-
w.start()
305-
306-
c = DurableTaskSchedulerClient(host_address=endpoint, secure_channel=True,
307-
taskhub=taskhub_name, token_credential=None)
308-
instance_id = c.schedule_new_orchestration(orchestrator, input="v")
309-
state = c.wait_for_orchestration_completion(instance_id, timeout=30)
310-
311-
assert state is not None
312-
assert state.runtime_status == client.OrchestrationStatus.FAILED
313-
314-
# Rewind – only the failed activity should be retried.
315-
c.rewind_orchestration(instance_id, reason="retry")
316-
state = c.wait_for_orchestration_completion(instance_id, timeout=30)
317-
318-
assert state is not None
319-
assert state.runtime_status == client.OrchestrationStatus.COMPLETED
320-
assert state.serialized_output == json.dumps(["ok:v", "recovered:v"])
321-
# The successful activity must have been called exactly once.
322-
assert success_call_count == 1
323-
# The failing activity was called twice (once failed, once succeeded).
324-
assert fail_call_count == 2
325-
326-
327271
def test_rewind_without_reason():
328272
"""Rewind should work when no reason is provided."""
329273
call_count = 0

tests/durabletask/test_rewind_e2e.py

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -303,60 +303,6 @@ def parent_orchestrator(ctx: task.OrchestrationContext, input: str):
303303
assert child_call_count == 2
304304

305305

306-
def test_rewind_does_not_rerun_successful_activities():
307-
"""Successful activities must not be re-executed during rewind.
308-
309-
The orchestration calls two activities in sequence. The first
310-
succeeds and the second fails. After rewind, only the failed
311-
activity is retried; the successful activity's result is replayed
312-
from history and its body is never called again.
313-
"""
314-
success_call_count = 0
315-
fail_call_count = 0
316-
317-
def success_activity(_: task.ActivityContext, input: str) -> str:
318-
nonlocal success_call_count
319-
success_call_count += 1
320-
return f"ok:{input}"
321-
322-
def fail_activity(_: task.ActivityContext, input: str) -> str:
323-
nonlocal fail_call_count
324-
fail_call_count += 1
325-
if fail_call_count == 1:
326-
raise RuntimeError("Temporary failure")
327-
return f"recovered:{input}"
328-
329-
def orchestrator(ctx: task.OrchestrationContext, input: str):
330-
r1 = yield ctx.call_activity(success_activity, input=input)
331-
r2 = yield ctx.call_activity(fail_activity, input=input)
332-
return [r1, r2]
333-
334-
with worker.TaskHubGrpcWorker(host_address=HOST) as w:
335-
w.add_orchestrator(orchestrator)
336-
w.add_activity(success_activity)
337-
w.add_activity(fail_activity)
338-
w.start()
339-
340-
c = client.TaskHubGrpcClient(host_address=HOST)
341-
instance_id = c.schedule_new_orchestration(orchestrator, input="v")
342-
state = c.wait_for_orchestration_completion(instance_id, timeout=30)
343-
344-
assert state is not None
345-
assert state.runtime_status == client.OrchestrationStatus.FAILED
346-
347-
# Rewind – only the failed activity should be retried.
348-
c.rewind_orchestration(instance_id, reason="retry")
349-
state = c.wait_for_orchestration_completion(instance_id, timeout=30)
350-
351-
assert state is not None
352-
assert state.runtime_status == client.OrchestrationStatus.COMPLETED
353-
assert state.serialized_output == json.dumps(["ok:v", "recovered:v"])
354-
# The successful activity must have been called exactly once.
355-
assert success_call_count == 1
356-
# The failing activity was called twice (once failed, once succeeded).
357-
assert fail_call_count == 2
358-
359-
360306
def test_rewind_twice():
361307
"""Rewind the same orchestration twice after it fails a second time.
362308

0 commit comments

Comments
 (0)