From d2440a6b2163648c1c9fc23daf9d3d0e2f1bc2b6 Mon Sep 17 00:00:00 2001 From: Freddy Tan Date: Tue, 20 Dec 2016 19:58:04 +0800 Subject: [PATCH 1/2] fix test working directory --- test/test_terraform.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/test_terraform.py b/test/test_terraform.py index 2bb6804..f05819c 100644 --- a/test/test_terraform.py +++ b/test/test_terraform.py @@ -50,7 +50,7 @@ class TestTerraform(object): "method", "expected" ], STRING_CASES) def test_generate_cmd_string(self, method, expected): - tf = Terraform() + tf = Terraform(working_dir=current_path) result = method(tf) strs = expected.split() @@ -73,7 +73,7 @@ class TestTerraform(object): ("var_to_output", {'test_map_var': {"c": "c", "d": "d"}}, 'var_to_output/test_map_var.json', "test_map_output={a=ab=bc=cd=de=ef=f}") ]) def test_apply(self, folder, variables, var_files, expected_output): - tf = Terraform(variables=variables, var_file=var_files) + tf = Terraform(working_dir=current_path, variables=variables, var_file=var_files) ret, out, err = tf.apply(folder) assert ret == 0 assert expected_output in out.replace('\n', '').replace(' ', '') @@ -98,24 +98,24 @@ class TestTerraform(object): ] ) def test_override_default(self, folder, variables): - tf = Terraform(variables=variables) + tf = Terraform(working_dir=current_path, variables=variables) ret, out, err = tf.apply(folder, var={'test_var': 'test2'}, no_color=IsNotFlagged) out = out.replace('\n', '') assert '\x1b[0m\x1b[1m\x1b[32mApply' in out def test_get_output(self): - tf = Terraform(variables={'test_var': 'test'}) + tf = Terraform(working_dir=current_path, variables={'test_var': 'test'}) tf.apply('var_to_output') assert tf.output('test_output') == 'test' def test_destroy(self): - tf = Terraform(variables={'test_var': 'test'}) + tf = Terraform(working_dir=current_path, variables={'test_var': 'test'}) ret, out, err = tf.destroy('var_to_output') assert ret == 0 assert 'Destroy complete! Resources: 0 destroyed.' in out def test_fmt(self): - tf = Terraform(variables={'test_var': 'test'}) + tf = Terraform(working_dir=current_path, variables={'test_var': 'test'}) ret, out, err = tf.fmt(diff=True) assert ret == 0 From c134143fd980ed3073e240a30f2305b4c4e0790f Mon Sep 17 00:00:00 2001 From: Freddy Tan Date: Tue, 20 Dec 2016 23:20:42 +0800 Subject: [PATCH 2/2] update terraform bin files --- .travis.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b434792..ca64073 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,15 @@ python: # command to install dependencies before_install: 'sudo apt-get install unzip' before_script: - - 'wget https://releases.hashicorp.com/terraform/0.7.11/terraform_0.7.11_linux_amd64.zip' + - 'export TFVER=0.8.1' + - 'export TFURL=https://releases.hashicorp.com/terraform/' + - 'TFURL+=$TFVER' + - 'TFURL+="/terraform_"' + - 'TFURL+=$TFVER' + - 'TFURL+="_linux_amd64.zip"' + - 'wget $TFURL -O terraform_bin.zip' - 'mkdir tf_bin' - - 'unzip terraform_0.7.11_linux_amd64.zip -d tf_bin' + - 'unzip terraform_bin.zip -d tf_bin' install: - "curl https://bootstrap.pypa.io/ez_setup.py -o - | python"