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 {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
defer tx.Rollback()
|
||||||
|
|
||||||
// users in room B (bob) and F (doris) should be reset.
|
// users in room B (bob) and F (doris) should be reset.
|
||||||
tokens, err := tokensTable.TokenForEachDevice(tx)
|
tokens, err := tokensTable.TokenForEachDevice(tx)
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
package testutils
|
package testutils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"os/user"
|
"os/user"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Quiet = false
|
var Quiet = false
|
||||||
@ -64,7 +66,9 @@ func PrepareDBConnectionString() (connStr string) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
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;`)
|
CREATE SCHEMA public;`)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user