Skip to content

Commit 81d5a16

Browse files
committed
fix: update model for StopDurableExecution
1 parent 3b1ad24 commit 81d5a16

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

src/aws_durable_execution_sdk_python_testing/executor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ def stop_execution(
312312
error: Optional error to use when stopping the execution
313313
314314
Returns:
315-
StopDurableExecutionResponse: Response containing stop date
315+
StopDurableExecutionResponse: Response containing end timestamp
316316
317317
Raises:
318318
ResourceNotFoundException: If execution does not exist
@@ -333,7 +333,7 @@ def stop_execution(
333333
# Stop the execution
334334
self.fail_execution(execution_arn, stop_error)
335335

336-
return StopDurableExecutionResponse(stop_date=datetime.now(UTC).timestamp())
336+
return StopDurableExecutionResponse(end_timestamp=datetime.now(UTC).timestamp())
337337

338338
def get_execution_state(
339339
self,

src/aws_durable_execution_sdk_python_testing/model.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,14 @@ def to_dict(self) -> dict[str, Any]:
325325
class StopDurableExecutionResponse:
326326
"""Response from stopping a durable execution."""
327327

328-
stop_date: float
328+
end_timestamp: float
329329

330330
@classmethod
331331
def from_dict(cls, data: dict) -> StopDurableExecutionResponse:
332-
return cls(stop_date=data["StopDate"])
332+
return cls(end_timestamp=data["EndTimestamp"])
333333

334334
def to_dict(self) -> dict[str, Any]:
335-
return {"StopDate": self.stop_date}
335+
return {"EndTimestamp": self.end_timestamp}
336336

337337

338338
@dataclass(frozen=True)

tests/executor_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,7 @@ def test_stop_execution(executor, mock_store):
18601860

18611861
mock_store.load.assert_called_once_with("test-arn")
18621862
mock_fail.assert_called_once()
1863-
assert result.stop_date is not None
1863+
assert result.end_timestamp is not None
18641864

18651865

18661866
def test_stop_execution_already_complete(executor, mock_store):

tests/model_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ def test_durable_execution_summary_serialization():
317317
assert round_trip == summary_obj
318318

319319

320-
def test_durable_execution_summary_no_stop_date():
321-
"""Test Execution without stop date."""
320+
def test_durable_execution_summary_no_end_timestamp():
321+
"""Test Execution without end timestamp."""
322322
data = {
323323
"DurableExecutionArn": "arn:aws:lambda:us-east-1:123456789012:function:my-function:execution:test",
324324
"DurableExecutionName": "test-execution",
@@ -421,10 +421,10 @@ def test_stop_durable_execution_request_minimal():
421421

422422
def test_stop_durable_execution_response_serialization():
423423
"""Test StopDurableExecutionResponse from_dict/to_dict round-trip."""
424-
data = {"StopDate": "2023-01-01T00:01:00Z"}
424+
data = {"EndTimestamp": "2023-01-01T00:01:00Z"}
425425

426426
response_obj = StopDurableExecutionResponse.from_dict(data)
427-
assert response_obj.stop_date == "2023-01-01T00:01:00Z"
427+
assert response_obj.end_timestamp == "2023-01-01T00:01:00Z"
428428

429429
result_data = response_obj.to_dict()
430430
assert result_data == data

tests/web/handlers_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ def test_stop_durable_execution_handler_success():
870870
handler = StopDurableExecutionHandler(executor)
871871

872872
# Mock the executor response
873-
mock_response = StopDurableExecutionResponse(stop_date="2023-01-01T00:01:00Z")
873+
mock_response = StopDurableExecutionResponse(end_timestamp="2023-01-01T00:01:00Z")
874874
executor.stop_execution.return_value = mock_response
875875

876876
# Create request with proper stop data
@@ -900,7 +900,7 @@ def test_stop_durable_execution_handler_success():
900900

901901
# Verify response
902902
assert response.status_code == 200
903-
assert response.body == {"StopDate": "2023-01-01T00:01:00Z"}
903+
assert response.body == {"EndTimestamp": "2023-01-01T00:01:00Z"}
904904

905905
# Verify executor was called with correct parameters
906906
executor.stop_execution.assert_called_once()

0 commit comments

Comments
 (0)