command: fix failing tests

This commit is contained in:
Mitchell Hashimoto 2014-09-18 18:16:09 -06:00
parent 5ef46b797b
commit 91eb3c73fc
3 changed files with 25 additions and 13 deletions

View File

@ -438,8 +438,10 @@ func TestApply_refresh(t *testing.T) {
t.Fatalf("err: %s", err)
}
if !reflect.DeepEqual(backupState, originalState) {
t.Fatalf("bad: %#v", backupState)
actualStr := strings.TrimSpace(backupState.String())
expectedStr := strings.TrimSpace(originalState.String())
if actualStr != expectedStr {
t.Fatalf("bad:\n\n%s\n\n%s", actualStr, expectedStr)
}
}
@ -627,8 +629,10 @@ func TestApply_state(t *testing.T) {
// nil out the ConnInfo since that should not be restored
originalState.RootModule().Resources["test_instance.foo"].Primary.Ephemeral.ConnInfo = nil
if !reflect.DeepEqual(backupState, originalState) {
t.Fatalf("bad: %#v", backupState)
actualStr := strings.TrimSpace(backupState.String())
expectedStr := strings.TrimSpace(originalState.String())
if actualStr != expectedStr {
t.Fatalf("bad:\n\n%s\n\n%s", actualStr, expectedStr)
}
}

View File

@ -4,7 +4,6 @@ import (
"io/ioutil"
"os"
"path/filepath"
"reflect"
"strings"
"testing"
@ -98,10 +97,13 @@ func TestPlan_destroy(t *testing.T) {
t.Fatalf("err: %s", err)
}
if !reflect.DeepEqual(backupState, originalState) {
t.Fatalf("bad: %#v", backupState)
actualStr := strings.TrimSpace(backupState.String())
expectedStr := strings.TrimSpace(originalState.String())
if actualStr != expectedStr {
t.Fatalf("bad:\n\n%s\n\n%s", actualStr, expectedStr)
}
}
func TestPlan_noState(t *testing.T) {
p := testProvider()
ui := new(cli.MockUi)
@ -493,8 +495,10 @@ func TestPlan_backup(t *testing.T) {
t.Fatalf("err: %s", err)
}
if !reflect.DeepEqual(backupState, originalState) {
t.Fatalf("bad: %#v", backupState)
actualStr := strings.TrimSpace(backupState.String())
expectedStr := strings.TrimSpace(originalState.String())
if actualStr != expectedStr {
t.Fatalf("bad:\n\n%s\n\n%s", actualStr, expectedStr)
}
}

View File

@ -297,8 +297,10 @@ func TestRefresh_outPath(t *testing.T) {
t.Fatalf("err: %s", err)
}
if !reflect.DeepEqual(backupState, state) {
t.Fatalf("bad: %#v", backupState)
actualStr := strings.TrimSpace(backupState.String())
expectedStr := strings.TrimSpace(state.String())
if actualStr != expectedStr {
t.Fatalf("bad:\n\n%s\n\n%s", actualStr, expectedStr)
}
}
@ -498,8 +500,10 @@ func TestRefresh_backup(t *testing.T) {
t.Fatalf("err: %s", err)
}
if !reflect.DeepEqual(backupState, state) {
t.Fatalf("bad: %#v", backupState)
actualStr := strings.TrimSpace(backupState.String())
expectedStr := strings.TrimSpace(state.String())
if actualStr != expectedStr {
t.Fatalf("bad:\n\n%s\n\n%s", actualStr, expectedStr)
}
}