mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Fix unit tests hopefully
This commit is contained in:
parent
9e341501b2
commit
5a884fd4c0
|
|
@ -68,6 +68,13 @@ func TestMain(m *testing.M) {
|
||||||
panic("can't create cache: " + err.Error())
|
panic("can't create cache: " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Create a temporary directory for JetStream.
|
||||||
|
d, err := ioutil.TempDir("./", "jetstream*")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
defer os.RemoveAll(d)
|
||||||
|
|
||||||
// Draw up just enough Dendrite config for the server key
|
// Draw up just enough Dendrite config for the server key
|
||||||
// API to work.
|
// API to work.
|
||||||
cfg := &config.Dendrite{}
|
cfg := &config.Dendrite{}
|
||||||
|
|
@ -75,6 +82,8 @@ func TestMain(m *testing.M) {
|
||||||
cfg.Global.ServerName = gomatrixserverlib.ServerName(s.name)
|
cfg.Global.ServerName = gomatrixserverlib.ServerName(s.name)
|
||||||
cfg.Global.PrivateKey = testPriv
|
cfg.Global.PrivateKey = testPriv
|
||||||
cfg.Global.JetStream.InMemory = true
|
cfg.Global.JetStream.InMemory = true
|
||||||
|
cfg.Global.JetStream.TopicPrefix = string(s.name[:1])
|
||||||
|
cfg.Global.JetStream.StoragePath = config.Path(d)
|
||||||
cfg.Global.KeyID = serverKeyID
|
cfg.Global.KeyID = serverKeyID
|
||||||
cfg.Global.KeyValidityPeriod = s.validity
|
cfg.Global.KeyValidityPeriod = s.validity
|
||||||
cfg.FederationAPI.Database.ConnectionString = config.DataSource("file::memory:")
|
cfg.FederationAPI.Database.ConnectionString = config.DataSource("file::memory:")
|
||||||
|
|
|
||||||
|
|
@ -74,10 +74,7 @@ func setupNATS(cfg *config.JetStream, nc *natsclient.Conn) (nats.JetStreamContex
|
||||||
logrus.WithError(err).Fatal("Unable to get stream info")
|
logrus.WithError(err).Fatal("Unable to get stream info")
|
||||||
}
|
}
|
||||||
if info == nil {
|
if info == nil {
|
||||||
// Define a default subject if not already specified.
|
|
||||||
if len(stream.Subjects) == 0 {
|
|
||||||
stream.Subjects = []string{name}
|
stream.Subjects = []string{name}
|
||||||
}
|
|
||||||
|
|
||||||
// If we're trying to keep everything in memory (e.g. unit tests)
|
// If we're trying to keep everything in memory (e.g. unit tests)
|
||||||
// then overwrite the storage policy.
|
// then overwrite the storage policy.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue