Documentation ¶
Index ¶
- Constants
- func CanonicalJSONInput(jsonData []string) []string
- func CreateBackgroundCommand(command string, args []string) (*exec.Cmd, chan error)
- func CreateDatabase(command string, args []string, database string) error
- func Defaulting(value, defaultValue string) string
- func InitDatabase(postgresDatabase, postgresContainerName string, databases []string)
- func ListenAndServe(t *testing.T, router http.Handler, useTLS bool) (apiURL string, cancel func())
- func MakeConfig(configDir, kafkaURI, database, host string, startPort int) (*config.Dendrite, int, error)
- func NewMatrixKey(matrixKeyPath string) (err error)
- func NewTLSKey(tlsKeyPath, tlsCertPath string) error
- func NewTLSKeyWithAuthority(...) error
- func StartProxy(bindAddr string, cfg *config.Dendrite) (*exec.Cmd, chan error)
- func UnsortedStringSliceEqual(first, second []string) bool
- func WriteConfig(cfg *config.Dendrite, configDir string) error
- type KafkaExecutor
- type LastRequestErr
- type NopJSONVerifier
- type Request
Constants ¶
const ( // ConfigFile is the name of the config file for a server. ConfigFile = "dendrite.yaml" // ServerKeyFile is the name of the file holding the matrix server private key. ServerKeyFile = "server_key.pem" // TLSCertFile is the name of the file holding the TLS certificate used for federation. TLSCertFile = "tls_cert.pem" // TLSKeyFile is the name of the file holding the TLS key used for federation. TLSKeyFile = "tls_key.pem" // MediaDir is the name of the directory used to store media. MediaDir = "media" )
Variables ¶
This section is empty.
Functions ¶
func CanonicalJSONInput ¶
CanonicalJSONInput canonicalises a slice of JSON strings Useful for test input
func CreateBackgroundCommand ¶
CreateBackgroundCommand creates an executable command The Cmd being executed is returned. A channel is also returned, which will have any termination errors sent down it, followed immediately by the channel being closed.
func CreateDatabase ¶
CreateDatabase creates a new database, dropping it first if it exists
func Defaulting ¶
Defaulting allows assignment of string variables with a fallback default value Useful for use with os.Getenv() for example
func InitDatabase ¶
InitDatabase creates the database and config file needed for the server to run
func ListenAndServe ¶
ListenAndServe will listen on a random high-numbered port and attach the given router. Returns the base URL to send requests to. Call `cancel` to shutdown the server, which will block until it has closed.
func MakeConfig ¶
func MakeConfig(configDir, kafkaURI, database, host string, startPort int) (*config.Dendrite, int, error)
MakeConfig makes a config suitable for running integration tests. Generates new matrix and TLS keys for the server.
func NewMatrixKey ¶
NewMatrixKey generates a new ed25519 matrix server key and writes it to a file.
func NewTLSKeyWithAuthority ¶ added in v0.6.1
func StartProxy ¶
StartProxy creates a reverse proxy
func UnsortedStringSliceEqual ¶
UnsortedStringSliceEqual returns true if the slices have same length & elements. Does not modify the given slice.
Types ¶
type KafkaExecutor ¶
type KafkaExecutor struct { // The location of Zookeeper. Typically this is `localhost:2181`. ZookeeperURI string // The directory where Kafka is installed to. Used to locate kafka scripts. KafkaDirectory string // The location of the Kafka logs. Typically this is `localhost:9092`. KafkaURI string // Where stdout and stderr should be written to. Typically this is `os.Stderr`. OutputWriter io.Writer }
KafkaExecutor executes kafka scripts.
func (*KafkaExecutor) CreateTopic ¶
func (e *KafkaExecutor) CreateTopic(topic string) error
CreateTopic creates a new kafka topic. This is created with a single partition.
func (*KafkaExecutor) DeleteTopic ¶
func (e *KafkaExecutor) DeleteTopic(topic string) error
DeleteTopic deletes a given kafka topic if it exists.
func (*KafkaExecutor) WriteToTopic ¶
func (e *KafkaExecutor) WriteToTopic(topic string, data []string) error
WriteToTopic writes data to a kafka topic.
type LastRequestErr ¶
LastRequestErr is a synchronised error wrapper Useful for obtaining the last error from a set of requests
type NopJSONVerifier ¶
type NopJSONVerifier struct { }
NopJSONVerifier is a JSONVerifier that verifies nothing and returns no errors.
func (*NopJSONVerifier) VerifyJSONs ¶
func (t *NopJSONVerifier) VerifyJSONs(ctx context.Context, requests []gomatrixserverlib.VerifyJSONRequest) ([]gomatrixserverlib.VerifyJSONResult, error)
type Request ¶
type Request struct { Req *http.Request WantedBody string WantedStatusCode int LastErr *LastRequestErr }
Request contains the information necessary to issue a request and test its result
func (*Request) DoUntilSuccess ¶
DoUntilSuccess blocks and repeats the same request until the response returns the desired status code and body. It then closes the given channel and returns.