aboutsummaryrefslogtreecommitdiff
path: root/roomserver/roomserver_test.go
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2023-03-17 12:09:45 +0100
committerGitHub <noreply@github.com>2023-03-17 11:09:45 +0000
commit5579121c6f27105342a2aea05cf9a3119d73cecb (patch)
tree1d8b7bec90079b6f693585d306c19019ea426870 /roomserver/roomserver_test.go
parentd88f71ab71a60348518f7fa6735ac9f0bfb472c3 (diff)
Preparations for removing `BaseDendrite` (#3016)
Preparations to actually remove/replace `BaseDendrite`. Quite a few changes: - SyncAPI accepts an `fulltext.Indexer` interface (fulltext is removed from `BaseDendrite`) - Caches are removed from `BaseDendrite` - Introduces a `Router` struct (likely to change) - also fixes #2903 - Introduces a `sqlutil.ConnectionManager`, which should remove `base.DatabaseConnection` later on - probably more
Diffstat (limited to 'roomserver/roomserver_test.go')
-rw-r--r--roomserver/roomserver_test.go17
1 files changed, 11 insertions, 6 deletions
diff --git a/roomserver/roomserver_test.go b/roomserver/roomserver_test.go
index a3ca5909..1b0b3155 100644
--- a/roomserver/roomserver_test.go
+++ b/roomserver/roomserver_test.go
@@ -7,6 +7,7 @@ import (
"testing"
"time"
+ "github.com/matrix-org/dendrite/internal/caching"
"github.com/stretchr/testify/assert"
"github.com/matrix-org/dendrite/roomserver/state"
@@ -32,7 +33,8 @@ import (
func mustCreateDatabase(t *testing.T, dbType test.DBType) (*base.BaseDendrite, storage.Database, func()) {
t.Helper()
base, close := testrig.CreateBaseDendrite(t, dbType)
- db, err := storage.Open(base, &base.Cfg.RoomServer.Database, base.Caches)
+ caches := caching.NewRistrettoCache(base.Cfg.Global.Cache.EstimatedMaxSize, base.Cfg.Global.Cache.MaxAge, caching.DisableMetrics)
+ db, err := storage.Open(base.ProcessContext.Context(), base.ConnectionManager, &base.Cfg.RoomServer.Database, caches)
if err != nil {
t.Fatalf("failed to create Database: %v", err)
}
@@ -43,7 +45,8 @@ func TestUsers(t *testing.T) {
test.WithAllDatabases(t, func(t *testing.T, dbType test.DBType) {
base, close := testrig.CreateBaseDendrite(t, dbType)
defer close()
- rsAPI := roomserver.NewInternalAPI(base)
+ caches := caching.NewRistrettoCache(base.Cfg.Global.Cache.EstimatedMaxSize, base.Cfg.Global.Cache.MaxAge, caching.DisableMetrics)
+ rsAPI := roomserver.NewInternalAPI(base, caches)
// SetFederationAPI starts the room event input consumer
rsAPI.SetFederationAPI(nil, nil)
@@ -181,7 +184,8 @@ func Test_QueryLeftUsers(t *testing.T) {
base, _, close := mustCreateDatabase(t, dbType)
defer close()
- rsAPI := roomserver.NewInternalAPI(base)
+ caches := caching.NewRistrettoCache(base.Cfg.Global.Cache.EstimatedMaxSize, base.Cfg.Global.Cache.MaxAge, caching.DisableMetrics)
+ rsAPI := roomserver.NewInternalAPI(base, caches)
// SetFederationAPI starts the room event input consumer
rsAPI.SetFederationAPI(nil, nil)
// Create the room
@@ -232,12 +236,13 @@ func TestPurgeRoom(t *testing.T) {
defer jetstream.DeleteAllStreams(jsCtx, &base.Cfg.Global.JetStream)
fedClient := base.CreateFederationClient()
- rsAPI := roomserver.NewInternalAPI(base)
+ caches := caching.NewRistrettoCache(base.Cfg.Global.Cache.EstimatedMaxSize, base.Cfg.Global.Cache.MaxAge, caching.DisableMetrics)
+ rsAPI := roomserver.NewInternalAPI(base, caches)
userAPI := userapi.NewInternalAPI(base, rsAPI, nil)
// this starts the JetStream consumers
- syncapi.AddPublicRoutes(base, userAPI, rsAPI)
- federationapi.NewInternalAPI(base, fedClient, rsAPI, base.Caches, nil, true)
+ syncapi.AddPublicRoutes(base, userAPI, rsAPI, caches)
+ federationapi.NewInternalAPI(base, fedClient, rsAPI, caches, nil, true)
rsAPI.SetFederationAPI(nil, nil)
// Create the room