зеркало из https://github.com/mozilla/frost.git
Родитель
aefc58dbbf
Коммит
047e338158
|
@ -86,6 +86,7 @@ frost test aws/rds/test_rds_db_instance_backup_enabled.py --aws-profiles default
|
|||
Frost adds the options:
|
||||
|
||||
* `--aws-profiles` for selecting one or more AWS profiles to fetch resources for or the AWS default profile / `AWS_PROFILE` environment variable
|
||||
* `--aws-regions` for selecting one or more AWS regions to test as a CSV e.g. `us-east-1,us-west-2`. **defaults to all regions**
|
||||
* `--gcp-project-id` for selecting the GCP project to test. **Required for GCP tests**
|
||||
* `--offline` a flag to tell HTTP clients to not make requests and return empty params
|
||||
* [`--config`](#custom-test-config) path to test custom config file
|
||||
|
|
|
@ -163,7 +163,7 @@ def get_aws_resource(
|
|||
|
||||
|
||||
class BotocoreClient:
|
||||
def __init__(self, profiles, cache, debug_calls, debug_cache, offline):
|
||||
def __init__(self, profiles, regions, cache, debug_calls, debug_cache, offline):
|
||||
self.profiles = profiles or [None]
|
||||
self.cache = cache
|
||||
|
||||
|
@ -173,6 +173,8 @@ class BotocoreClient:
|
|||
|
||||
if offline:
|
||||
self.regions = ["us-east-1"]
|
||||
elif regions:
|
||||
self.regions = regions
|
||||
else:
|
||||
self.regions = get_available_regions()
|
||||
|
||||
|
|
13
conftest.py
13
conftest.py
|
@ -29,6 +29,12 @@ def pytest_addoption(parser):
|
|||
help="Set default AWS profiles to use. Defaults to the current AWS profile i.e. [None].",
|
||||
)
|
||||
|
||||
parser.addoption(
|
||||
"--aws-regions",
|
||||
type=str,
|
||||
help="Set AWS regions to use as a comma separate list. Defaults to all available AWS regions",
|
||||
)
|
||||
|
||||
parser.addoption(
|
||||
"--gcp-project-id",
|
||||
type=str,
|
||||
|
@ -80,11 +86,18 @@ def pytest_configure(config):
|
|||
patch_cache_set(config)
|
||||
|
||||
profiles = config.getoption("--aws-profiles")
|
||||
aws_regions = (
|
||||
config.getoption("--aws-regions").split(",")
|
||||
if config.getoption("--aws-regions")
|
||||
else []
|
||||
)
|
||||
|
||||
project_id = config.getoption("--gcp-project-id")
|
||||
organization = config.getoption("--organization")
|
||||
|
||||
botocore_client = BotocoreClient(
|
||||
profiles=profiles,
|
||||
regions=aws_regions,
|
||||
cache=cache,
|
||||
debug_calls=config.getoption("--debug-calls"),
|
||||
debug_cache=config.getoption("--debug-cache"),
|
||||
|
|
Загрузка…
Ссылка в новой задаче