Package integration contains helpers for integration testing.
Normally users writing integration tests should not use this package directly, instead they should use the packges in subdirectories of this package.
- type Cmd
- type Option
- type SubtestRunner
Cmd is an external command being prepared or run.
A Cmd cannot be reused after calling its Run, Output or CombinedOutput methods.
New creates a new, unstarted, command.
The provided context is used to kill the process (by calling os.Process.Kill) if the context becomes done before the command completes on its own.
C2SListen returns a listener with a random port. The listener is created on the first call to C2SListener. Subsequent calls ignore the arguments and return the existing listener.
Close kills the command if it is still running and cleans up any temporary resources that were created.
ConfigDir returns the temporary directory used to store config files.
Dial attempts to connect to the server by dialing localhost and then negotiating a stream with the location set to the domainpart of j and the origin set to j.
Option is used to configure a Cmd.
Args sets additional command line args to be passed to the command.
Cert creates a private key and certificate with the given name.
Defer is an option that calls f the command is started.
func LogXML() Option
LogXML configures the command to log sent and received XML to the current testing.T.
Shutdown is run before the configuration is removed and is meant to gracefully shutdown the application in case it does not handle the kill signal correctly.
type SubtestRunner ¶
SubtestRunner is the signature of a function that can be used to start subtests.
Test starts a command and returns a function that runs tests as a subtest using t.Run. Multiple calls to the returned function will result in uniquely named subtests. When all subtests have completed, the daemon is stopped.