Skip to content

Commit 588d2c2

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

File tree

3 files changed

+10
-73
lines changed

3 files changed

+10
-73
lines changed

src/aws_durable_execution_sdk_python/lambda_service.py

Lines changed: 4 additions & 18 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,15 @@ 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

871-
logger.debug(
872-
"Initialized lambda client with endpoint: '%s', region: '%s'",
873-
endpoint,
874-
region,
875-
)
869+
logger.debug("Initialized lambda client")
876870
return LambdaClient(client=client)
877871

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-
886872
def checkpoint(
887873
self,
888874
durable_execution_arn: str,

tests/e2e/execution_int_test.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from aws_durable_execution_sdk_python.lambda_service import (
1919
CheckpointOutput,
2020
CheckpointUpdatedExecutionState,
21-
LambdaClient,
2221
OperationAction,
2322
OperationType,
2423
)
@@ -392,14 +391,3 @@ def mock_checkpoint(
392391
assert checkpoint.action is OperationAction.START
393392
assert checkpoint.operation_id == "1"
394393
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: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -771,25 +771,12 @@ def test_state_output_from_dict_empty_operations():
771771
assert output.next_marker == "marker123"
772772

773773

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-
790774
@patch.dict(
791775
"os.environ",
792-
{"LOCAL_RUNNER_ENDPOINT": "http://test:5000", "LOCAL_RUNNER_REGION": "us-west-1"},
776+
{
777+
"DURABLE_LOCAL_RUNNER_ENDPOINT": "http://test:5000",
778+
"DURABLE_LOCAL_RUNNER_REGION": "us-west-1",
779+
},
793780
)
794781
@patch("aws_durable_execution_sdk_python.lambda_service.boto3")
795782
def test_lambda_client_initialize_local_runner_client(mock_boto3):
@@ -805,20 +792,6 @@ def test_lambda_client_initialize_local_runner_client(mock_boto3):
805792
assert lambda_client.client == mock_client
806793

807794

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-
822795
def test_lambda_client_checkpoint():
823796
"""Test LambdaClient.checkpoint method."""
824797
mock_client = Mock()
@@ -1005,14 +978,6 @@ def test_lambda_client_stop():
1005978
assert result == "2023-01-01T00:00:00Z"
1006979

1007980

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-
1016981
def test_durable_service_client_protocol_checkpoint():
1017982
"""Test DurableServiceClient protocol checkpoint method signature."""
1018983
mock_client = Mock(spec=DurableServiceClient)
@@ -1526,11 +1491,9 @@ def test_lambda_client_initialize_local_runner_client_defaults(mock_boto3):
15261491

15271492
@patch.dict("os.environ", {}, clear=True)
15281493
@patch(
1529-
"aws_durable_execution_sdk_python.lambda_service.LambdaClient.initialize_from_endpoint_and_region"
1494+
"aws_durable_execution_sdk_python.lambda_service.LambdaClient.initialize_from_env"
15301495
)
15311496
def test_lambda_client_initialize_from_env_defaults(mock_init):
15321497
"""Test LambdaClient.initialize_from_env with default environment values."""
15331498
LambdaClient.initialize_from_env()
1534-
mock_init.assert_called_once_with(
1535-
endpoint="http://host.docker.internal:5000", region="us-east-1"
1536-
)
1499+
mock_init.assert_called_once_with()

0 commit comments

Comments
 (0)