Skip to content

Commit 6f5e776

Browse files
Alex Wangwangyb-A
authored andcommitted
fix(testing-sdk): remove duplicate store update, use invoke
- remove duplicate store update when validating invocation response - use client.invoke instead of invoke20150331
1 parent afb374e commit 6f5e776

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/aws_durable_execution_sdk_python_testing/executor.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,6 @@ def _validate_invocation_response_and_store(
602602
self._complete_workflow(
603603
execution_arn, result=None, error=response.error
604604
)
605-
self._store.save(execution)
606605

607606
case InvocationStatus.SUCCEEDED:
608607
if response.error is not None:
@@ -614,7 +613,6 @@ def _validate_invocation_response_and_store(
614613
self._complete_workflow(
615614
execution_arn, result=response.result, error=None
616615
)
617-
self._store.save(execution)
618616

619617
case InvocationStatus.PENDING:
620618
if not execution.has_pending_operations(execution):

src/aws_durable_execution_sdk_python_testing/invoker.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,8 @@ def invoke(
143143
function_name: str,
144144
input: DurableExecutionInvocationInput,
145145
) -> DurableExecutionInvocationOutput:
146-
# TODO: temporary method name pre-build - switch to `invoke` for final
147146
# TODO: wrap ResourceNotFoundException from lambda in ResourceNotFoundException from this lib
148-
response = self.lambda_client.invoke20150331(
147+
response = self.lambda_client.invoke(
149148
FunctionName=function_name,
150149
InvocationType="RequestResponse", # Synchronous invocation
151150
Payload=json.dumps(input.to_dict(), default=str),

tests/invoker_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def test_lambda_invoker_invoke_success():
162162
{"Status": "SUCCEEDED", "Result": "lambda-result"}
163163
).encode("utf-8")
164164

165-
lambda_client.invoke20150331.return_value = {
165+
lambda_client.invoke.return_value = {
166166
"StatusCode": 200,
167167
"Payload": mock_payload,
168168
}
@@ -183,7 +183,7 @@ def test_lambda_invoker_invoke_success():
183183
assert result.result == "lambda-result"
184184

185185
# Verify lambda client was called correctly
186-
lambda_client.invoke20150331.assert_called_once_with(
186+
lambda_client.invoke.assert_called_once_with(
187187
FunctionName="test-function",
188188
InvocationType="RequestResponse",
189189
Payload=json.dumps(input_data.to_dict(), default=str),
@@ -196,7 +196,7 @@ def test_lambda_invoker_invoke_failure():
196196

197197
# Mock failed response
198198
mock_payload = Mock()
199-
lambda_client.invoke20150331.return_value = {
199+
lambda_client.invoke.return_value = {
200200
"StatusCode": 500,
201201
"Payload": mock_payload,
202202
}

0 commit comments

Comments
 (0)