mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
Fix race condition
This commit is contained in:
parent
e0096fe5d3
commit
1c66854c04
|
|
@ -15,7 +15,7 @@ func TestConnectionManager(t *testing.T) {
|
||||||
t.Cleanup(close)
|
t.Cleanup(close)
|
||||||
cm := sqlutil.NewConnectionManager(nil, config.DatabaseOptions{})
|
cm := sqlutil.NewConnectionManager(nil, config.DatabaseOptions{})
|
||||||
|
|
||||||
dbProps := &config.DatabaseOptions{ConnectionString: config.DataSource(string(conStr))}
|
dbProps := &config.DatabaseOptions{ConnectionString: config.DataSource(conStr)}
|
||||||
db, writer, err := cm.Connection(dbProps)
|
db, writer, err := cm.Connection(dbProps)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
|
@ -47,8 +47,8 @@ func TestConnectionManager(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// test invalid connection string configured
|
// test invalid connection string configured
|
||||||
cm = sqlutil.NewConnectionManager(nil, config.DatabaseOptions{})
|
cm2 := sqlutil.NewConnectionManager(nil, config.DatabaseOptions{})
|
||||||
_, _, err = cm.Connection(&config.DatabaseOptions{ConnectionString: "http://"})
|
_, _, err = cm2.Connection(&config.DatabaseOptions{ConnectionString: "http://"})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Fatal("expected an error but got none")
|
t.Fatal("expected an error but got none")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue