Help us shape the future of Go! Take the 2026 Go Developer Survey

servicefixture

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package servicefixture is the HTTP service the service-integration tests run: an application with a route of its own that mounts the MCP handler behind the estate transport and a transit chain, under one controls controller, the way spec 0001 D7 requires of a real service. It is evidence for that shape, not an example to copy into a consumer.

Index

Constants

View Source
const (
	ReaderKey = "reader-key"
	WriterKey = "writer-key"
	KeyHeader = "X-API-Key"
	Path      = "/mcp"
	AppPath   = "/app/whoami"
)

The two API keys the service accepts, and the subjects they establish.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Logger         *slog.Logger
	ShutdownBudget time.Duration
	BodyLimit      int64
	TrustedOrigins []string
	// Middleware follows authentication in the chain, so a test can break the
	// response stream from where a real middleware would.
	Middleware []transithttp.Middleware
}

Options configure one service instance. Zero values take the defaults a service would: the transport's body limit and a five-second shutdown budget.

type Service

type Service struct {
	Controller *controls.Controller
	MCP        *server.Server
	Addr       string
	Records    atomic.Int64
	Entered    chan struct{}
	Ended      chan error
}

Service is one running instance. Records counts fixture.record executions; Entered and Ended observe each fixture.wait from outside.

func Start

func Start(ctx context.Context, opts Options) (*Service, error)

Start builds the service and runs it under its controller, returning once the listener accepts connections.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

Stop drives the controller's graceful shutdown and waits for it within ctx.

Jump to

Keyboard shortcuts

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