Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/aws_durable_execution_sdk_python_testing/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def stop_execution(
error: Optional error to use when stopping the execution

Returns:
StopDurableExecutionResponse: Response containing stop date
StopDurableExecutionResponse: Response containing end timestamp

Raises:
ResourceNotFoundException: If execution does not exist
Expand All @@ -333,7 +333,7 @@ def stop_execution(
# Stop the execution
self.fail_execution(execution_arn, stop_error)

return StopDurableExecutionResponse(stop_date=datetime.now(UTC).timestamp())
return StopDurableExecutionResponse(end_timestamp=datetime.now(UTC).timestamp())

def get_execution_state(
self,
Expand Down
6 changes: 3 additions & 3 deletions src/aws_durable_execution_sdk_python_testing/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,14 @@ def to_dict(self) -> dict[str, Any]:
class StopDurableExecutionResponse:
"""Response from stopping a durable execution."""

stop_date: float
end_timestamp: float

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

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


@dataclass(frozen=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/executor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1860,7 +1860,7 @@ def test_stop_execution(executor, mock_store):

mock_store.load.assert_called_once_with("test-arn")
mock_fail.assert_called_once()
assert result.stop_date is not None
assert result.end_timestamp is not None


def test_stop_execution_already_complete(executor, mock_store):
Expand Down
8 changes: 4 additions & 4 deletions tests/model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ def test_durable_execution_summary_serialization():
assert round_trip == summary_obj


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

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

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

result_data = response_obj.to_dict()
assert result_data == data
Expand Down
4 changes: 2 additions & 2 deletions tests/web/handlers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ def test_stop_durable_execution_handler_success():
handler = StopDurableExecutionHandler(executor)

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

# Create request with proper stop data
Expand Down Expand Up @@ -900,7 +900,7 @@ def test_stop_durable_execution_handler_success():

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

# Verify executor was called with correct parameters
executor.stop_execution.assert_called_once()
Expand Down
Loading