grpc

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 5 Imported by: 0

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

View Source
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

func ShutdownGrpcServer(grpcServer *grpc.Server)

shutdownGrpcServer shuts down the gRPC server.

Types

type RegisterServerFunc

type RegisterServerFunc = func(*grpc.Server) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL