Better error reporting when missing setup for E2E tests (#1985)

This commit is contained in:
Wiktor Niesiobędzki 2024-01-17 21:34:20 +01:00 committed by GitHub
parent 1c99bae649
commit a34cdd5597
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 3 deletions

View File

@ -296,10 +296,18 @@ def plan_validator_fixture(request):
def get_tfvars_for_e2e():
_variables = [
"billing_account", "group_email", "organization_id", "parent", "prefix",
"region"
'billing_account', 'group_email', 'organization_id', 'parent', 'prefix',
'region'
]
tf_vars = {k: os.environ.get(f"TFTEST_E2E_{k}") for k in _variables}
missing_vars = set([f'TFTEST_E2E_{k}' for k in _variables]) - set(
os.environ.keys())
if missing_vars:
raise RuntimeError(
f'Missing environment variables: {missing_vars} required to run E2E tests. '
f'Consult CONTRIBUTING.md to understand how to set them up. '
f'If you want to skip E2E tests add -k "not examples_e2e" to your pytest call'
)
tf_vars = {k: os.environ.get(f'TFTEST_E2E_{k}') for k in _variables}
return tf_vars