Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Jan 13, 2025
1 parent 95ebdb9 commit e3522bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
3 changes: 2 additions & 1 deletion server/v2/api/grpc/gogoreflection/serverreflection.go
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,8 @@ func (s *serverReflectionServer) getServices(messages []string) (svcs []string,

svc, ok := findServiceForMessage(registry, md.(protoreflect.MessageDescriptor))
if !ok {
s.log.Warn(fmt.Sprintf("unable to find service for message %s", messageName))
// if a service is not found for the message, simply skip
// this is likely the message isn't part of a service and using appmodulev2.Handler instead.
continue
}

Expand Down
16 changes: 4 additions & 12 deletions tests/systemtests/grpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,23 @@ import (
systest "cosmossdk.io/systemtests"
)

func TestGRPCReflection(t *testing.T) {
func TestGRPC(t *testing.T) {
systest.Sut.ResetChain(t)
systest.Sut.StartChain(t)

ctx := context.Background()
grpcClient, err := grpc.NewClient("localhost:9090", grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)
defer grpcClient.Close()

// test grpc reflection
descSource := grpcurl.DescriptorSourceFromServer(ctx, grpcreflect.NewClientAuto(ctx, grpcClient))
services, err := grpcurl.ListServices(descSource)
require.NoError(t, err)
require.Greater(t, len(services), 0)
require.Contains(t, services, "cosmos.staking.v1beta1.Query")
}

func TestGRPCQuery(t *testing.T) {
systest.Sut.ResetChain(t)
systest.Sut.StartChain(t)

ctx := context.Background()
grpcClient, err := grpc.NewClient("localhost:9090", grpc.WithTransportCredentials(insecure.NewCredentials()))
require.NoError(t, err)

descSource := grpcurl.DescriptorSourceFromServer(ctx, grpcreflect.NewClientAuto(ctx, grpcClient))

// test query invokation
rf, formatter, err := grpcurl.RequestParserAndFormatter(grpcurl.FormatText, descSource, os.Stdin, grpcurl.FormatOptions{})
require.NoError(t, err)

Expand Down

0 comments on commit e3522bc

Please sign in to comment.