| 78 | } |
| 79 | |
| 80 | func (t *PoolTest) TestClosedDB(c *C) { |
| 81 | c.Assert(t.db.Close(), IsNil) |
| 82 | |
| 83 | c.Assert(t.db.Pool().Len(), Equals, 0) |
| 84 | c.Assert(t.db.Pool().IdleLen(), Equals, 0) |
| 85 | |
| 86 | err := t.db.Close() |
| 87 | c.Assert(err, Not(IsNil)) |
| 88 | c.Assert(err.Error(), Equals, "pg: database is closed") |
| 89 | |
| 90 | _, err = t.db.Exec("SELECT 'test_closed_db'") |
| 91 | c.Assert(err, Not(IsNil)) |
| 92 | c.Assert(err.Error(), Equals, "pg: database is closed") |
| 93 | } |
| 94 | |
| 95 | func (t *PoolTest) TestClosedListener(c *C) { |
| 96 | ln := t.db.Listen(ctx, "test_channel") |