Documentation

Overview

Package ejabberd facilitates integration testing against Ejabberd.

Index

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 Ejabberd config file.

func CreateUser

func CreateUser(ctx context.Context, addr, pass string) integration.Option

CreateUser returns an option that calls ejabberdctl 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 ejabberdctl with the provided args after the config has been written. It automatically points ejabberdctl at the config file path.

func New

func New(ctx context.Context, opts ...integration.Option) (*integration.Cmd, error)

New creates a new, unstarted, ejabberd 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

Test starts an Ejabberd instance and returns a function that runs f 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.

Types

type Config

type Config struct {
	VHosts    []string
	C2SSocket string
}

Config contains options that can be written to a Prosody config file.