Skip to content

Commit ccf7d1c

Browse files
committed
initial code generated by Gemini
1 parent bd88996 commit ccf7d1c

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

aws-proxy/AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,9 @@ To run a single test via `pytest` (say, `test_my_logic` in `test_s3.py`), use th
2929
```
3030
TEST_PATH=tests/test_s3.py::test_my_logic make test
3131
```
32+
33+
When adding new integration tests, consider the following:
34+
* Include a mix of positive and negative assertions (e., presence and absence of resources).
35+
* Include a mix of different configuration options, e.g., the `read_only: true` flag can be specified in the proxy service configuration YAML, enabling read-only mode (which should be covered by tests as well).
36+
* Make sure to either use fixtures (preferred), or reliable cleanups for removing the resources; several fixtures for creating AWS resources are available in the `localstack.testing.pytest.fixtures` module
37+
* If a test uses multiple resources with interdependencies (e.g., an SQS queue connected to an SNS topic), then the test needs to ensure that both resource types are proxied (i.e., created in real AWS), to avoid a situation where a resource in AWS is attempting to reference a local resource in LocalStack (using account ID `000000000000` in their ARN).

aws-proxy/aws_proxy/server/aws_request_forwarder.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ def _request_matches_resource(
128128
if re.match(resource_name_pattern, candidate):
129129
return True
130130
return False
131+
if service_name == "sns":
132+
topic_arn = context.service_request.get("TopicArn") or ""
133+
if not topic_arn:
134+
return False
135+
return bool(re.match(resource_name_pattern, topic_arn))
131136
if service_name == "secretsmanager":
132137
secret_id = context.service_request.get("SecretId") or ""
133138
secret_arn = secretsmanager_secret_arn(

0 commit comments

Comments
 (0)