test

package
v1.4.9 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: Apache-2.0 Imports: 15 Imported by: ? 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

Index

Constants

View Source
const Prefix = servertest.Prefix

Prefix is the path prefix for the API routes

Variables

This section is empty.

Functions

func Begin

func Begin(t *testing.T) (*pgqueue.Manager, context.Context)

Begin returns the shared test manager and a per-test context.

func End

func End(t *testing.T)

End releases the per-test context created by Begin.

func IsolatedManager added in v1.4.0

func IsolatedManager(t *testing.T, opts ...pgqueue.Opt) *pgqueue.Manager

IsolatedManager returns a new manager on a new, empty database schema, so that a test can make assertions about every object, which it cannot do with the shared manager as other tests also create objects. The manager's event loop is not run.

func Main

func Main(m *testing.M, setup func(*pgqueue.Manager) (func(), error), opts ...pgqueue.Opt)

Main initializes a PostgreSQL pool and manager before running the tests, and runs the manager's event loop while they run. If PGQUEUE_TEST_DATABASE_URL is set, it connects to that server; otherwise it starts a PostgreSQL container.

func Schema added in v1.4.0

func Schema() string

Schema returns the database schema used by the shared test manager, for tests which need to refer to its tables directly

Types

type Server added in v1.4.0

type Server = servertest.Server

Server is a HTTP test server of the pgqueue API, which is go-server's, so every request and response is checked against the OpenAPI specification when the test ends

func NewServer added in v1.4.0

func NewServer(t *testing.T, manager *pgqueue.Manager) *Server

NewServer starts a HTTP test server serving the pgqueue API for the manager. When the test ends the server is closed, and every recorded exchange is checked against the OpenAPI specification.

Jump to

Keyboard shortcuts

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