File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -64,11 +64,11 @@ def __init__(
64
64
65
65
def apply (self , plan = True ):
66
66
"""run terraform apply"""
67
- if plan is True :
67
+ if plan :
68
68
plan_path = os .path .join (self .work_dir , "tfplan" )
69
69
self .plan (plan_path )
70
70
apply_args = self ._get_cmd_args ("apply" , plan = plan_path )
71
- elif plan :
71
+ else :
72
72
apply_args = self ._get_cmd_args ("apply" , plan = "" )
73
73
try :
74
74
self ._run_cmd (apply_args )
Original file line number Diff line number Diff line change @@ -151,7 +151,8 @@ def test_tf_statejson_update_bad():
151
151
152
152
153
153
@pytest .mark .skipif (not shutil .which ("terraform" ), reason = "Terraform binary missing" )
154
- def test_tf_runner (testdir , tmpdir ):
154
+ @pytest .mark .parametrize ("plan" , (True , False ))
155
+ def test_tf_runner (testdir , tmpdir , plan ):
155
156
# ** requires network access to install plugin **
156
157
with open (tmpdir .join ("resources.tf" ), "w" ) as fh :
157
158
fh .write (
@@ -165,7 +166,7 @@ def test_tf_runner(testdir, tmpdir):
165
166
166
167
trunner = tf .TerraformRunner (tmpdir .strpath , tf_bin = shutil .which ("terraform" ))
167
168
trunner .init ()
168
- state = trunner .apply ()
169
+ state = trunner .apply (plan = plan )
169
170
assert state .get ("foo" )["content" ] == "foo!"
170
171
with open (tmpdir .join ("foo.bar" )) as fh :
171
172
assert fh .read () == "foo!"
You can’t perform that action at this time.
0 commit comments