@@ -1386,6 +1386,43 @@ def test_cloud_runner_run_missing_execution_arn(mock_boto3):
13861386 runner .run (input = "test-input" )
13871387
13881388
1389+ @patch ("aws_durable_execution_sdk_python_testing.runner.boto3" )
1390+ def test_cloud_runner_wait_for_completion_get_execution_resource_not_found_retries (
1391+ mock_boto3 ,
1392+ ):
1393+ """Test _wait_for_completion retries transient ResourceNotFoundException."""
1394+ from botocore .exceptions import ClientError # type: ignore
1395+
1396+ from aws_durable_execution_sdk_python_testing .runner import (
1397+ DurableFunctionCloudTestRunner ,
1398+ )
1399+
1400+ mock_client = Mock ()
1401+ mock_boto3 .client .return_value = mock_client
1402+ mock_client .get_durable_execution .side_effect = [
1403+ ClientError (
1404+ error_response = {"Error" : {"Code" : "ResourceNotFoundException" }},
1405+ operation_name = "GetDurableExecution" ,
1406+ ),
1407+ {
1408+ "DurableExecutionArn" : "arn:aws:lambda:us-east-1:123456789012:function:test:execution:exec-1" ,
1409+ "DurableExecutionName" : "test-execution" ,
1410+ "FunctionArn" : "arn:aws:lambda:us-east-1:123456789012:function:test" ,
1411+ "Status" : "SUCCEEDED" ,
1412+ "StartTimestamp" : "2023-01-01T00:00:00Z" ,
1413+ "EndTimestamp" : "2023-01-01T00:01:00Z" ,
1414+ },
1415+ ]
1416+
1417+ runner = DurableFunctionCloudTestRunner (
1418+ function_name = "test-function" , poll_interval = 0
1419+ )
1420+ result = runner ._wait_for_completion ("test-arn" , timeout = 10 )
1421+
1422+ assert result .status == "SUCCEEDED"
1423+ assert mock_client .get_durable_execution .call_count == 2
1424+
1425+
13891426@patch ("aws_durable_execution_sdk_python_testing.runner.boto3" )
13901427def test_cloud_runner_wait_for_completion_get_execution_failure (mock_boto3 ):
13911428 """Test DurableFunctionCloudTestRunner._wait_for_completion with API failure."""
0 commit comments