grpctest

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package grpctest runs a small in-process gRPC server for tests in other packages. It serves the standard health service, which has real message types, and it can offer server reflection or not.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// Addr is host:port.
	Addr string
	// contains filtered or unexported fields
}

Server is a running test server.

func Start

func Start(t *testing.T, reflect bool) *Server

Start serves grpc.health.v1.Health on localhost. The service "up" is SERVING and "down" is NOT_SERVING. The empty name is SERVING. Any other name answers NotFound. With reflection true the server also offers server reflection. The server stops when the test ends.

func StartAlphaOnly

func StartAlphaOnly(t *testing.T) *Server

StartAlphaOnly is Start with reflection, but only the older v1alpha protocol, as some servers still offer.

func (*Server) LastHeader

func (s *Server) LastHeader(key string) (string, bool)

LastHeader returns the last value the server saw for a metadata key, and whether it saw one.

Jump to

Keyboard shortcuts

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