fixup some test comparisons

This commit is contained in:
James Bardin 2019-10-23 22:32:44 -04:00
parent 16b368e292
commit 886af20f07
2 changed files with 8 additions and 5 deletions

View File

@ -27,6 +27,8 @@ import (
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
) )
var equateEmpty = cmpopts.EquateEmpty()
func TestRefresh(t *testing.T) { func TestRefresh(t *testing.T) {
state := testState() state := testState()
statePath := testStateFile(t, state) statePath := testStateFile(t, state)
@ -626,8 +628,10 @@ func TestRefresh_disableBackup(t *testing.T) {
} }
newState := testStateRead(t, statePath) newState := testStateRead(t, statePath)
if !reflect.DeepEqual(newState, state) { if !cmp.Equal(state, newState, equateEmpty) {
t.Fatalf("bad: %#v", newState) spew.Config.DisableMethods = true
fmt.Println(cmp.Diff(state, newState, equateEmpty))
t.Fatalf("bad: %s", newState)
} }
newState = testStateRead(t, outPath) newState = testStateRead(t, outPath)

View File

@ -2980,9 +2980,8 @@ func TestContext2Apply_orphanResource(t *testing.T) {
s.SetResourceMeta(zeroAddr, states.EachList, providerAddr) s.SetResourceMeta(zeroAddr, states.EachList, providerAddr)
s.SetResourceMeta(oneAddr, states.EachList, providerAddr) s.SetResourceMeta(oneAddr, states.EachList, providerAddr)
s.SetResourceInstanceCurrent(oneAddr.Instance(addrs.IntKey(0)), &states.ResourceInstanceObjectSrc{ s.SetResourceInstanceCurrent(oneAddr.Instance(addrs.IntKey(0)), &states.ResourceInstanceObjectSrc{
Status: states.ObjectReady, Status: states.ObjectReady,
AttrsJSON: []byte(`{}`), AttrsJSON: []byte(`{}`),
Dependencies: []addrs.AbsResource{},
}, providerAddr) }, providerAddr)
}) })
if !cmp.Equal(state, want) { if !cmp.Equal(state, want) {