mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Remove BaseDendrite
(#3023)
Removes `BaseDendrite` to, hopefully, make testing and composing of components easier in the future.
This commit is contained in:
parent
ec6879e5ae
commit
5e85a00cb3
68 changed files with 1186 additions and 1002 deletions
|
@ -77,7 +77,7 @@ func TestNotifyUserCountsAsync(t *testing.T) {
|
|||
// Create DB and Dendrite base
|
||||
connStr, close := test.PrepareDBConnectionString(t, dbType)
|
||||
defer close()
|
||||
cm := sqlutil.NewConnectionManager()
|
||||
cm := sqlutil.NewConnectionManager(nil, config.DatabaseOptions{})
|
||||
db, err := storage.NewUserDatabase(ctx, cm, &config.DatabaseOptions{
|
||||
ConnectionString: config.DataSource(connStr),
|
||||
}, "test", bcrypt.MinCost, 0, 0, "")
|
||||
|
|
|
@ -7,10 +7,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
|
||||
"github.com/matrix-org/dendrite/internal"
|
||||
"github.com/matrix-org/dendrite/setup/config"
|
||||
"github.com/matrix-org/dendrite/test"
|
||||
"github.com/matrix-org/dendrite/test/testrig"
|
||||
"github.com/matrix-org/dendrite/userapi/storage"
|
||||
|
@ -18,12 +18,10 @@ import (
|
|||
|
||||
func TestCollect(t *testing.T) {
|
||||
test.WithAllDatabases(t, func(t *testing.T, dbType test.DBType) {
|
||||
b, _, _ := testrig.Base(nil)
|
||||
connStr, closeDB := test.PrepareDBConnectionString(t, dbType)
|
||||
cfg, processCtx, closeDB := testrig.CreateConfig(t, dbType)
|
||||
defer closeDB()
|
||||
db, err := storage.NewUserDatabase(b.Context(), b.ConnectionManager, &config.DatabaseOptions{
|
||||
ConnectionString: config.DataSource(connStr),
|
||||
}, "localhost", bcrypt.MinCost, 1000, 1000, "")
|
||||
cm := sqlutil.NewConnectionManager(processCtx, cfg.Global.DatabaseOptions)
|
||||
db, err := storage.NewUserDatabase(processCtx.Context(), cm, &cfg.UserAPI.AccountDatabase, "localhost", bcrypt.MinCost, 1000, 1000, "")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
@ -62,12 +60,12 @@ func TestCollect(t *testing.T) {
|
|||
}))
|
||||
defer srv.Close()
|
||||
|
||||
b.Cfg.Global.ReportStats.Endpoint = srv.URL
|
||||
cfg.Global.ReportStats.Endpoint = srv.URL
|
||||
stats := phoneHomeStats{
|
||||
prevData: timestampToRUUsage{},
|
||||
serverName: "localhost",
|
||||
startTime: time.Now(),
|
||||
cfg: b.Cfg,
|
||||
cfg: cfg,
|
||||
db: db,
|
||||
isMonolith: false,
|
||||
client: &http.Client{Timeout: time.Second},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue