mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 06:12:45 +00:00
Use TransactionWriter in other component SQLite (#1209)
* Use TransactionWriter on other component SQLites * Fix sync API tests * Fix panic in media API * Fix a couple of transactions * Fix wrong query, add some logging output * Add debug logging into StoreEvent * Adjust InsertRoomNID * Update logging
This commit is contained in:
parent
1d72ce8b7a
commit
b6bc132485
27 changed files with 439 additions and 245 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"crypto/ed25519"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -52,7 +53,13 @@ func MustCreateEvent(t *testing.T, roomID string, prevs []gomatrixserverlib.Head
|
|||
}
|
||||
|
||||
func MustCreateDatabase(t *testing.T) storage.Database {
|
||||
db, err := sqlite3.NewDatabase("file::memory:")
|
||||
dbname := fmt.Sprintf("test_%s.db", t.Name())
|
||||
if _, err := os.Stat(dbname); err == nil {
|
||||
if err = os.Remove(dbname); err != nil {
|
||||
t.Fatalf("tried to delete stale test database but failed: %s", err)
|
||||
}
|
||||
}
|
||||
db, err := sqlite3.NewDatabase(fmt.Sprintf("file:%s", dbname))
|
||||
if err != nil {
|
||||
t.Fatalf("NewSyncServerDatasource returned %s", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue