Browse Source

add test

pull/118/head
Meir Gabay 5 years ago
parent
commit
2e9fae23a5
  1. 12
      plugin_test.go

12
plugin_test.go

@ -9,6 +9,7 @@ import (
)
func TestPlugin(t *testing.T) {
os.Setenv("TEST_USER", "johndoe")
g := Goblin(t)
g.Describe("CopyTfEnv", func() {
@ -130,6 +131,11 @@ func TestPlugin(t *testing.T) {
args{config: Config{Vars: map[string]string{"username": "someuser", "password": "1pass"}}},
exec.Command("terraform", "destroy", "-var", "username=someuser", "-var", "password=1pass", "-force"),
},
{
"with vars as env vars",
args{config: Config{Vars: map[string]string{"testuser": "${TEST_USER}"}}},
exec.Command("terraform", "destroy", "-var", "testuser=johndoe", "-force"),
},
{
"with var-files",
args{config: Config{VarFiles: []string{"common.tfvars", "prod.tfvars"}}},
@ -191,6 +197,12 @@ func TestPlugin(t *testing.T) {
false,
exec.Command("terraform", "plan", "-out=plan.tfout", "-var", "username=someuser", "-var", "password=1pass"),
},
{
"with vars as env vars",
args{config: Config{Vars: map[string]string{"testuser": "${TEST_USER}"}}},
false,
exec.Command("terraform", "plan", "-out=plan.tfout", "-var", "testuser=johndoe"),
},
{
"with var-files",
args{config: Config{VarFiles: []string{"common.tfvars", "prod.tfvars"}}},

Loading…
Cancel
Save