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.
This commit is contained in:
James Bardin 2016-08-04 17:19:02 -04:00
parent 9d0faa2cae
commit d5fbb5f5c0

View File

@ -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},
}
}