-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
APIGW: add negative tests for IntegrationResponse and improve error handling in PutIntegrationResponse and GetIntegrationResponse #12773
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 18m 53s ⏱️ - 1h 26m 13s Results for commit b4e4d0f. ± Comparison against base commit 21b3a06. This pull request removes 3759 and adds 7 tests. Note that renamed tests count towards both.
This pull request removes 709 skipped tests and adds 1 skipped test. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
Test Results (amd64) - Integration, Bootstrap 5 files 5 suites 35m 48s ⏱️ Results for commit b4e4d0f. ♻️ This comment has been updated with latest results. |
Test Results - Alternative Providers987 tests 589 ✅ 30m 28s ⏱️ Results for commit e19873b. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! This is looking great! 🚀
I only have a few comments, the only blocking-one related to the modified auto-generated file, which is maybe lacking a disclaimer, as it's a common pitfall.
I also have a comment regarding the new changes required to make the other tests outside of this PR work, and maybe a suggestion or a follow-up we could do to write a test to trigger the scenario that was making your PR fail, but in a clear way and not with ImportAPI
calls. It could help to avoid future regressions, and make the failing scenario clearer. See the comment related to that 😄
All in all, great work, this is looking really nice, and this was not an easy task as we're directly manipulating objects and the flow is not very clear. Congrats for navigating this! 🚀
localstack-core/localstack/services/apigateway/legacy/provider.py
Outdated
Show resolved
Hide resolved
ab53b23
to
b4e4d0f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Congrats, I know this was a very tricky one, wrangling moto internals and adding the validation in the right order! The CI is green and I've checked that our dependencies tests are also green, so this is good to merge! 🚀 awesome work!
response["selectionPattern"] = integration_response.selection_pattern | ||
if ( | ||
"selectionPattern" not in response | ||
and integration_response |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this line could probably be removed because we are failing early if it not true (in line 2082)
and integration_response
But let's not block the merge, we can remove it in a follow-up PR!
Motivation
Add negative test coverage for the
IntegrationResponse
operation in API Gateway v1, to ensure LocalStack properly mimics AWS behavior when invalid inputs are provided. This improves parity and robustness of the emulated service.Changes
Added negative test coverage for
PutIntegrationResponse
andGetIntegrationResponse
operations:test_integration_response_wrong_api
test_integration_response_wrong_resource
test_integration_response_wrong_method
test_integration_response_wrong_invalid_statuscode
test_integration_response_invalid_responsetemplates
(skipped for now due to LocalStack/AWS parity gap)test_integration_response_invalid_integration
test_integration_response_wrong_status_code
Updated
put_integration_response
andget_integration_response
inprovider.py
to:statusCode
using regex ([1-5]\d\d
), raiseValidationException
for invalid valuesNotFoundException
messages for missing resources, methods, or integration responsesTODO
What's left to do:
responseTemplates
input_integration_response
to ensure LocalStack raises appropriate exceptions (e.g.,SerializationException
,BadRequestException
) when invalid values are providedtest_integration_response_invalid_responsetemplates
once LocalStack behavior matches AWS