Skip to content

Commit

Permalink
Bump go.nhat.io/grpcmock to v0.22.0 (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhatthm authored Feb 6, 2023
1 parent 0fe9e6a commit b4e0abe
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 90 deletions.
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/stretchr/testify v1.8.1
github.com/swaggest/assertjson v1.7.0
go.nhat.io/grpcmock v0.21.0
google.golang.org/grpc v1.52.0
go.nhat.io/grpcmock v0.22.0
google.golang.org/grpc v1.52.3
google.golang.org/protobuf v1.28.1
)

Expand All @@ -17,7 +17,7 @@ require (
github.com/cucumber/gherkin-go/v19 v19.0.3 // indirect
github.com/cucumber/messages-go/v16 v16.0.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gofrs/uuid v4.3.1+incompatible // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-memdb v1.3.4 // indirect
Expand All @@ -33,6 +33,6 @@ require (
golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
google.golang.org/genproto v0.0.0-20230119192704-9d59e20e5cd1 // indirect
google.golang.org/genproto v0.0.0-20230202175211-008b39050e57 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,8 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.3.1+incompatible h1:0/KbAdpx3UXAx1kEOWHJeOkpbgRFGHVgv+CFIY7dBJI=
github.com/gofrs/uuid v4.3.1+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
Expand Down Expand Up @@ -647,8 +647,8 @@ github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.nhat.io/aferomock v0.4.0 h1:gs3nJzIqAezglUuaPfautAmZwulwRWLcfSSzdK4YCC0=
go.nhat.io/aferomock v0.4.0/go.mod h1:msi5MDOtJ/AroUa/lDc3jVGOILM4SKP//4yBRImOvkI=
go.nhat.io/grpcmock v0.21.0 h1:c/4bPNcFG7ybYCwmUjeiFwQAxd2nQUD5dFBAUuDo1v0=
go.nhat.io/grpcmock v0.21.0/go.mod h1:OQo4/jPW6AmJpe6QynuRihTrAKCFwjlSY+jUJED1omU=
go.nhat.io/grpcmock v0.22.0 h1:Mu4CakdN0tcuhreId3bs8tnPzkQbuaY6pi5T8Nf61kg=
go.nhat.io/grpcmock v0.22.0/go.mod h1:YWqc3YysAuRq3OnVWk9na3H3il7gaozdMREcFmFxTyw=
go.nhat.io/matcher/v2 v2.0.0 h1:W+rbHi0hKuZHtOQH4U5g+KwyKyfVioIxrxjoGRcUETE=
go.nhat.io/matcher/v2 v2.0.0/go.mod h1:cL5oYp0M9A4L8jEGqjmUfy+k7AXVDddoVt6aYIL1r5g=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
Expand Down Expand Up @@ -1133,8 +1133,8 @@ google.golang.org/genproto v0.0.0-20221114212237-e4508ebdbee1/go.mod h1:rZS5c/ZV
google.golang.org/genproto v0.0.0-20221117204609-8f9c96812029/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
google.golang.org/genproto v0.0.0-20221201164419-0e50fba7f41c/go.mod h1:rZS5c/ZVYMaOGBfO68GWtjOw/eLaZM1X6iVtgjZ+EWg=
google.golang.org/genproto v0.0.0-20230119192704-9d59e20e5cd1 h1:wSjSSQW7LuPdv3m1IrSN33nVxH/kID6OIKy+FMwGB2k=
google.golang.org/genproto v0.0.0-20230119192704-9d59e20e5cd1/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
google.golang.org/genproto v0.0.0-20230202175211-008b39050e57 h1:vArvWooPH749rNHpBGgVl+U9B9dATjiEhJzcWGlovNs=
google.golang.org/genproto v0.0.0-20230202175211-008b39050e57/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
Expand Down Expand Up @@ -1171,8 +1171,8 @@ google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCD
google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww=
google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk=
google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY=
google.golang.org/grpc v1.52.3 h1:pf7sOysg4LdgBqduXveGKrcEwbStiK2rtfghdzlUYDQ=
google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
Expand Down
17 changes: 8 additions & 9 deletions request_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"time"

"go.nhat.io/grpcmock/request"
"google.golang.org/grpc/codes"
)

Expand All @@ -20,11 +19,11 @@ type serverRequestPlanner interface {
}

type serverRequestReflectorPlanner struct {
request request.Request
expected expectation
}

func (s *serverRequestReflectorPlanner) WithHeader(header string, value interface{}) error {
expectServerRequestWithHeader(s.request, header, value)
s.expected.WithHeader(header, value)

return nil
}
Expand All @@ -34,20 +33,20 @@ func (s *serverRequestReflectorPlanner) WithTimeout(time.Duration) error {
}

func (s *serverRequestReflectorPlanner) Return(payload string) error { // nolint: unparam
setServerRequestReturn(s.request, payload)
s.expected.Return(payload)

return nil
}

func (s *serverRequestReflectorPlanner) ReturnError(code codes.Code, message string) error { // nolint: unparam
setServerRequestReturnError(s.request, code, message)
s.expected.ReturnError(code, message)

return nil
}

func newServerRequestPlanner(r request.Request) *serverRequestReflectorPlanner {
func newServerRequestPlanner(expected expectation) *serverRequestReflectorPlanner {
return &serverRequestReflectorPlanner{
request: r,
expected: expected,
}
}

Expand All @@ -60,8 +59,8 @@ func serverRequestPlannerFromContext(ctx context.Context) serverRequestPlanner {
return r
}

func newServerRequestPlannerContext(ctx context.Context, r request.Request) context.Context {
return requestPlannerToContext(ctx, newServerRequestPlanner(r))
func newServerRequestPlannerContext(ctx context.Context, expected expectation) context.Context {
return requestPlannerToContext(ctx, newServerRequestPlanner(expected))
}

type missingServerRequestPlanner struct{}
Expand Down
5 changes: 1 addition & 4 deletions request_server_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@ package grpcsteps

import (
"context"
"sync"
"testing"

"github.com/stretchr/testify/assert"
"go.nhat.io/grpcmock/request"
)

func TestServerRequestReflectorPlanner_WithTimeout(t *testing.T) {
t.Parallel()

r := request.NewUnaryRequest(&sync.Mutex{}, nil)
p := newServerRequestPlanner(r)
p := newServerRequestPlanner((*unaryExpectation)(nil))

err := p.WithTimeout(0)

Expand Down
Loading

0 comments on commit b4e0abe

Please sign in to comment.