From 162c8a814645cf67b063fab7fcd96bdb89005275 Mon Sep 17 00:00:00 2001 From: Johan Brandhorst-Satzkorn Date: Mon, 8 Aug 2022 13:57:25 -0700 Subject: [PATCH] fix(server): Use cmp.Diff instead of assert.Equal Testify is not great at handling protobuf types, and was for some reason returning a diff here when in reality there is none. Switch to go-cmp for the comparison to remove the error. --- internal/auth/oidc/repository_auth_method_update_test.go | 2 +- internal/server/repository_worker_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/auth/oidc/repository_auth_method_update_test.go b/internal/auth/oidc/repository_auth_method_update_test.go index e3f8601a6d9..bd1506ba14b 100644 --- a/internal/auth/oidc/repository_auth_method_update_test.go +++ b/internal/auth/oidc/repository_auth_method_update_test.go @@ -1219,7 +1219,7 @@ func Test_applyUpdate(t *testing.T) { t.Run(tt.name, func(t *testing.T) { assert := assert.New(t) got := applyUpdate(tt.new, tt.orig, tt.fieldMask) - assert.Equal(got, tt.want) + assert.Empty(cmp.Diff(got, tt.want, protocmp.Transform())) }) } } diff --git a/internal/server/repository_worker_test.go b/internal/server/repository_worker_test.go index bb4fa2ef043..8949076fad4 100644 --- a/internal/server/repository_worker_test.go +++ b/internal/server/repository_worker_test.go @@ -940,7 +940,7 @@ func TestRepository_CreateWorker(t *testing.T) { } err = rw.LookupByPublicId(testCtx, found) require.NoError(err) - assert.Equal(got, found) + assert.Empty(cmp.Diff(got, found, protocmp.Transform())) if tc.fetchReq != nil { worker := &server.WorkerAuth{