servicetest

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(open func(ctx context.Context, dir string) (*engine.Workspace, error)) *server.Server

New returns a service whose workspaces open, and whose Handler serves the API, with open (typically a workspace on a mock model).

func Run

func Run(ctx context.Context, socket string) error

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 Serve

func Serve(ctx context.Context, l net.Listener, h http.Handler, grace time.Duration) error

Serve serves h on l until ctx is done, as the service does.

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).

Jump to

Keyboard shortcuts

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