diff options
author | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-28 16:41:44 +0300 |
---|---|---|
committer | Patrick Steinhardt <psteinhardt@gitlab.com> | 2023-09-28 16:41:44 +0300 |
commit | ab735ed7ce28d22b43a2258bdafea8f09970a32a (patch) | |
tree | 702d3a57df0160be94e325c964858d03a6d6d761 | |
parent | 8e9a11bede2d946964dc9a58c5e28952dc78ea86 (diff) | |
parent | 588d0ff6aae2b9823ab5632cc36c41821ab37497 (diff) |
Merge branch 'toon-various-fixes' into 'master'
testhelper: Various fixes
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/6420
Merged-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Approved-by: karthik nayak <knayak@gitlab.com>
Approved-by: Patrick Steinhardt <psteinhardt@gitlab.com>
Co-authored-by: Toon Claes <toon@gitlab.com>
-rw-r--r-- | internal/testhelper/grpc.go | 5 | ||||
-rw-r--r-- | internal/testhelper/logger.go | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/internal/testhelper/grpc.go b/internal/testhelper/grpc.go index 6831b55bd..7a89eb571 100644 --- a/internal/testhelper/grpc.go +++ b/internal/testhelper/grpc.go @@ -45,7 +45,10 @@ func ProtoEqual(tb testing.TB, expected, actual interface{}, opts ...cmp.Option) tb.Helper() opts = append(opts, protocmp.Transform(), cmpopts.EquateErrors()) - require.Empty(tb, cmp.Diff(expected, actual, opts...)) + diff := cmp.Diff(expected, actual, opts...) + if len(diff) > 0 { + require.Fail(tb, fmt.Sprintf("Protobufs not equal\nDiff: %v", diff)) + } } // RequireGrpcCode asserts that the error has the expected gRPC status code. diff --git a/internal/testhelper/logger.go b/internal/testhelper/logger.go index 8e47d4ec1..e082c029c 100644 --- a/internal/testhelper/logger.go +++ b/internal/testhelper/logger.go @@ -82,7 +82,7 @@ func NewLogger(tb testing.TB, options ...LoggerOption) log.LogrusLogger { } tb.Cleanup(func() { - if !tb.Failed() { + if !tb.Failed() || logOutput.Len() == 0 { return } |