Package prosody facilitates integration testing against Prosody.



    This section is empty.


    This section is empty.


    func Bidi

    func Bidi() integration.Option

      Bidi enables bidirectional S2S connections.

      func Component

      func Component(domain, secret string) integration.Option

        Component adds an external component with the given domain and secret to the config file.

        func ConfigFile

        func ConfigFile(cfg Config) integration.Option

          ConfigFile is an option that can be used to write a temporary Prosody 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 prosodyctl with the provided args. It automatically points prosodyctl at the config file so there is no need to pass the --config option.

              func HTTPS

              func HTTPS() integration.Option

                HTTPS configures prosody to listen for HTTP and HTTPS on two randomized ports and configures TLS certificates for localhost:https.

                func ListenC2S

                func ListenC2S() integration.Option

                  ListenC2S listens for client-to-server (c2s) connections on a random port.

                  func ListenS2S

                  func ListenS2S() integration.Option

                    ListenS2S listens for server-to-server (s2s) 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, 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 Set

                        func Set(key string, v interface{}) integration.Option

                          Set adds an extra key/value pair to the global section of the config file. If v is a string it will be quoted, otherwise it is marshaled using the %v formatting directive (see the fmt package for details). As a special case, if v is nil the key is written to the file directly with no equals sign.

                          -- Set("foo", "bar")
                          foo = "bar"
                          -- Set("foo", 123)
                          foo = 123
                          -- Set(`Component "" "muc"`, nil)
                          Component "" "muc"

                          func Test

                            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.

                            func TrustAll

                            func TrustAll() integration.Option

                              TrustAll configures prosody to trust all certificates presented to it without any verification.

                              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).

                                func WebSocket

                                func WebSocket() integration.Option

                                  WebSocket enables the websocket module. WebSocket implies the HTTPS() option.


                                  type Config

                                  type Config struct {
                                  	C2SPort   int
                                  	S2SPort   int
                                  	CompPort  int
                                  	HTTPPort  int
                                  	HTTPSPort int
                                  	Admins    []string
                                  	Modules   []string
                                  	VHosts    []string
                                  	Options   map[string]interface{}
                                  	Component map[string]string

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