Update environments e2e example with new sinks
This commit is contained in:
@@ -26,12 +26,12 @@ BASEDIR = os.path.dirname(os.path.dirname(__file__))
|
||||
def _plan_runner():
|
||||
"Returns a function to run Terraform plan on a fixture."
|
||||
|
||||
def run_plan(fixture_path, targets=None, **tf_vars):
|
||||
def run_plan(fixture_path, targets=None, refresh=True, **tf_vars):
|
||||
"Runs Terraform plan and returns parsed output."
|
||||
tf = tftest.TerraformTest(fixture_path, BASEDIR,
|
||||
os.environ.get('TERRAFORM', 'terraform'))
|
||||
tf.setup()
|
||||
return tf.plan(output=True, tf_vars=tf_vars, targets=targets)
|
||||
return tf.plan(output=True, refresh=refresh, tf_vars=tf_vars, targets=targets)
|
||||
|
||||
return run_plan
|
||||
|
||||
@@ -54,9 +54,9 @@ def plan_runner(_plan_runner):
|
||||
def e2e_plan_runner(_plan_runner):
|
||||
"Returns a function to run Terraform plan on an end-to-end fixture."
|
||||
|
||||
def run_plan(fixture_path, targets=None, **tf_vars):
|
||||
def run_plan(fixture_path, targets=None, refresh=True, **tf_vars):
|
||||
"Runs Terraform plan on an end-to-end module using defaults, returns data."
|
||||
plan = _plan_runner(fixture_path, targets=targets, **tf_vars)
|
||||
plan = _plan_runner(fixture_path, targets=targets, refresh=refresh, **tf_vars)
|
||||
# skip the fixture
|
||||
root_module = plan.root_module['child_modules'][0]
|
||||
modules = dict((mod['address'], mod['resources'])
|
||||
|
||||
@@ -22,7 +22,7 @@ FIXTURES_DIR = os.path.join(os.path.dirname(__file__), 'fixture')
|
||||
|
||||
def test_folder_roles(e2e_plan_runner):
|
||||
"Test folder roles."
|
||||
modules, _ = e2e_plan_runner(FIXTURES_DIR)
|
||||
modules, _ = e2e_plan_runner(FIXTURES_DIR, refresh=False)
|
||||
for env in ['test', 'prod']:
|
||||
resources = modules[f'module.test.module.environment-folders["{env}"]']
|
||||
folders = [r for r in resources if r['type'] == 'google_folder']
|
||||
@@ -41,7 +41,7 @@ def test_org_roles(e2e_plan_runner):
|
||||
'organization_id': 'organizations/123',
|
||||
'iam_xpn_config': '{grant = true, target_org = true}'
|
||||
}
|
||||
modules, _ = e2e_plan_runner(FIXTURES_DIR, **tf_vars)
|
||||
modules, _ = e2e_plan_runner(FIXTURES_DIR, refresh=False, **tf_vars)
|
||||
for env in ['test', 'prod']:
|
||||
resources = modules[f'module.test.module.environment-folders["{env}"]']
|
||||
folder_bindings = [r['index']
|
||||
|
||||
Reference in New Issue
Block a user