Remove BaseDendrite (#3023)

Removes `BaseDendrite` to, hopefully, make testing and composing of
components easier in the future.
This commit is contained in:
Till 2023-03-22 09:21:32 +01:00 committed by GitHub
parent ec6879e5ae
commit 5e85a00cb3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 1186 additions and 1002 deletions

View file

@ -15,13 +15,13 @@ import (
"time"
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/setup/process"
"github.com/matrix-org/gomatrixserverlib"
"github.com/matrix-org/dendrite/internal/hooks"
"github.com/matrix-org/dendrite/internal/httputil"
"github.com/matrix-org/dendrite/internal/sqlutil"
roomserver "github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/setup/base"
"github.com/matrix-org/dendrite/setup/config"
"github.com/matrix-org/dendrite/setup/mscs/msc2836"
userapi "github.com/matrix-org/dendrite/userapi/api"
@ -555,21 +555,18 @@ func injectEvents(t *testing.T, userAPI userapi.UserInternalAPI, rsAPI roomserve
cfg.Global.ServerName = "localhost"
cfg.MSCs.Database.ConnectionString = "file:msc2836_test.db"
cfg.MSCs.MSCs = []string{"msc2836"}
cm := sqlutil.NewConnectionManager()
base := &base.BaseDendrite{
Cfg: cfg,
Routers: httputil.NewRouters(),
ConnectionManager: cm,
}
err := msc2836.Enable(base, rsAPI, nil, userAPI, nil)
processCtx := process.NewProcessContext()
cm := sqlutil.NewConnectionManager(processCtx, cfg.Global.DatabaseOptions)
routers := httputil.NewRouters()
err := msc2836.Enable(cfg, cm, routers, rsAPI, nil, userAPI, nil)
if err != nil {
t.Fatalf("failed to enable MSC2836: %s", err)
}
for _, ev := range events {
hooks.Run(hooks.KindNewEventPersisted, ev)
}
return base.Routers.Client
return routers.Client
}
type fledglingEvent struct {