Skip to content

Commit

Permalink
fix recent config change
Browse files Browse the repository at this point in the history
  • Loading branch information
thrau committed Jun 4, 2024
1 parent 43452a3 commit 49b5a01
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion aws-replicator/aws_replicator/client/auth_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def register_in_instance(self):
if not port:
raise Exception("Proxy currently not running")
url = f"{external_service_url()}{HANDLER_PATH_PROXIES}"
data = AddProxyRequest(port=port, config=self.config)
data = AddProxyRequest(port=port, config=self.config, env_vars={})
LOG.debug("Registering new proxy in main container via: %s", url)
try:
response = requests.post(url, json=data)
Expand Down
14 changes: 8 additions & 6 deletions aws-replicator/aws_replicator/server/aws_request_forwarder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
import requests
from localstack.aws.api import RequestContext
from localstack.aws.chain import Handler, HandlerChain
from localstack.constants import (
APPLICATION_JSON,
LOCALHOST,
LOCALHOST_HOSTNAME,
TEST_AWS_ACCESS_KEY_ID,
)
from localstack.constants import APPLICATION_JSON, LOCALHOST, LOCALHOST_HOSTNAME
from localstack.http import Response

try:
from localstack.constants import TEST_AWS_ACCOUNT_ID
except ImportError:
# compatibility with localstack 3.5
from localstack.testing.config import TEST_AWS_ACCOUNT_ID
from localstack.utils.aws import arns
from localstack.utils.aws.arns import sqs_queue_arn
from localstack.utils.aws.aws_stack import get_valid_regions
Expand Down Expand Up @@ -192,6 +193,7 @@ def _extract_region_from_domain(self, context: RequestContext):
context.request.headers["Authorization"] = mock_aws_request_headers(
context.service.service_name,
region_name=part,
# FIXME: TEST_AWS_ACCESS_KEY_ID should only be used in testing
aws_access_key_id=TEST_AWS_ACCESS_KEY_ID,
)
return
Expand Down
11 changes: 9 additions & 2 deletions aws-replicator/tests/test_proxy_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
import pytest
from botocore.exceptions import ClientError
from localstack.aws.connect import connect_to
from localstack.constants import TEST_AWS_ACCOUNT_ID

try:
from localstack.constants import TEST_AWS_ACCOUNT_ID
except ImportError:
# compatibility with localstack 3.5
from localstack.testing.config import TEST_AWS_ACCOUNT_ID

from localstack.utils.aws.arns import sqs_queue_arn, sqs_queue_url_for_arn
from localstack.utils.sync import retry

Expand All @@ -23,7 +29,8 @@ def start_aws_proxy():

def _start(config: dict = None):
proxy = start_aws_auth_proxy(config)
proxy.wait_is_up()
if not proxy.wait_is_up(timeout=10):
raise TimeoutError(f"Gave up waiting for proxy to start on {proxy.url}")
proxies.append(proxy)
return proxy

Expand Down

0 comments on commit 49b5a01

Please sign in to comment.