mirror of https://github.com/dapr/go-sdk.git
Expose base grpcclient over client interface (#272)
Signed-off-by: Paul Thiele <thielepaul@gmail.com>
This commit is contained in:
parent
247a506004
commit
885ee8d326
|
@ -166,6 +166,9 @@ type Client interface {
|
|||
|
||||
// ImplActorClientStub is to impl user defined actor client stub
|
||||
ImplActorClientStub(actorClientStub actor.Client, opt ...config.Option)
|
||||
|
||||
// GrpcClient returns the base grpc client if grpc is used and nil otherwise
|
||||
GrpcClient() pb.DaprClient
|
||||
}
|
||||
|
||||
// NewClient instantiates Dapr client using DAPR_GRPC_PORT environment variable as port.
|
||||
|
@ -308,3 +311,8 @@ func (c *GRPCClient) Shutdown(ctx context.Context) error {
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GrpcClient returns the base grpc client.
|
||||
func (c *GRPCClient) GrpcClient() pb.DaprClient {
|
||||
return c.protoClient
|
||||
}
|
||||
|
|
|
@ -415,3 +415,9 @@ func (s *testDaprServer) UnsubscribeConfigurationAlpha1(ctx context.Context, in
|
|||
delete(s.configurationSubscriptionID, in.Id)
|
||||
return &pb.UnsubscribeConfigurationResponse{Ok: true}, nil
|
||||
}
|
||||
|
||||
func TestGrpcClient(t *testing.T) {
|
||||
protoClient := pb.NewDaprClient(nil)
|
||||
client := &GRPCClient{protoClient: protoClient}
|
||||
assert.Equal(t, protoClient, client.GrpcClient())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue