End-to-end tests for terraform modules (#1751)
Add end-to-end tests (apply, plan, destroy) for examples. When run, `tests/examples_e2e`: 1. Create an environment for tests to run (folder, project vpc network) 2. For each marked example (with `e2e` tftest directive), run apply, plan, destroy 3. Verify: * no failure in apply * empty plan after apply * no failure during destroy 4. When all tests are done, destroy test environment More details in `tests/examples_e2e/README.md`
This commit is contained in:
committed by
GitHub
parent
4e439720aa
commit
d07daf966a
@@ -28,6 +28,10 @@ def test_example(plan_validator, tmp_path, example):
|
||||
(tmp_path / 'fabric').symlink_to(BASE_PATH.parents[1])
|
||||
(tmp_path / 'variables.tf').symlink_to(BASE_PATH / 'variables.tf')
|
||||
(tmp_path / 'main.tf').write_text(example.code)
|
||||
assets_path = BASE_PATH.parent / str(example.module).replace('-',
|
||||
'_') / 'assets'
|
||||
if assets_path.exists():
|
||||
(tmp_path / 'assets').symlink_to(assets_path)
|
||||
|
||||
expected_modules = int(match.group(1))
|
||||
expected_resources = int(match.group(2))
|
||||
|
||||
Reference in New Issue
Block a user