Debugging unit tests..
This commit is contained in:
parent
94ed2d3689
commit
10dc02f1ea
|
@ -259,6 +259,7 @@ func (b *BaseDendrite) Close() error {
|
|||
func (b *BaseDendrite) DatabaseConnection(dbProperties *config.DatabaseOptions, writer sqlutil.Writer) (*sql.DB, sqlutil.Writer, error) {
|
||||
if dbProperties.ConnectionString != "" || b == nil {
|
||||
// Open a new database connection using the supplied config.
|
||||
logrus.Infof("Open a new database connection using the supplied config.: %+v", dbProperties.ConnectionString)
|
||||
db, err := sqlutil.Open(dbProperties, writer)
|
||||
return db, writer, err
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/sirupsen/logrus"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
|
||||
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
|
||||
|
@ -159,6 +160,7 @@ func (d *Database) createAccount(
|
|||
}
|
||||
}
|
||||
if account, err = d.Accounts.InsertAccount(ctx, txn, localpart, hash, appserviceID, policyVersion, accountType); err != nil {
|
||||
logrus.WithError(err).Error("d.Accounts.InsertAccount error")
|
||||
return nil, sqlutil.ErrUserExists
|
||||
}
|
||||
if err = d.Profiles.InsertProfile(ctx, txn, localpart); err != nil {
|
||||
|
|
|
@ -19,6 +19,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||
"github.com/matrix-org/dendrite/setup/base"
|
||||
|
@ -44,6 +45,7 @@ func NewDatabase(base *base.BaseDendrite, dbProperties *config.DatabaseOptions,
|
|||
// preparing statements for columns that don't exist yet
|
||||
return nil, err
|
||||
}
|
||||
logrus.Info("created account_accounts table")
|
||||
deltas.LoadIsActive(m)
|
||||
//deltas.LoadLastSeenTSIP(m)
|
||||
deltas.LoadAddAccountType(m)
|
||||
|
@ -60,6 +62,7 @@ func NewDatabase(base *base.BaseDendrite, dbProperties *config.DatabaseOptions,
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("NewSQLiteAccountsTable: %w", err)
|
||||
}
|
||||
logrus.Info("prepared statements for accounts table")
|
||||
devicesTable, err := NewSQLiteDevicesTable(db, serverName)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("NewSQLiteDevicesTable: %w", err)
|
||||
|
|
|
@ -73,6 +73,7 @@ func TestQueryProfile(t *testing.T) {
|
|||
aliceAvatarURL := "mxc://example.com/alice"
|
||||
aliceDisplayName := "Alice"
|
||||
userAPI, accountDB := MustMakeInternalAPI(t, apiTestOpts{})
|
||||
time.Sleep(time.Second)
|
||||
_, err := accountDB.CreateAccount(context.TODO(), "alice", "foobar", "", "", api.AccountTypeUser)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to make account: %s", err)
|
||||
|
|
Loading…
Reference in a new issue