Documentation
¶
Overview ¶
Package grpc in testhelpers provides a simple way to create a fake gRPC server. The fake gRPC server can be used to either test gRPC clients, or GCP resources. This package is used for testing purposes only.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidServerType = errors.New("invalid server type")
ErrInvalidServerType is returned when the server type is invalid.
Functions ¶
func SetupMockGrpcServer ¶
func SetupMockGrpcServer(registerServer RegisterServerFunc) (*grpc.Server, []option.ClientOption, error)
setupMockGrpcServer starts a mock gRPC server and returns the options to be passed on the client.
The function is generic and expects as a type, the type of the mock server.
For more information, see: https://github.com/googleapis/google-cloud-go/blob/main/testing.md#testing-grpc-services-using-fakes Also see the examples in the `examples/testhelpers/grpc` package.
func ShutdownGrpcServer ¶
shutdownGrpcServer shuts down the gRPC server.