package grpc_testing
import "github.com/grpc-ecosystem/go-grpc-middleware/testing"
Index ¶
- Constants
- type InterceptorTestSuite
- func (s *InterceptorTestSuite) DeadlineCtx(deadline time.Time) context.Context
- func (s *InterceptorTestSuite) NewClient(dialOpts ...grpc.DialOption) pb_testproto.TestServiceClient
- func (s *InterceptorTestSuite) ServerAddr() string
- func (s *InterceptorTestSuite) SetupSuite()
- func (s *InterceptorTestSuite) SimpleCtx() context.Context
- func (s *InterceptorTestSuite) TearDownSuite()
- type MutexReadWriter
- func NewMutexReadWriter(rw io.ReadWriter) *MutexReadWriter
- func (m *MutexReadWriter) Read(p []byte) (int, error)
- func (m *MutexReadWriter) Write(p []byte) (int, error)
- type TestPingService
- func (s *TestPingService) Ping(ctx context.Context, ping *pb_testproto.PingRequest) (*pb_testproto.PingResponse, error)
- func (s *TestPingService) PingEmpty(ctx context.Context, _ *pb_testproto.Empty) (*pb_testproto.PingResponse, error)
- func (s *TestPingService) PingError(ctx context.Context, ping *pb_testproto.PingRequest) (*pb_testproto.Empty, error)
- func (s *TestPingService) PingList(ping *pb_testproto.PingRequest, stream pb_testproto.TestService_PingListServer) error
- func (s *TestPingService) PingStream(stream pb_testproto.TestService_PingStreamServer) error
Constants ¶
const ( // DefaultPongValue is the default value used. DefaultResponseValue = "default_response_value" // ListResponseCount is the expeted number of responses to PingList ListResponseCount = 100 )
Types ¶
type InterceptorTestSuite ¶
type InterceptorTestSuite struct { suite.Suite TestService pb_testproto.TestServiceServer ServerOpts []grpc.ServerOption ClientOpts []grpc.DialOption ServerListener net.Listener Server *grpc.Server Client pb_testproto.TestServiceClient // contains filtered or unexported fields }
InterceptorTestSuite is a testify/Suite that starts a gRPC PingService server and a client.
func (*InterceptorTestSuite) DeadlineCtx ¶
func (s *InterceptorTestSuite) DeadlineCtx(deadline time.Time) context.Context
func (*InterceptorTestSuite) NewClient ¶
func (s *InterceptorTestSuite) NewClient(dialOpts ...grpc.DialOption) pb_testproto.TestServiceClient
func (*InterceptorTestSuite) ServerAddr ¶
func (s *InterceptorTestSuite) ServerAddr() string
func (*InterceptorTestSuite) SetupSuite ¶
func (s *InterceptorTestSuite) SetupSuite()
func (*InterceptorTestSuite) SimpleCtx ¶
func (s *InterceptorTestSuite) SimpleCtx() context.Context
func (*InterceptorTestSuite) TearDownSuite ¶
func (s *InterceptorTestSuite) TearDownSuite()
type MutexReadWriter ¶
MutexReadWriter is a io.ReadWriter that can be read and worked on from multiple go routines.
func NewMutexReadWriter ¶
func NewMutexReadWriter(rw io.ReadWriter) *MutexReadWriter
NewMutexReadWriter creates a new thread-safe io.ReadWriter.
func (*MutexReadWriter) Read ¶
func (m *MutexReadWriter) Read(p []byte) (int, error)
Read implements the io.Reader interface.
func (*MutexReadWriter) Write ¶
func (m *MutexReadWriter) Write(p []byte) (int, error)
Write implements the io.Writer interface.
type TestPingService ¶
func (*TestPingService) Ping ¶
func (s *TestPingService) Ping(ctx context.Context, ping *pb_testproto.PingRequest) (*pb_testproto.PingResponse, error)
func (*TestPingService) PingEmpty ¶
func (s *TestPingService) PingEmpty(ctx context.Context, _ *pb_testproto.Empty) (*pb_testproto.PingResponse, error)
func (*TestPingService) PingError ¶
func (s *TestPingService) PingError(ctx context.Context, ping *pb_testproto.PingRequest) (*pb_testproto.Empty, error)
func (*TestPingService) PingList ¶
func (s *TestPingService) PingList(ping *pb_testproto.PingRequest, stream pb_testproto.TestService_PingListServer) error
func (*TestPingService) PingStream ¶
func (s *TestPingService) PingStream(stream pb_testproto.TestService_PingStreamServer) error
Source Files ¶
interceptor_suite.go mutex_readerwriter.go pingservice.go
Directories ¶
Path | Synopsis |
---|---|
testing/gogotestproto | Package mwitkow_testproto is a generated protocol buffer package. |
testing/testproto | Package mwitkow_testproto is a generated protocol buffer package. |
- Version
- v1.0.0
- Published
- May 2, 2018
- Platform
- windows/amd64
- Imports
- 15 packages
- Last checked
- 3 hours ago –
Tools for package owners.