Test getSharedConnection handles dead connections
If a test does something that kills a connection, it previously would break all subsequent tests that used the shared connection. It no longer does.
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@ type test interface {
|
|||||||
var sharedConnection *pgx.Connection
|
var sharedConnection *pgx.Connection
|
||||||
|
|
||||||
func getSharedConnection(t test) (c *pgx.Connection) {
|
func getSharedConnection(t test) (c *pgx.Connection) {
|
||||||
if sharedConnection == nil {
|
if sharedConnection == nil || !sharedConnection.IsAlive() {
|
||||||
var err error
|
var err error
|
||||||
sharedConnection, err = pgx.Connect(*defaultConnectionParameters)
|
sharedConnection, err = pgx.Connect(*defaultConnectionParameters)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user