Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
golang.org/x/sync v0.12.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4
google.golang.org/grpc v1.71.0
google.golang.org/grpc/examples v0.0.0-20250318070318-1703656ba59e
google.golang.org/protobuf v1.36.5
)

Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4 h1:
google.golang.org/genproto/googleapis/rpc v0.0.0-20250313205543-e70fdf4c4cb4/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I=
google.golang.org/grpc v1.71.0 h1:kF77BGdPTQ4/JZWMlb9VpJ5pa25aqvVqogsxNHHdeBg=
google.golang.org/grpc v1.71.0/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec=
google.golang.org/grpc/examples v0.0.0-20250318070318-1703656ba59e h1:KS7H8QNfKeIUnyj01PuYDiTzbTbTOFgGEXUYvb2ceZs=
google.golang.org/grpc/examples v0.0.0-20250318070318-1703656ba59e/go.mod h1:BWjVN7LHAUVWTr33vu7vpxeTcNdLSsRJhj1aesSeUmk=
google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM=
google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
18 changes: 9 additions & 9 deletions grpc_unwrap_interceptors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,32 @@ import (
"testing"

"github.com/pkg/errors"
"google.golang.org/grpc/codes"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/sync/errgroup"
"google.golang.org/grpc"
"google.golang.org/grpc/examples/helloworld/helloworld"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"

"github.com/ory/herodot/internal"
)

type testingGreeter struct {
helloworld.UnimplementedGreeterServer
internal.UnimplementedGreeterServer
shouldErr bool
}

func (g *testingGreeter) SayHello(context.Context, *helloworld.HelloRequest) (*helloworld.HelloReply, error) {
func (g *testingGreeter) SayHello(context.Context, *internal.HelloRequest) (*internal.HelloReply, error) {
if g.shouldErr {
return nil, errors.WithStack(ErrInternalServerError)
}
return &helloworld.HelloReply{Message: "see, no error"}, nil
return &internal.HelloReply{Message: "see, no error"}, nil
}

func TestGRPCInterceptors(t *testing.T) {
server := &testingGreeter{}
s := grpc.NewServer(grpc.UnaryInterceptor(UnaryErrorUnwrapInterceptor))
helloworld.RegisterGreeterServer(s, server)
internal.RegisterGreeterServer(s, server)
l, err := net.Listen("tcp", "127.0.0.1:0")
require.NoError(t, err)

Expand All @@ -45,7 +45,7 @@ func TestGRPCInterceptors(t *testing.T) {

conn, err := grpc.Dial(l.Addr().String(), grpc.WithInsecure())
require.NoError(t, err)
c := helloworld.NewGreeterClient(conn)
c := internal.NewGreeterClient(conn)

for _, tc := range []struct {
name string
Expand All @@ -63,7 +63,7 @@ func TestGRPCInterceptors(t *testing.T) {
t.Run("case="+tc.name, func(t *testing.T) {
server.shouldErr = tc.shouldErr

resp, err := c.SayHello(context.Background(), &helloworld.HelloRequest{})
resp, err := c.SayHello(context.Background(), &internal.HelloRequest{})
if tc.shouldErr {
assert.Equal(t, codes.Internal, status.Code(err))
} else {
Expand Down
209 changes: 209 additions & 0 deletions internal/helloworld.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading