Skip to content

Conversation

viren-nadkarni
Copy link
Member

@viren-nadkarni viren-nadkarni commented Mar 29, 2023

Introduces a new config option ALLOW_NONSTANDARD_REGIONS which disables strict validation of AWS regions.

Closes #7993

@viren-nadkarni viren-nadkarni self-assigned this Mar 29, 2023
@coveralls
Copy link

Coverage Status

Coverage: 81.878% (+0.02%) from 81.856% when pulling 8f1be3d on nonstandard-regions into 5211924 on master.

Comment on lines +4 to +9
@unittest.mock.patch("localstack.config.ALLOW_NONSTANDARD_REGIONS", True)
def test_nonstandard_regions(create_boto_client, monkeypatch):
"""
Ensure that non-standard AWS regions can be used vertically.
"""
monkeypatch.setenv("MOTO_ALLOW_NONEXISTENT_REGION", "true")
Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally we want to patch the config option before LS starts. What's a proper way to do this?

Copy link
Member

Choose a reason for hiding this comment

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

unfortunately there is no good way of doing as at all. especially not in a test. config.py seems good for the runtime

@viren-nadkarni viren-nadkarni marked this pull request as ready for review March 29, 2023 10:02
@viren-nadkarni viren-nadkarni requested a review from thrau as a code owner March 29, 2023 10:02
Copy link
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

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

nice addition!

ec2_client.create_key_pair(KeyName="foo")

# Create a resource in LocalStack store
sqs_client = create_boto_client("sqs", region_name="pluto-central-2a")
Copy link
Member

Choose a reason for hiding this comment

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

:D

Comment on lines +4 to +9
@unittest.mock.patch("localstack.config.ALLOW_NONSTANDARD_REGIONS", True)
def test_nonstandard_regions(create_boto_client, monkeypatch):
"""
Ensure that non-standard AWS regions can be used vertically.
"""
monkeypatch.setenv("MOTO_ALLOW_NONEXISTENT_REGION", "true")
Copy link
Member

Choose a reason for hiding this comment

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

unfortunately there is no good way of doing as at all. especially not in a test. config.py seems good for the runtime

@github-actions
Copy link

LocalStack integration with Pro

1 867 tests  +1   1 676 ✔️ +1   1h 24m 7s ⏱️ -56s
       1 suites ±0      191 💤 ±0 
       1 files   ±0          0 ±0 

Results for commit d0c26fe. ± Comparison against base commit 62254ed.

@thrau thrau merged commit cb50656 into master Mar 29, 2023
@thrau thrau deleted the nonstandard-regions branch March 29, 2023 15:15
@toadzky
Copy link

toadzky commented Mar 29, 2023

thanks guys

import unittest


@unittest.mock.patch("localstack.config.ALLOW_NONSTANDARD_REGIONS", True)
Copy link
Member

Choose a reason for hiding this comment

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

@viren-nadkarni

we usually use monkeypatch.setattr(config, "ALLOW_NONSTANDARD_REGIONS", True) here.
Any reason you're using unittest in this case?

Copy link
Member Author

Choose a reason for hiding this comment

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

No particular reason at all, it just didn't cross my mind. I'll fix it when I retouch this next time

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.

feature request: Let us use custom regions again
5 participants