Skip to content

Commit

Permalink
test(store): fix flaky test due to inconsistent slice (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
rahmatrhd authored Feb 14, 2023
1 parent 0789fa1 commit 575dfc7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/store/postgres/resource_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,11 @@ func (s *ResourceRepositoryTestSuite) TestFind() {
actualResult, actualError := s.repository.Find(context.Background(), tc.filters)

s.NoError(actualError)
if diff := cmp.Diff(tc.expectedResult, actualResult, cmpopts.EquateApproxTime(time.Microsecond)); diff != "" {
options := []cmp.Option{
cmpopts.EquateApproxTime(time.Microsecond),
cmpopts.SortSlices(func(a, b *domain.Resource) bool { return a.ID < b.ID }),
}
if diff := cmp.Diff(tc.expectedResult, actualResult, options...); diff != "" {
s.T().Errorf("result not match, diff: %v", diff)
}
})
Expand Down

0 comments on commit 575dfc7

Please sign in to comment.