Skip to main content

Crate expectation_service

Crate expectation_service 

Source
Expand description

External things a test needs: a server, a database, a container. The suite names what it needs and the harness starts it, once for the run, in the order the tests ask, stops it when the run is over, and starts it again if it died on the way. What cannot be had on this machine is not a failure: the tests that need it are “not supported yet”, with how to get it.

A Service says whether it can run here (Service::unavailable) and how to start (Service::start), which gives a Running that stops when it is dropped. There are providers for a Command (a program, ready when a port answers) and a Docker container (built from a directory if its image is not there), and a Fallback takes the first of several that is available: a native build, else a container. A database is a container.

No dependencies beyond the standard library.

Structs§

Command
A program run for the duration of a test run.
Docker
A Docker container: its image is built from a directory when it is not there, it runs detached, and it is removed when it stops. A database for the tests is one of these.
Fallback
One service, made of several ways to have it: the first that can run here runs.
Present
Something that must be there but is not ours to start: a build of a program, a data file. It is available when it exists; starting it is nothing, and it is at its path.
Services
The services of a run: those that are known, and those that are up.

Enums§

Ready
How to tell that a started service is ready to be used.

Traits§

Running
A started service. Dropping it stops it.
Service
Something that can be started for a test run.