Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestServerFor ¶
func TestServerFor[TServer any, TClient any](logger logger.Logger, registersvc func(*grpc.Server, TServer), clientFactory func(grpc.ClientConnInterface) TClient) func(svc TServer) (client TClient, cleanup func(), err error)
TestServerFor returns a grpcServer factory that bootstraps a grpcserver backed by a buf connection (in memory), and returns the the given clientFactory instance to communicate with it. it also provides cleanup function for close the grpcserver and client connection.
usage,
serverFactory := testingGrpc.TestServerFor(testLogger, func(s *grpc.Server, svc *your_service_goes_here) {
proto.RegisterMyService(s, svc) // your service
}, proto.NewMyServiceClient)
client, cleanup, err := serverFactory(&your_service{})
require.NoError(t, err)
defer cleanup()
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.