1. test with more felxible string order

2. test with latest terraform
This commit is contained in:
beelit94 2017-08-04 15:36:11 -07:00
parent 12d57862ed
commit 965a39e3bf
2 changed files with 9 additions and 9 deletions

View file

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

View file

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