Documentation ¶
Overview ¶
Package jackal facilitates integration testing against Jackal.
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 ListenC2S() integration.Option
- func Modules(mod ...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
- func VHost(hosts ...string) integration.Option
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigFile ¶
func ConfigFile(cfg Config) integration.Option
ConfigFile is an option that can be used to write a temporary config file. This will overwrite the existing config file and make most of the other options in this package noops. This option only exists for the rare occasion that you need complete control over the 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") except that it also configures the underlying Cmd to know about the user.
func Ctl ¶
func Ctl(ctx context.Context, args ...string) integration.Option
Ctl returns an option that calls jackalctl with the provided args. It automatically points jackalctl at the config file so there is no need to pass the --config option.
func ListenC2S ¶
func ListenC2S() integration.Option
ListenC2S listens for client-to-server (c2s) connections on a random port.
func Modules ¶
func Modules(mod ...string) integration.Option
Modules adds custom modules to the enabled modules list.
func New ¶
func New(ctx context.Context, opts ...integration.Option) (*integration.Cmd, error)
New creates a new, unstarted, jackal 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 Jackal instance and returns a function that runs subtests. Multiple calls to the returned function will result in uniquely named subtests. When all subtests have completed, the daemon is stopped.
func VHost ¶
func VHost(hosts ...string) integration.Option
VHost configures one or more virtual hosts. The default if this option is not provided is to create a single vhost called "localhost" and create a self-signed cert for it (if VHost is specified certs must be manually created).