mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-25 07:43:10 -06:00
Fix roomserver unit tests
This commit is contained in:
parent
8f54ab7f3b
commit
aec836e02b
|
|
@ -17,7 +17,10 @@ import (
|
||||||
"github.com/matrix-org/dendrite/internal/setup"
|
"github.com/matrix-org/dendrite/internal/setup"
|
||||||
"github.com/matrix-org/dendrite/internal/test"
|
"github.com/matrix-org/dendrite/internal/test"
|
||||||
"github.com/matrix-org/dendrite/roomserver/api"
|
"github.com/matrix-org/dendrite/roomserver/api"
|
||||||
|
"github.com/matrix-org/dendrite/roomserver/internal"
|
||||||
|
"github.com/matrix-org/dendrite/roomserver/storage"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
@ -160,7 +163,9 @@ func mustCreateRoomserverAPI(t *testing.T) (api.RoomserverInternalAPI, *dummyPro
|
||||||
cfg.Defaults()
|
cfg.Defaults()
|
||||||
cfg.Global.ServerName = testOrigin
|
cfg.Global.ServerName = testOrigin
|
||||||
cfg.Global.Kafka.UseNaffka = true
|
cfg.Global.Kafka.UseNaffka = true
|
||||||
cfg.RoomServer.Database.ConnectionString = config.DataSource(roomserverDBFileURI)
|
cfg.RoomServer.Database = config.DatabaseOptions{
|
||||||
|
ConnectionString: roomserverDBFileURI,
|
||||||
|
}
|
||||||
dp := &dummyProducer{
|
dp := &dummyProducer{
|
||||||
topic: cfg.Global.Kafka.TopicFor(config.TopicOutputRoomEvent),
|
topic: cfg.Global.Kafka.TopicFor(config.TopicOutputRoomEvent),
|
||||||
}
|
}
|
||||||
|
|
@ -172,8 +177,14 @@ func mustCreateRoomserverAPI(t *testing.T) (api.RoomserverInternalAPI, *dummyPro
|
||||||
Caches: cache,
|
Caches: cache,
|
||||||
Cfg: cfg,
|
Cfg: cfg,
|
||||||
}
|
}
|
||||||
|
roomserverDB, err := storage.Open(&cfg.RoomServer.Database, base.Caches)
|
||||||
return NewInternalAPI(base, &test.NopJSONVerifier{}), dp
|
if err != nil {
|
||||||
|
logrus.WithError(err).Panicf("failed to connect to room server db")
|
||||||
|
}
|
||||||
|
return internal.NewRoomserverAPI(
|
||||||
|
&cfg.RoomServer, roomserverDB, dp, string(cfg.Global.Kafka.TopicFor(config.TopicOutputRoomEvent)),
|
||||||
|
base.Caches, &test.NopJSONVerifier{}, nil,
|
||||||
|
), dp
|
||||||
}
|
}
|
||||||
|
|
||||||
func mustSendEvents(t *testing.T, ver gomatrixserverlib.RoomVersion, events []json.RawMessage) (api.RoomserverInternalAPI, *dummyProducer, []gomatrixserverlib.HeaderedEvent) {
|
func mustSendEvents(t *testing.T, ver gomatrixserverlib.RoomVersion, events []json.RawMessage) (api.RoomserverInternalAPI, *dummyProducer, []gomatrixserverlib.HeaderedEvent) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue