Documentation
¶
Overview ¶
Package servicetest runs the Blitz service in a test, for packages outside the service that test against it (the client, the CLI, the desktop app). Only tests may use it.
Index ¶
- func New(open func(ctx context.Context, dir string) (*engine.Workspace, error)) *server.Server
- func Run(ctx context.Context, socket string) error
- func RunWith(ctx context.Context, socket, config string, run RunOverrides) error
- func Serve(ctx context.Context, l net.Listener, h http.Handler, grace time.Duration) error
- func Stopped(t interface{ ... }, done <-chan struct{}, limit time.Duration)
- type RunOverrides
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns a service whose workspaces open, and whose Handler serves the API, with open (typically a workspace on a mock model).
func Run ¶
Run runs the whole service, as blitzd does, on socket with the default configuration, until ctx is done.
func RunWith ¶
func RunWith(ctx context.Context, socket, config string, run RunOverrides) error
RunWith runs a private service, as a client starts for a run of its own, on socket, with the configuration file config ("" for the usual search) and the run's settings, until ctx is done.
func Stopped ¶
func Stopped(t interface {
Helper()
Fatalf(format string, args ...any)
}, done <-chan struct{}, limit time.Duration)
Stopped waits for done (a service's Run returning) for up to limit, and otherwise reports every goroutine's stack and fails the test: a service that won't stop says where it's stuck, rather than the test hanging until its timeout.
Types ¶
type RunOverrides ¶
type RunOverrides = service.RunOverrides
RunOverrides are a private service's run settings (blitzd's hidden flags, which the CLI sets for a run of its own).