|
|
@ -316,6 +316,26 @@ class TestTerraform:
|
|
|
|
assert expected_output in out.replace("\n", "").replace(" ", "")
|
|
|
|
assert expected_output in out.replace("\n", "").replace(" ", "")
|
|
|
|
assert err == ""
|
|
|
|
assert err == ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_apply_plan(self):
|
|
|
|
|
|
|
|
# test is only applicable to version > 1.0.0
|
|
|
|
|
|
|
|
if version.parse(semantic_version) < version.parse("1.0.0"):
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tf = Terraform(
|
|
|
|
|
|
|
|
working_dir=current_path, terraform_semantic_version=semantic_version
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
out_folder = 'var_to_output'
|
|
|
|
|
|
|
|
out_file_name = 'test.out'
|
|
|
|
|
|
|
|
out_file_path = f'{out_folder}/{out_file_name}'
|
|
|
|
|
|
|
|
tf.init(out_folder)
|
|
|
|
|
|
|
|
ret, _, err = tf.plan(out_folder, detailed_exitcode=IsNotFlagged, out=out_file_name)
|
|
|
|
|
|
|
|
assert ret == 0
|
|
|
|
|
|
|
|
assert err == ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ret, _, err = tf.apply(out_file_path, skip_plan=True)
|
|
|
|
|
|
|
|
assert ret == 0
|
|
|
|
|
|
|
|
assert err == ""
|
|
|
|
|
|
|
|
|
|
|
|
def test_apply_with_var_file(self, caplog: LogCaptureFixture):
|
|
|
|
def test_apply_with_var_file(self, caplog: LogCaptureFixture):
|
|
|
|
with caplog.at_level(logging.INFO):
|
|
|
|
with caplog.at_level(logging.INFO):
|
|
|
|
tf = Terraform(working_dir=current_path, terraform_semantic_version=semantic_version)
|
|
|
|
tf = Terraform(working_dir=current_path, terraform_semantic_version=semantic_version)
|
|
|
|