77)
88from cadence .error import EntityNotExistsError
99from tests .integration_tests .helper import CadenceHelper , DOMAIN_NAME
10- from cadence .api .v1 .service_workflow_pb2 import DescribeWorkflowExecutionRequest
10+ from cadence .api .v1 .service_workflow_pb2 import (
11+ DescribeWorkflowExecutionRequest ,
12+ GetWorkflowExecutionHistoryRequest ,
13+ )
1114from cadence .api .v1 .common_pb2 import WorkflowExecution
1215
1316
@@ -144,15 +147,15 @@ async def test_signal_workflow(helper: CadenceHelper):
144147 This integration test verifies:
145148 1. Starting a workflow execution
146149 2. Sending a signal to the running workflow
147- 3. Signal is accepted (no errors thrown)
150+ 3. Signal appears in the workflow's history
148151 """
149152 async with helper .client () as client :
150153 workflow_type = "test-workflow-signal"
151154 task_list_name = "test-task-list-signal"
152155 workflow_id = "test-workflow-signal-789"
153156 execution_timeout = timedelta (minutes = 5 )
154157 signal_name = "test-signal"
155- signal_input = {"action" : "update" , "value" : 42 }
158+ signal_arg = {"action" : "update" , "value" : 42 }
156159
157160 execution = await client .start_workflow (
158161 workflow_type ,
@@ -162,25 +165,31 @@ async def test_signal_workflow(helper: CadenceHelper):
162165 )
163166
164167 await client .signal_workflow (
165- workflow_id = execution .workflow_id ,
166- run_id = execution .run_id ,
167- signal_name = signal_name ,
168- signal_input = signal_input ,
169- )
170-
171- describe_request = DescribeWorkflowExecutionRequest (
172- domain = DOMAIN_NAME ,
173- workflow_execution = WorkflowExecution (
174- workflow_id = execution .workflow_id ,
175- run_id = execution .run_id ,
176- ),
168+ execution .workflow_id ,
169+ execution .run_id ,
170+ signal_name ,
171+ signal_arg ,
172+ )
173+
174+ # Fetch workflow history to verify signal was recorded
175+ history_response = await client .workflow_stub .GetWorkflowExecutionHistory (
176+ GetWorkflowExecutionHistoryRequest (
177+ domain = DOMAIN_NAME ,
178+ workflow_execution = execution ,
179+ skip_archival = True ,
180+ )
177181 )
178182
179- response = await client .workflow_stub .DescribeWorkflowExecution (
180- describe_request
181- )
183+ # Verify signal event appears in history
184+ signal_events = [
185+ event
186+ for event in history_response .history .events
187+ if event .HasField ("workflow_execution_signaled_event_attributes" )
188+ ]
182189
190+ assert len (signal_events ) == 1 , "Expected exactly one signal event in history"
191+ signal_event = signal_events [0 ]
183192 assert (
184- response . workflow_execution_info . workflow_execution . workflow_id
185- == workflow_id
186- )
193+ signal_event . workflow_execution_signaled_event_attributes . signal_name
194+ == signal_name
195+ ), f"Expected signal name ' { signal_name } '"
0 commit comments