Skip to content

Commit 21f5bc6

Browse files
authored
test: verify completion index transitions
Assert sibling retention and empty-parent pruning before invocation finalization can mask either broken transition. Verify child spans before cleanup and preserve the final no-duplicate assertions.
1 parent 8fde831 commit 21f5bc6

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

‎packages/aws-durable-execution-sdk-python-otel/tests/test_completion_snapshots.py‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,16 @@ def test_natural_child_end_preserves_other_pending_children(
282282
assert [
283283
span.name for span in exporter.get_finished_spans() if span.name in updates
284284
] == ["first"]
285+
# Check the index before invocation finalization can recover the sibling
286+
# from pending or clear an incorrectly retained empty parent entry.
287+
assert plugin._completions.pending == {"second": updates["second"]}
288+
assert plugin._completions.children_by_parent == {"parent": {"second": None}}
289+
plugin.on_operation_end(updates["second"])
290+
assert plugin._completions.pending == {}
291+
assert plugin._completions.children_by_parent == {}
292+
children = [span for span in exporter.get_finished_spans() if span.name in updates]
293+
assert [span.name for span in children] == ["first", "second"]
294+
assert all(span.parent == parent_context for span in children)
285295
plugin.on_user_function_end(UserFunctionEndInfo.from_start_info(start, None))
286296
plugin.on_operation_end(
287297
OperationEndInfo(

0 commit comments

Comments
 (0)