Skip to content
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

Feature: Mock region #4699

Merged
merged 7 commits into from Dec 24, 2021
Merged

Conversation

bblommers
Copy link
Collaborator

Feature to allow a user to specify a non-existing region. Having a non-existent region can be useful as an additional layer of protection, to ensure the user does not modify real AWS architecture.

This feature is disabled by default, but can be enabled with an environment variable. (MOTO_ALLOW_NONEXISTENT_REGION)

In order to make this work, all backends are now generated on-request, rather then on start-up.
This results in:

  • A single place where we can decide whether a region is valid/allowed
  • Better performance on start-up (we don't need to generate Backends for 27 regions, just the one required)
  • Better performance on reset (as we only need to reset a single Backend, instead of all 27.)

Closes #4252

@codecov-commenter
Copy link

codecov-commenter commented Dec 17, 2021

Codecov Report

Merging #4699 (d214b67) into master (691bb87) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4699      +/-   ##
==========================================
+ Coverage   95.28%   95.29%   +0.01%     
==========================================
  Files         556      556              
  Lines       61017    60594     -423     
==========================================
- Hits        58140    57745     -395     
+ Misses       2877     2849      -28     
Flag Coverage Δ
servertests 47.49% <99.49%> (-0.33%) ⬇️
test_responses 32.08% <99.49%> (-0.42%) ⬇️
unittests 95.21% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
moto/applicationautoscaling/__init__.py 100.00% <ø> (ø)
moto/cloudwatch/__init__.py 100.00% <ø> (ø)
moto/cognitoidentity/__init__.py 100.00% <ø> (ø)
moto/datapipeline/__init__.py 100.00% <ø> (ø)
moto/elastictranscoder/__init__.py 100.00% <ø> (ø)
moto/emrcontainers/__init__.py 100.00% <ø> (ø)
moto/iot/__init__.py 100.00% <ø> (ø)
moto/iotdata/__init__.py 100.00% <ø> (ø)
moto/medialive/__init__.py 100.00% <ø> (ø)
moto/rds/__init__.py 100.00% <ø> (ø)
... and 86 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 691bb87...d214b67. Read the comment docs.

Copy link
Collaborator

@bpandola bpandola left a comment

Choose a reason for hiding this comment

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

I don't have the bandwidth to review all the changes across all 98 files, but I understand the problem this PR aims to solve and I think the implementation makes sense.

The added tests do seem to cover the new functionality, so if all the other tests still pass this LGTM.

@bblommers
Copy link
Collaborator Author

Understandable! Thanks @bpandola

@bblommers bblommers merged commit cf87e75 into getmoto:master Dec 24, 2021
@bblommers bblommers deleted the feature/mock-region branch December 24, 2021 21:02
@bblommers bblommers added this to the 2.3.0 milestone Dec 24, 2021
@github-actions
Copy link
Contributor

This is now part of moto >= 2.3.0.dev3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mock region
3 participants