Skip to content

Commit c80452b

Browse files
committed
Failing test: execute activity and child workflow concurrently to catch bug
1 parent 0b90258 commit c80452b

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

tests/test_serialization_context.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1576,16 +1576,25 @@ async def run(self, data: str) -> str:
15761576
await workflow.wait_condition(
15771577
lambda: (self.received_signal and self.received_update)
15781578
)
1579-
assert "inbound" == await workflow.execute_activity(
1580-
payload_encryption_activity,
1581-
"outbound",
1582-
start_to_close_timeout=timedelta(seconds=10),
1583-
)
1584-
assert "inbound" == await workflow.execute_child_workflow(
1585-
PayloadEncryptionChildWorkflow.run,
1586-
"outbound",
1587-
id=f"{workflow.info().workflow_id}_child",
1579+
# Run them in parallel to check that data converter operations do not mix up contexts when
1580+
# there are multiple concurrent payload types.
1581+
coros = [
1582+
workflow.execute_activity(
1583+
payload_encryption_activity,
1584+
"outbound",
1585+
start_to_close_timeout=timedelta(seconds=10),
1586+
),
1587+
workflow.execute_child_workflow(
1588+
PayloadEncryptionChildWorkflow.run,
1589+
"outbound",
1590+
id=f"{workflow.info().workflow_id}_child",
1591+
),
1592+
]
1593+
[act_result, cw_result], _ = await workflow.wait(
1594+
[asyncio.create_task(c) for c in coros]
15881595
)
1596+
assert await act_result == "inbound"
1597+
assert await cw_result == "inbound"
15891598
return "outbound"
15901599

15911600
@workflow.query

0 commit comments

Comments
 (0)