mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-14 05:12:26 +03:00
Configuration format v1 (#1230)
* Initial pass at refactoring config (not finished) * Don't forget current state and EDU servers * More shifting around * Update server key API tests * Fix roomserver test * Fix more tests * Further tweaks * Fix current state server test (sort of) * Maybe fix appservices * Fix client API test * Include database connection string in database options * Fix sync API build * Update config test * Fix unit tests * Fix federation sender build * Fix gobind build * Set Listen address for all services in HTTP monolith mode * Validate config, reinstate appservice derived in directory, tweaks * Tweak federation API test * Set MaxOpenConnections/MaxIdleConnections to previous values * Update generate-config
This commit is contained in:
parent
fdabba1851
commit
4b09f445c9
155 changed files with 1716 additions and 1503 deletions
|
@ -15,6 +15,7 @@
|
|||
package currentstateserver
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/ed25519"
|
||||
"encoding/json"
|
||||
|
@ -94,11 +95,15 @@ func MustWriteOutputEvent(t *testing.T, producer sarama.SyncProducer, out *rooms
|
|||
|
||||
func MustMakeInternalAPI(t *testing.T) (api.CurrentStateInternalAPI, sarama.SyncProducer, func()) {
|
||||
cfg := &config.Dendrite{}
|
||||
cfg.Defaults()
|
||||
stateDBName := "test_state.db"
|
||||
naffkaDBName := "test_naffka.db"
|
||||
cfg.Kafka.Topics.OutputRoomEvent = config.Topic(kafkaTopic)
|
||||
cfg.Database.CurrentState = config.DataSource("file:" + stateDBName)
|
||||
db, err := sqlutil.Open(sqlutil.SQLiteDriverName(), "file:"+naffkaDBName, nil)
|
||||
cfg.Global.ServerName = "kaer.morhen"
|
||||
cfg.Global.Kafka.Topics.OutputRoomEvent = config.Topic(kafkaTopic)
|
||||
cfg.CurrentStateServer.Database.ConnectionString = config.DataSource("file:" + stateDBName)
|
||||
db, err := sqlutil.Open(&config.DatabaseOptions{
|
||||
ConnectionString: config.DataSource("file:" + naffkaDBName),
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to open naffka database: %s", err)
|
||||
}
|
||||
|
@ -110,7 +115,7 @@ func MustMakeInternalAPI(t *testing.T) (api.CurrentStateInternalAPI, sarama.Sync
|
|||
if err != nil {
|
||||
t.Fatalf("Failed to create naffka consumer: %s", err)
|
||||
}
|
||||
return NewInternalAPI(cfg, naff), naff, func() {
|
||||
return NewInternalAPI(&cfg.CurrentStateServer, naff), naff, func() {
|
||||
os.Remove(naffkaDBName)
|
||||
os.Remove(stateDBName)
|
||||
}
|
||||
|
@ -165,8 +170,13 @@ func TestQueryCurrentState(t *testing.T) {
|
|||
t.Errorf("QueryCurrentState want tuple %+v but it is missing from the response", tuple)
|
||||
continue
|
||||
}
|
||||
if !reflect.DeepEqual(gotEvent.JSON(), wantEvent.JSON()) {
|
||||
t.Errorf("QueryCurrentState tuple %+v got event JSON %s want %s", tuple, string(gotEvent.JSON()), string(wantEvent.JSON()))
|
||||
gotCanon, err := gomatrixserverlib.CanonicalJSON(gotEvent.JSON())
|
||||
if err != nil {
|
||||
t.Errorf("CanonicalJSON failed: %w", err)
|
||||
continue
|
||||
}
|
||||
if !bytes.Equal(gotCanon, wantEvent.JSON()) {
|
||||
t.Errorf("QueryCurrentState tuple %+v got event JSON %s want %s", tuple, string(gotCanon), string(wantEvent.JSON()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue