diff --git a/tests/fixtures.py b/tests/fixtures.py index d41a578ae..b0850375d 100644 --- a/tests/fixtures.py +++ b/tests/fixtures.py @@ -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