command: Fix a few tests from meta_backend_test.go

This commit is contained in:
Martin Atkins 2018-10-14 17:10:45 -07:00
parent 86b7963bba
commit 8b466811d2
2 changed files with 29 additions and 5 deletions

View File

@ -1449,9 +1449,17 @@ func TestMetaBackend_planLocal(t *testing.T) {
defer os.RemoveAll(td)
defer testChdir(t, td)()
backendConfigBlock := cty.ObjectVal(map[string]cty.Value{
"path": cty.NullVal(cty.String),
"workspace_dir": cty.NullVal(cty.String),
})
backendConfigRaw, err := plans.NewDynamicValue(backendConfigBlock, backendConfigBlock.Type())
if err != nil {
t.Fatal(err)
}
backendConfig := plans.Backend{
Type: "local",
Config: plans.DynamicValue("{}"),
Config: backendConfigRaw,
Workspace: "default",
}
@ -1534,9 +1542,17 @@ func TestMetaBackend_planLocalStatePath(t *testing.T) {
original := testState()
mark := markStateForMatching(original, "hello")
backendConfigBlock := cty.ObjectVal(map[string]cty.Value{
"path": cty.NullVal(cty.String),
"workspace_dir": cty.NullVal(cty.String),
})
backendConfigRaw, err := plans.NewDynamicValue(backendConfigBlock, backendConfigBlock.Type())
if err != nil {
t.Fatal(err)
}
backendConfig := plans.Backend{
Type: "local",
Config: plans.DynamicValue("{}"),
Config: backendConfigRaw,
Workspace: "default",
}
@ -1544,7 +1560,7 @@ func TestMetaBackend_planLocalStatePath(t *testing.T) {
statePath := "foo.tfstate"
// put a initial state there that needs to be backed up
err := (statemgr.NewFilesystem(statePath)).WriteState(original)
err = (statemgr.NewFilesystem(statePath)).WriteState(original)
if err != nil {
t.Fatal(err)
}
@ -1627,9 +1643,17 @@ func TestMetaBackend_planLocalMatch(t *testing.T) {
defer os.RemoveAll(td)
defer testChdir(t, td)()
backendConfigBlock := cty.ObjectVal(map[string]cty.Value{
"path": cty.NullVal(cty.String),
"workspace_dir": cty.NullVal(cty.String),
})
backendConfigRaw, err := plans.NewDynamicValue(backendConfigBlock, backendConfigBlock.Type())
if err != nil {
t.Fatal(err)
}
backendConfig := plans.Backend{
Type: "local",
Config: plans.DynamicValue("{}"),
Config: backendConfigRaw,
Workspace: "default",
}

View File

@ -1,5 +1,5 @@
terraform {
backend "local" {
environment_dir = "envdir-new"
workspace_dir = "envdir-new"
}
}