2
0

Require conn and pool configs to be created by ParseConfig

This simplifies handling default values. Now there is no ambiguity
between a zero value and a default value. All default values are set by
ParseConfig and the user can modify them after the initial creation.

fixes #567
This commit is contained in:
Jack Christensen
2019-08-24 09:49:38 -05:00
parent d9270bbfb6
commit b7b52ff079
7 changed files with 80 additions and 26 deletions
+8
View File
@@ -39,6 +39,14 @@ func TestConnectCancel(t *testing.T) {
assert.Equal(t, context.Canceled, err)
}
func TestConnectConfigRequiresConnConfigFromParseConfig(t *testing.T) {
t.Parallel()
config := &pgxpool.Config{}
require.PanicsWithValue(t, "config must be created by ParseConfig", func() { pgxpool.ConnectConfig(context.Background(), config) })
}
func TestPoolAcquireAndConnRelease(t *testing.T) {
t.Parallel()