From 886af20f07f01af20e0c8746b18e288e33a87ec2 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Wed, 23 Oct 2019 22:32:44 -0400 Subject: [PATCH] fixup some test comparisons --- command/refresh_test.go | 8 ++++++-- terraform/context_apply_test.go | 5 ++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/command/refresh_test.go b/command/refresh_test.go index 68c1fb748..acbb68c4a 100644 --- a/command/refresh_test.go +++ b/command/refresh_test.go @@ -27,6 +27,8 @@ import ( "github.com/hashicorp/terraform/terraform" ) +var equateEmpty = cmpopts.EquateEmpty() + func TestRefresh(t *testing.T) { state := testState() statePath := testStateFile(t, state) @@ -626,8 +628,10 @@ func TestRefresh_disableBackup(t *testing.T) { } newState := testStateRead(t, statePath) - if !reflect.DeepEqual(newState, state) { - t.Fatalf("bad: %#v", newState) + if !cmp.Equal(state, newState, equateEmpty) { + spew.Config.DisableMethods = true + fmt.Println(cmp.Diff(state, newState, equateEmpty)) + t.Fatalf("bad: %s", newState) } newState = testStateRead(t, outPath) diff --git a/terraform/context_apply_test.go b/terraform/context_apply_test.go index 317369bcf..5df64f381 100644 --- a/terraform/context_apply_test.go +++ b/terraform/context_apply_test.go @@ -2980,9 +2980,8 @@ func TestContext2Apply_orphanResource(t *testing.T) { s.SetResourceMeta(zeroAddr, states.EachList, providerAddr) s.SetResourceMeta(oneAddr, states.EachList, providerAddr) s.SetResourceInstanceCurrent(oneAddr.Instance(addrs.IntKey(0)), &states.ResourceInstanceObjectSrc{ - Status: states.ObjectReady, - AttrsJSON: []byte(`{}`), - Dependencies: []addrs.AbsResource{}, + Status: states.ObjectReady, + AttrsJSON: []byte(`{}`), }, providerAddr) }) if !cmp.Equal(state, want) {