From 07b0101fb5203311165862c03c704acf839f7718 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 1 Aug 2017 18:13:04 -0400 Subject: [PATCH] update workspace new test for inmem backend The existing test assumed local state files. --- command/workspace_command_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/command/workspace_command_test.go b/command/workspace_command_test.go index 7611850a0..7baabbed5 100644 --- a/command/workspace_command_test.go +++ b/command/workspace_command_test.go @@ -249,7 +249,9 @@ func TestWorkspace_createWithState(t *testing.T) { t.Fatal(err) } - args := []string{"-state", "test.tfstate", "test"} + workspace := "test_workspace" + + args := []string{"-state", "test.tfstate", workspace} ui = new(cli.MockUi) newCmd := &WorkspaceNewCommand{ Meta: Meta{Ui: ui}, @@ -265,7 +267,14 @@ func TestWorkspace_createWithState(t *testing.T) { t.Fatal(err) } - newState := envState.State() + b := backend.TestBackendConfig(t, inmem.New(), nil) + sMgr, err := b.State(workspace) + if err != nil { + t.Fatal(err) + } + + newState := sMgr.State() + originalState.Version = newState.Version // the round-trip through the state manager implicitly populates version if !originalState.Equal(newState) { t.Fatalf("states not equal\norig: %s\nnew: %s", originalState, newState)