8000 cfn: fix failing `test_mapping_ref_map_key` for multi-account/region by sannya-singal · Pull Request #11699 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content

cfn: fix failing test_mapping_ref_map_key for multi-account/region #11699

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

Merged
merged 2 commits into from
Oct 16, 2024

Conversation

sannya-singal
Copy link
Contributor
@sannya-singal sannya-singal commented Oct 16, 2024

Motivation

With the support to add the region ref in mappings inside the conditions for cloudformation in the PR:#11671 the test tests.aws.services.cloudformation.engine.test_mappings.TestCloudFormationMappings.test_mapping_ref_map_key was updated to use AWS::Region, but when the test runs against non-default region it would fail because of the missing mapping in the template with the following error:

localstack.services.cloudformation.engine.errors.TemplateError: Invalid reference: 'ap-southeast-2' could not be found in the 'MyMap' mapping: '['*********']'

Related workflow: https://app.circleci.com/pipelines/github/localstack/localstack/28846/workflows/dc1a47d0-eaf1-46a7-8149-fc987e80351b/jobs/253009/parallel-runs/2

Changes

This PR adds mappings for the non-default regions currently being used to run the MA/MR pipeline.
(Alternatively added a static region in 680cc01 but this would defeat the purpose of testing ref region in the mappings)

Testing

Set the environment variable: TEST_AWS_REGION=us-west-1

@sannya-singal sannya-singal self-assigned this Oct 16, 2024
@sannya-singal sannya-singal added the semver: patch Non-breaking changes which can be included in patch releases label Oct 16, 2024
@sannya-singal sannya-singal added this to the 4.0 milestone Oct 16, 2024
@sannya-singal sannya-singal marked this pull request as ready for review October 16, 2024 09:29
Copy link

LocalStack Community integration with Pro

    2 files  ±0      2 suites  ±0   1h 42m 1s ⏱️ +6s
3 496 tests ±0  3 083 ✅ ±0  413 💤 ±0  0 ❌ ±0 
3 498 runs  ±0  3 083 ✅ ±0  415 💤 ±0  0 ❌ ±0 

Results for commit 8b5b233. ± Comparison against base commit ed6f7ec.

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 fixing this. I assume this list of regions is completed compared to the regions we test with?

It's a shame to have the knowledge about which regions we might use to test with in this template as well as the x-region test runner since they may get out of sync. We could generate the region map with templating. The deploy_cfn_template allows a jinja template to be passed in, with a dictionary of "context" via the template_mapping argument. Did you consider this?

I think this fix is probably overkill however, since this test fails obviously with a clear error message if the list of regions gets out of sync, and I don't imagine we will be changing the list of tested regions much in the future. Consider my suggestion "overthinking it" 😂

LGTM!

@sannya-singal
Copy link
Contributor Author

Thanks for the review @simonrw 🙌 Yes, the regions list is compared to the ones we test with and no I didn't consider to generate the region map with templating.

@sannya-singal sannya-singal merged commit 1bc0db5 into master Oct 16, 2024
42 checks passed
@sannya-singal sannya-singal deleted the fix/ma-mr-cfn branch October 16, 2024 12:07
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.

2 participants
0