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 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
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run runs the whole service, as blitzd does, on socket with the default configuration, until ctx is done.
func RunWith ¶ added in v0.3.1
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 ¶ added in v0.3.1
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 ¶ added in v0.3.1
type RunOverrides = daemon.RunOverrides
RunOverrides are a private service's run settings (blitzd's hidden flags, which the CLI sets for a run of its own).