From d5fbb5f5c02e5048ce26c9e6db46fa46778d7f7b Mon Sep 17 00:00:00 2001 From: James Bardin Date: Thu, 4 Aug 2016 17:19:02 -0400 Subject: [PATCH] Modify the tfvars test to also use a cli var Modify the test to demonstrate where cli vars were being lost because they weren't interpreted as strings. --- command/push_test.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/command/push_test.go b/command/push_test.go index 60270169e1..8c6cfa923f 100644 --- a/command/push_test.go +++ b/command/push_test.go @@ -389,6 +389,8 @@ func TestPush_tfvars(t *testing.T) { args := []string{ "-var-file", path + "/terraform.tfvars", "-vcs=false", + "-var", + "bar=1", path, } if code := c.Run(args); code != 0 { @@ -412,12 +414,19 @@ func TestPush_tfvars(t *testing.T) { //now check TFVars tfvars := pushTFVars() + // update bar to match cli value + for i, v := range tfvars { + if v.Key == "bar" { + tfvars[i].Value = "1" + tfvars[i].IsHCL = true + } + } for i, expected := range tfvars { got := client.UpsertOptions.TFVars[i] if got != expected { t.Logf("%2d expected: %#v", i, expected) - t.Logf(" got: %#v", got) + t.Fatalf(" got: %#v", got) } } } @@ -589,9 +598,8 @@ func pushTFVars() []atlas.TFVar { {"baz", `{ A = "a" interp = "${file("t.txt")}" -} -`, true}, - {"fob", `["a", "quotes \"in\" quotes"]` + "\n", true}, +}`, true}, + {"fob", `["a", "quotes \"in\" quotes"]`, true}, {"foo", "bar", false}, } }