Documentation ¶
Overview ¶
Package sendxmpp facilitates integration testing with sendxmpp.
Index ¶
- func ConfigFile(cfg Config) integration.Option
- func Debug() integration.Option
- func New(ctx context.Context, opts ...integration.Option) (*integration.Cmd, error)
- func Ping(cmd *integration.Cmd, to jid.JID) error
- func Raw() integration.Option
- func Send(cmd *integration.Cmd, s string) error
- func TLS() integration.Option
- func Test(ctx context.Context, t *testing.T, opts ...integration.Option) integration.SubtestRunner
- 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 sendxmpp 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 Debug ¶
func Debug() integration.Option
Debug enables debug logging for sendxmpp (logging must still be enabled using integration.Log). Using it multiple times increases the log level.
func New ¶
func New(ctx context.Context, opts ...integration.Option) (*integration.Cmd, error)
New creates a new, unstarted, sendxmpp running as a daemon using interactive mode.
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 Raw ¶
func Raw() integration.Option
Raw configures sendxmpp to send raw XML instead of messages.
func Send ¶
func Send(cmd *integration.Cmd, s string) error
Send transmits the given message (or xml, if the Raw option was used) over sendxmpp.
func Test ¶
func Test(ctx context.Context, t *testing.T, opts ...integration.Option) integration.SubtestRunner
Test starts a sendxmpp 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.