Documentation
¶
Overview ¶
Package service runs the background processes a scenario declares under `services`: a long-lived peer (a TCP server, an API stub) started before the scenario's steps and torn down — with its whole process group — when the scenario ends. It reuses the command runner's tokenization and environment handling so a service spawns identically to a run step.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Proc ¶
type Proc struct {
// contains filtered or unexported fields
}
Proc is a running background service. Stop terminates it and its children.
func Start ¶
Start spawns svc in workdir and blocks until its readiness probe passes. The returned captured value is the trimmed content of the ready file when Ready.File and Ready.Store are both set (otherwise ""); the caller stores it as ${Ready.Store}. On any error the (partially started) process is stopped before returning.
func (*Proc) Output ¶
Output returns whatever the service has written to stdout/stderr so far. It is used to enrich a readiness failure message.
func (*Proc) Signal ¶ added in v0.3.0
Signal delivers the named POSIX signal (TERM, INT, HUP, USR1, USR2, KILL) to the service's whole process group (#23), consistent with the teardown kill semantics. Signaling a service that already exited is an error naming the service — a graceful-shutdown spec that signals a dead process is asserting against nothing.
func (*Proc) Stop ¶
func (p *Proc) Stop()
Stop terminates the service's process group: a graceful signal first, then a hard kill if it does not exit within a short grace period. It is safe to call once; subsequent calls are no-ops because the process has already exited.