1. test with more felxible string order

2. test with latest terraform
merge-requests/1/head
beelit94 7 years ago
parent 12d57862ed
commit 965a39e3bf

@ -5,7 +5,7 @@ python:
- '3.6'
before_install: sudo apt-get install unzip
before_script:
- export TFVER=0.9.5
- export TFVER=0.10.0
- export TFURL=https://releases.hashicorp.com/terraform/
- TFURL+=$TFVER
- TFURL+="/terraform_"

@ -8,11 +8,10 @@ import os
import logging
import re
import shutil
from itertools import combinations
logging.basicConfig(level=logging.DEBUG)
root_logger = logging.getLogger()
# ch = logging.StreamHandler(sys.stdout)
# root_logger.addHandler(ch)
current_path = os.path.dirname(os.path.realpath(__file__))
STRING_CASES = [
@ -169,19 +168,20 @@ class TestTerraform(object):
assert 'test2' in out
@pytest.mark.parametrize(
("param", "param_str"),
("param"),
[
({}, ""),
({'module': 'test2'}, "-module=test2"),
({'module': 'test2', 'no_color': IsFlagged}, "-no-color -module=test2")
({}),
({'module': 'test2'}),
]
)
def test_output(self, param, param_str, string_logger):
def test_output(self, param, string_logger):
tf = Terraform(working_dir=current_path, variables={'test_var': 'test'})
tf.apply('var_to_output')
result = tf.output('test_output', **param)
regex = re.compile('terraform output (-module=test2 -json|-json -module=test2) test_output')
log_str = string_logger()
if param:
assert 'terraform output -json {0} test_output'.format(param_str) in string_logger()
assert re.search(regex, log_str), log_str
else:
assert result == 'test'

Loading…
Cancel
Save