Skip to content

Commit 75c4d82

Browse files
whummerclaude
andauthored
Add proxy tests for the AppSync service (#120)
Add comprehensive proxy tests for AWS AppSync covering: - GraphQL API CRUD operations - API key management - Schema creation and introspection - Data source operations - Read-only proxy mode - Operations-based filtering Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9fcf0e6 commit 75c4d82

File tree

4 files changed

+497
-3
lines changed

4 files changed

+497
-3
lines changed

aws-proxy/AGENTS.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ You are an AI agent tasked with adding additional functionality or test coverage
1515
* You can call different `make` targets (e.g., `make test`) in this repo (no need to prompt for confirmation)
1616
* For each new file created or existing file modified, add a header comment to the file, something like `# Note/disclosure: This file has been (partially or fully) generated by an AI agent.`
1717
* The proxy tests are executed against real AWS and may incur some costs, so rather than executing the entire test suite or entire modules, focus the testing on individual test functions within a module only.
18+
* Before claiming success, always double-check against real AWS (via `aws` CLI commands) that everything has been cleaned up and there are no leftover resources from the proxy tests.
1819
* Never add any `print(..)` statements to the code - use a logger to report any status to the user, if required.
1920
* To format/lint the codebase you can run `make format` and `make lint`.
2021

@@ -31,6 +32,19 @@ To run a single test via `pytest` (say, `test_my_logic` in `test_s3.py`), use th
3132
TEST_PATH=tests/test_s3.py::test_my_logic make test
3233
```
3334

35+
### Read-Only Mode Support
36+
37+
Some services have operations that are functionally read-only (don't modify state) but don't follow the standard naming conventions (`Describe*`, `Get*`, `List*`, `Query*`). When adding tests or support for a new service with `read_only: true` configuration, check the [AWS Service Authorization Reference](https://docs.aws.amazon.com/service-authorization/latest/reference/) for the service and identify any operations that:
38+
- Are classified as "Read" access level but don't match the standard prefixes
39+
- Evaluate or simulate something without modifying state (e.g., `Evaluate*`, `Simulate*`, `Test*`, `Check*`, `Validate*`)
40+
41+
If you find such operations, add them to the service-specific rules in `aws_proxy/server/aws_request_forwarder.py` in the `_is_read_request` method. This ensures that read-only proxy configurations correctly forward these operations rather than blocking them.
42+
43+
Example services with non-standard read-only operations:
44+
- **AppSync**: `EvaluateCode`, `EvaluateMappingTemplate`
45+
- **IAM**: `SimulateCustomPolicy`, `SimulatePrincipalPolicy`
46+
- **Cognito**: `InitiateAuth`
47+
3448
When adding new integration tests, consider the following:
3549
* Include a mix of positive and negative assertions (i.e., presence and absence of resources).
3650
* 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).

aws-proxy/aws_proxy/server/aws_request_forwarder.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,11 @@ def _is_read_request(self, context: RequestContext) -> bool:
223223
"PartiQLSelect",
224224
}:
225225
return True
226+
if context.service.service_name == "appsync" and operation_name in {
227+
"EvaluateCode",
228+
"EvaluateMappingTemplate",
229+
}:
230+
return True
226231
# TODO: add more rules
227232
return False
228233

0 commit comments

Comments
 (0)