Skip to content

Conversation

@amitsh1
Copy link

@amitsh1 amitsh1 commented Dec 16, 2025

Motivation

closes #13503

Changes

BasePath was not being provided by cloudformation on deletion because it is not being saved the base path mapping object

Tests

Related

Resolves UNC-174

@localstack-bot
Copy link
Contributor

localstack-bot commented Dec 16, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@amitsh1
Copy link
Author

amitsh1 commented Dec 16, 2025

I have read the CLA Document and I hereby sign the CLA

@amitsh1
Copy link
Author

amitsh1 commented Dec 16, 2025

recheck

@simonrw simonrw self-requested a review December 19, 2025 16:54
@simonrw simonrw added semver: patch Non-breaking changes which can be included in patch releases docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes aws:cloudformation AWS CloudFormation labels Dec 19, 2025
@simonrw simonrw self-assigned this Dec 19, 2025
Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this submission!

I have commented that we don't think this is the right solution (thanks @bentsku for the correct implementation).

We would also need a validated test showing that this functionality works. You will need to deploy a CFn template (consider using deploy_cfn_template), and take a look at the tests in tests/aws/services/cloudformation/resources/test_apigateway.py for inspiration.

If this is too much let me know and I'll make the changes myself

Comment on lines 102 to 104
apigw.delete_base_path_mapping(
domainName=model["DomainName"], basePath=model.get("BasePath") or "(none)"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: I think this is not the right solution. We should be reading the base path from the response to create_base_path_mapping in the create handler, saving it on the model and loading it here. See my suggestion above.

localstack-bot added a commit that referenced this pull request Dec 20, 2025
@amitsh1 amitsh1 requested a review from simonrw December 20, 2025 14:11
Copy link
Contributor

@simonrw simonrw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for updating this PR. Unfortunately we cannot accept the test in its current form. See the comments for specifics.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: thanks for adding this test, but without showing that this test is validated, we don't know if the behaviour is correct.

We try to validate our tests against AWS, meaning that with a change of (external) configuration a test will run against AWS and LocalStack with identical behaviour. You can see more information here. Unfortunately without doing this we cannot accept this test.

If you wish to continue with this PR, please follow our testing practices. Note: this requires access to a real AWS account.

Otherwise I am happy to take over and finish this PR.



class TestApiGatewayBasePathMapping:
def test_delete_base_path_mapping_missing_base_path(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: you have not added a validation classification marker. Our test suite does not allow tests to be run without one of these markers, so this suggests you have not run this test.

Suggested change
def test_delete_base_path_mapping_missing_base_path(
@markers.aws.validated
def test_delete_base_path_mapping_missing_base_path(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: this test should be moved to tests/aws/services/cloudformation/resources/test_apigateway.py since it is specifically a test for the API Gateway CloudFormation resources.

"CertificateArn"
]

template = json.dumps(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: we prefer putting our CloudFormation templates into a file under tests/aws/templates and referring to them in the test itself. This makes the test body much smaller, and the CloudFormation template more understandable. Also could you use yaml instead of JSON - it's a bit nicer to read IMO

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

aws:cloudformation AWS CloudFormation docs: skip Pull request does not require documentation changes notes: skip Pull request does not have to be mentioned in the release notes 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.

bug: Cannot delete AWS::ApiGateway::BasePathMapping

3 participants