package testing
import "github.com/google/martian/v3/h2/testing"
Package testing contains a test fixture for working with gRPC over HTTP/2.
Index ¶
Variables ¶
var ( // CA is the certificate authority. It uses the Cybervillains key pair. CA *x509.Certificate // CAKey is the private key of the certificate authority. CAKey crypto.PrivateKey // RootCAs is a certificate pool containing `CA`. RootCAs *x509.CertPool // ClientTLS is a set of transport credentials to use with chains signed by `CA`. ClientTLS credentials.TransportCredentials // Localhost is a certificate for "localhost" signed by `CA`. Localhost *tls.Certificate )
Types ¶
type Fixture ¶
type Fixture struct { // TestServiceClient is a client pointing at the service and redirected through the proxy. tspb.TestServiceClient // contains filtered or unexported fields }
Fixture encapsulates the TestService gRPC server, a proxy and a gRPC client.
func New ¶
func New(spf []h2.StreamProcessorFactory) (*Fixture, error)
New creates a new instance of the Fixture. It is not possible for there to be more than one instance concurrently because clients decide whether to use the proxy based on the global HTTPS_PROXY environment variable.
func (*Fixture) Close ¶
Close cleans up the servers and connections.
type Server ¶
type Server struct { tspb.UnimplementedTestServiceServer }
Server is a testing gRPC server.
func (*Server) DoubleEcho ¶
func (s *Server) DoubleEcho(stream tspb.TestService_DoubleEchoServer) error
DoubleEcho handles TestService.DoubleEcho RPCs.
func (*Server) Echo ¶
func (s *Server) Echo(ctx context.Context, in *tspb.EchoRequest) (*tspb.EchoResponse, error)
Echo handles TestService.Echo RPCs.
func (*Server) Sum ¶
func (s *Server) Sum(_ context.Context, in *tspb.SumRequest) (*tspb.SumResponse, error)
Sum handles TestService.Sum RPCs.
Source Files ¶
certs.go fixture.go test_service.go
- Version
- v3.2.1
- Published
- May 19, 2021
- Platform
- windows/amd64
- Imports
- 25 packages
- Last checked
- 4 hours ago –
Tools for package owners.