Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ArthurAkh
Copy link
Contributor

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 and GetIntegrationResponse 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)
  • Updated put_integration_response and get_integration_response in provider.py to:

    • Validate statusCode using regex ([1-5]\d\d)
    • Raise ValidationException for invalid values
    • Return appropriate NotFoundException messages for missing resources, methods, or integration responses

TODO

What's left to do:

  • Implement validation logic for responseTemplates in put_integration_response to ensure LocalStack raises appropriate exceptions (e.g., SerializationException, BadRequestException) when invalid values are provided
  • Enable the currently skipped test test_integration_response_invalid_responsetemplates once LocalStack behavior matches AWS

@ArthurAkh ArthurAkh self-assigned this Jun 18, 2025
@ArthurAkh ArthurAkh added the semver: patch Non-breaking changes which can be included in patch releases label Jun 18, 2025
Copy link

Test Results - Preflight, Unit

21 630 tests  ±0   19 973 ✅ ±0   6m 43s ⏱️ +17s
     1 suites ±0    1 657 💤 ±0 
     1 files   ±0        0 ❌ ±0 

Results for commit e19873b. ± Comparison against base commit 99cd6da.

Copy link

LocalStack Community integration with Pro

    2 files  ±    0      2 suites  ±0   20m 6s ⏱️ - 1h 23m 30s
1 141 tests  - 3 743  1 073 ✅  - 3 034  66 💤  - 711  2 ❌ +2 
1 143 runs   - 3 743  1 073 ✅  - 3 034  68 💤  - 711  2 ❌ +2 

For more details on these failures, see this check.

Results for commit e19873b. ± Comparison against base commit 99cd6da.

This pull request removes 3748 and adds 5 tests. Note that renamed tests count towards both.
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_lambda_dynamodb
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_opensearch_crud
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_search_books
tests.aws.scenario.bookstore.test_bookstore.TestBookstoreApplication ‑ test_setup
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_destination_sns
tests.aws.scenario.lambda_destination.test_lambda_destination_scenario.TestLambdaDestinationScenario ‑ test_infra
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_prefill_dynamodb_table
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input0-SUCCEEDED]
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input1-SUCCEEDED]
…
tests.aws.services.apigateway.test_apigateway_api.TestApigatewayIntegration ‑ test_integration_response_invalid_responsetemplates
tests.aws.services.apigateway.test_apigateway_api.TestApigatewayIntegration ‑ test_integration_response_invalid_statuscode
tests.aws.services.apigateway.test_apigateway_api.TestApigatewayIntegration ‑ test_integration_response_wrong_api
tests.aws.services.apigateway.test_apigateway_api.TestApigatewayIntegration ‑ test_integration_response_wrong_method
tests.aws.services.apigateway.test_apigateway_api.TestApigatewayIntegration ‑ test_integration_response_wrong_resource
This pull request removes 712 skipped tests and adds 1 skipped test. Note that renamed tests count towards both.
tests.aws.scenario.kinesis_firehose.test_kinesis_firehose.TestKinesisFirehoseScenario ‑ test_kinesis_firehose_s3
tests.aws.scenario.loan_broker.test_loan_broker.TestLoanBrokerScenario ‑ test_stepfunctions_input_recipient_list[step_function_input4-FAILED]
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_deployed_infra_state
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_populate_data
tests.aws.scenario.mythical_mysfits.test_mythical_misfits.TestMythicalMisfitsScenario ‑ test_user_clicks_are_stored
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_api_exceptions
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_create_exceptions
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_create_invalid_desiredstate
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_double_create_with_client_token
tests.aws.services.cloudcontrol.test_cloudcontrol_api.TestCloudControlResourceApi ‑ test_lifecycle
…
tests.aws.services.apigateway.test_apigateway_api.TestApigatewayIntegration ‑ test_integration_response_invalid_responsetemplates

Copy link

Test Results (amd64) - Acceptance

7 tests  ±0   5 ✅ ±0   3m 8s ⏱️ -3s
1 suites ±0   2 💤 ±0 
1 files   ±0   0 ❌ ±0 

Results for commit e19873b. ± Comparison against base commit 99cd6da.

Copy link

Test Results (amd64) - Integration, Bootstrap

    5 files      5 suites   37m 4s ⏱️
1 165 tests 1 097 ✅ 66 💤 2 ❌
1 171 runs  1 097 ✅ 72 💤 2 ❌

For more details on these failures, see this check.

Results for commit e19873b.

Copy link

Test Results - Alternative Providers

987 tests   589 ✅  30m 28s ⏱️
  4 suites  398 💤
  4 files      0 ❌

Results for commit e19873b.

@ArthurAkh ArthurAkh marked this pull request as draft June 18, 2025 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant