testing

package
v3.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2022 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package testing contains a test fixture for working with gRPC over HTTP/2.

Index

Constants

This section is empty.

Variables

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

Functions

This section is empty.

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

func (f *Fixture) Close() error

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

Sum handles TestService.Sum RPCs.

Jump to

Keyboard shortcuts

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