Skip to content

Commit

Permalink
fix(server): Use cmp.Diff instead of assert.Equal
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
johanbrandhorst committed Aug 8, 2022
1 parent 3809d50 commit 162c8a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/auth/oidc/repository_auth_method_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()))
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/server/repository_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 162c8a8

Please sign in to comment.