Skip to content

Commit 1a467e7

Browse files
committed
chore: remove DEX specific env vars and update local runner env vars
1 parent c1bc794 commit 1a467e7

File tree

3 files changed

+7
-71
lines changed

3 files changed

+7
-71
lines changed

src/aws_durable_execution_sdk_python/lambda_service.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,9 @@ def load_preview_botocore_models() -> None:
839839
@staticmethod
840840
def initialize_local_runner_client() -> LambdaClient:
841841
endpoint = os.getenv(
842-
"LOCAL_RUNNER_ENDPOINT", "http://host.docker.internal:5000"
842+
"DURABLE_LOCAL_RUNNER_ENDPOINT", "http://host.docker.internal:5000"
843843
)
844-
region = os.getenv("LOCAL_RUNNER_REGION", "us-west-2")
844+
region = os.getenv("DURABLE_LOCAL_RUNNER_REGION", "us-west-2")
845845

846846
# The local runner client needs execute-api as the signing service name,
847847
# so we have a second `lambdainternal-local` boto model with this.
@@ -860,29 +860,17 @@ def initialize_local_runner_client() -> LambdaClient:
860860
return LambdaClient(client=client)
861861

862862
@staticmethod
863-
def initialize_from_endpoint_and_region(endpoint: str, region: str) -> LambdaClient:
863+
def initialize_from_env() -> LambdaClient:
864864
LambdaClient.load_preview_botocore_models()
865865
client = boto3.client(
866866
"lambdainternal",
867-
endpoint_url=endpoint,
868-
region_name=region,
869867
)
870868

871869
logger.debug(
872-
"Initialized lambda client with endpoint: '%s', region: '%s'",
873-
endpoint,
874-
region,
870+
"Initialized lambda client"
875871
)
876872
return LambdaClient(client=client)
877873

878-
@staticmethod
879-
def initialize_from_env() -> LambdaClient:
880-
return LambdaClient.initialize_from_endpoint_and_region(
881-
# it'll prob end up being https://lambda.us-east-1.amazonaws.com or similar
882-
endpoint=os.getenv("DEX_ENDPOINT", "http://host.docker.internal:5000"),
883-
region=os.getenv("DEX_REGION", "us-east-1"),
884-
)
885-
886874
def checkpoint(
887875
self,
888876
durable_execution_arn: str,

tests/e2e/execution_int_test.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -392,14 +392,3 @@ def mock_checkpoint(
392392
assert checkpoint.action is OperationAction.START
393393
assert checkpoint.operation_id == "1"
394394
assert checkpoint.wait_options.seconds == 1
395-
396-
397-
def test_lambda_client_initialization():
398-
"""Test initialization of real Lambda client with specified endpoint and region."""
399-
endpoint = "https://durable.durable-functions.devo.us-west-2.lambda.aws.a2z.com"
400-
region = "us-west-2"
401-
402-
client = LambdaClient.initialize_from_endpoint_and_region(endpoint, region)
403-
404-
assert client is not None
405-
assert client.client is not None

tests/lambda_service_test.py

Lines changed: 3 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -770,26 +770,9 @@ def test_state_output_from_dict_empty_operations():
770770
assert len(output.operations) == 0
771771
assert output.next_marker == "marker123"
772772

773-
774-
@patch("aws_durable_execution_sdk_python.lambda_service.boto3")
775-
def test_lambda_client_initialize_from_endpoint_and_region(mock_boto3):
776-
"""Test LambdaClient.initialize_from_endpoint_and_region method."""
777-
mock_client = Mock()
778-
mock_boto3.client.return_value = mock_client
779-
780-
lambda_client = LambdaClient.initialize_from_endpoint_and_region(
781-
"https://test.com", "us-east-1"
782-
)
783-
784-
mock_boto3.client.assert_called_once_with(
785-
"lambdainternal", endpoint_url="https://test.com", region_name="us-east-1"
786-
)
787-
assert lambda_client.client == mock_client
788-
789-
790773
@patch.dict(
791774
"os.environ",
792-
{"LOCAL_RUNNER_ENDPOINT": "http://test:5000", "LOCAL_RUNNER_REGION": "us-west-1"},
775+
{"DURABLE_LOCAL_RUNNER_ENDPOINT": "http://test:5000", "DURABLE_LOCAL_RUNNER_REGION": "us-west-1"},
793776
)
794777
@patch("aws_durable_execution_sdk_python.lambda_service.boto3")
795778
def test_lambda_client_initialize_local_runner_client(mock_boto3):
@@ -805,20 +788,6 @@ def test_lambda_client_initialize_local_runner_client(mock_boto3):
805788
assert lambda_client.client == mock_client
806789

807790

808-
@patch.dict(
809-
"os.environ", {"DEX_ENDPOINT": "https://lambda.test.com", "DEX_REGION": "eu-west-1"}
810-
)
811-
@patch(
812-
"aws_durable_execution_sdk_python.lambda_service.LambdaClient.initialize_from_endpoint_and_region"
813-
)
814-
def test_lambda_client_initialize_from_env(mock_init):
815-
"""Test LambdaClient.initialize_from_env method."""
816-
LambdaClient.initialize_from_env()
817-
mock_init.assert_called_once_with(
818-
endpoint="https://lambda.test.com", region="eu-west-1"
819-
)
820-
821-
822791
def test_lambda_client_checkpoint():
823792
"""Test LambdaClient.checkpoint method."""
824793
mock_client = Mock()
@@ -1005,14 +974,6 @@ def test_lambda_client_stop():
1005974
assert result == "2023-01-01T00:00:00Z"
1006975

1007976

1008-
@pytest.mark.skip(reason="little informal integration test for interactive running.")
1009-
def test_lambda_client_with_env_defaults():
1010-
client = LambdaClient.initialize_from_endpoint_and_region(
1011-
"http://127.0.0.1:5000", "us-east-1"
1012-
)
1013-
client.get_execution_state("9692ca80-399d-4f52-8d0a-41acc9cd0492", next_marker="")
1014-
1015-
1016977
def test_durable_service_client_protocol_checkpoint():
1017978
"""Test DurableServiceClient protocol checkpoint method signature."""
1018979
mock_client = Mock(spec=DurableServiceClient)
@@ -1526,11 +1487,9 @@ def test_lambda_client_initialize_local_runner_client_defaults(mock_boto3):
15261487

15271488
@patch.dict("os.environ", {}, clear=True)
15281489
@patch(
1529-
"aws_durable_execution_sdk_python.lambda_service.LambdaClient.initialize_from_endpoint_and_region"
1490+
"aws_durable_execution_sdk_python.lambda_service.LambdaClient.initialize_from_env"
15301491
)
15311492
def test_lambda_client_initialize_from_env_defaults(mock_init):
15321493
"""Test LambdaClient.initialize_from_env with default environment values."""
15331494
LambdaClient.initialize_from_env()
1534-
mock_init.assert_called_once_with(
1535-
endpoint="http://host.docker.internal:5000", region="us-east-1"
1536-
)
1495+
mock_init.assert_called_once_with()

0 commit comments

Comments
 (0)