Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
fix http/grpc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
im-kulikov committed Jan 27, 2022
1 parent 61fb64c commit cf74f02
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion web/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func TestGRPCService(t *testing.T) {

(&gRPC{logger: log.Logger}).Stop(nil)
require.NoError(t, log.Decode())
require.EqualError(t, log, ErrEmptyGRPCServer.Error())
require.EqualError(t, log.Err(), ErrEmptyGRPCServer.Error())
})

t.Run("should fail on net.Listen", func(t *testing.T) {
Expand Down
14 changes: 11 additions & 3 deletions web/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,16 @@ func newTestLogger() *logger {
}
}

func (tl *logger) Error() string {
return tl.Result.E
func (tl *logger) Err() error {
if tl.Result == nil || tl.Result.E == "" {
return nil
}

return tl.Result
}

func (e testLogResult) Error() string {
return e.E
}

func (tl *logger) Cleanup() {
Expand Down Expand Up @@ -119,7 +127,7 @@ func TestHTTPService(t *testing.T) {

(&httpService{logger: log.Logger}).Stop(ctx)
require.NoError(t, log.Decode())
require.EqualError(t, log, ErrEmptyHTTPServer.Error())
require.EqualError(t, log.Err(), ErrEmptyHTTPServer.Error())
})

t.Run("should fail on net.Listen", func(t *testing.T) {
Expand Down

0 comments on commit cf74f02

Please sign in to comment.