MCPcopy Create free account
hub / github.com/go-pg/pg / TestClosedDB

Method TestClosedDB

pool_test.go:80–93  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

78}
79
80func (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
95func (t *PoolTest) TestClosedListener(c *C) {
96 ln := t.db.Listen(ctx, "test_channel")

Callers

nothing calls this directly

Calls 7

AssertMethod · 0.80
PoolMethod · 0.80
CloseMethod · 0.65
LenMethod · 0.65
IdleLenMethod · 0.65
ExecMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected