Skip to content

Commit

Permalink
test(abciclient): TestRoutedClientGrpc
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Feb 15, 2024
1 parent 707d86e commit c6cc0a3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions abci/client/routed_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"fmt"
"sync"
"testing"
"time"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
Expand Down Expand Up @@ -119,3 +120,25 @@ func startApp(ctx context.Context, t *testing.T, logger log.Logger, id string) (

return app, addr
}

// / TestRoutedClientGrpc tests the RoutedClient correctly forwards requests to a gRPC server.
func TestRoutedClientGrpc(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 100*time.Millisecond)
defer cancel()

logger := log.NewTestingLogger(t)

app := types.NewBaseApplication()
grpcServer := server.NewGRPCServer(logger, "tcp://127.0.0.1:1234", app)
require.NoError(t, grpcServer.Start(ctx))

addr := "*:grpc:tcp://127.0.0.1:1234"
logger.Info("configuring routed abci client with address", "addr", addr)
client, err := abciclient.NewRoutedClientWithAddr(logger, addr, true)
require.NoError(t, err)
require.NoError(t, client.Start(ctx))

_, err = client.Info(ctx, &types.RequestInfo{})
assert.NoError(t, err)

}

0 comments on commit c6cc0a3

Please sign in to comment.