Documentation
Overview ¶
Package prosody facilitates integration testing against Prosody.
Index ¶
- func ConfigFile(cfg Config) integration.Option
- func CreateUser(ctx context.Context, addr, pass string) integration.Option
- func Ctl(ctx context.Context, args ...string) integration.Option
- func New(ctx context.Context, opts ...integration.Option) (*integration.Cmd, error)
- func Test(ctx context.Context, t *testing.T, opts ...integration.Option) integration.SubtestRunner
- type Config
Constants ¶
Variables ¶
Functions ¶
func ConfigFile ¶
func ConfigFile(cfg Config) integration.Option
ConfigFile is an option that can be used to write a temporary Prosody config file.
func CreateUser ¶
func CreateUser(ctx context.Context, addr, pass string) integration.Option
CreateUser returns an option that calls prosodyctl to create a user. It is equivalent to calling: Ctl(ctx, "register", "localpart", "domainpart", "password").
func Ctl ¶
func Ctl(ctx context.Context, args ...string) integration.Option
Ctl returns an option that calls prosodyctl with the provided args. It automatically points prosodyctl at the config file so there is no need to pass the --config option.
func New ¶
func New(ctx context.Context, opts ...integration.Option) (*integration.Cmd, error)
New creates a new, unstarted, prosody daemon.
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.
func Test ¶
func Test(ctx context.Context, t *testing.T, opts ...integration.Option) integration.SubtestRunner
Test starts a Prosody instance and returns a function that runs subtests using t.Run. Multiple calls to the returned function will result in uniquely named subtests. When all subtests have completed, the daemon is stopped.