mirror of
https://github.com/matrix-org/sliding-sync.git
synced 2025-03-10 13:37:11 +00:00
Ensure txns are closed so we can wipe the db for other tests
This commit is contained in:
parent
5028f93f83
commit
af1f34861e
@ -151,6 +151,7 @@ func TestClearStuckInvites(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
defer tx.Rollback()
|
||||
|
||||
// users in room B (bob) and F (doris) should be reset.
|
||||
tokens, err := tokensTable.TokenForEachDevice(tx)
|
||||
|
@ -1,11 +1,13 @@
|
||||
package testutils
|
||||
|
||||
import (
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
"time"
|
||||
)
|
||||
|
||||
var Quiet = false
|
||||
@ -64,7 +66,9 @@ func PrepareDBConnectionString() (connStr string) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
_, err = db.Exec(`DROP SCHEMA public CASCADE;
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
_, err = db.ExecContext(ctx, `DROP SCHEMA public CASCADE;
|
||||
CREATE SCHEMA public;`)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user