storage/sql/postgres: expose stdlib tunables, set them for tests
- adapted TestUnmarshalConfig to ensure the fields are read in - added a test to see that at least MaxOpenConns works: - this is only exposed through (*db).Stats() in go 1.11, so this test has a build tag - the other two configurables can't be read back, so we've got to trust that the mechanism works given the one instance that's tested.. Signed-off-by: Stephan Renatus <srenatus@chef.io>
This commit is contained in:
@@ -18,10 +18,14 @@ func TestUnmarshalConfig(t *testing.T) {
|
||||
rawConfig := []byte(`
|
||||
issuer: http://127.0.0.1:5556/dex
|
||||
storage:
|
||||
type: sqlite3
|
||||
type: postgres
|
||||
config:
|
||||
file: examples/dex.db
|
||||
|
||||
host: 10.0.0.1
|
||||
port: 65432
|
||||
maxOpenConns: 5
|
||||
maxIdleConns: 3
|
||||
connMaxLifetime: 30
|
||||
connectionTimeout: 3
|
||||
web:
|
||||
http: 127.0.0.1:5556
|
||||
staticClients:
|
||||
@@ -69,9 +73,14 @@ logger:
|
||||
want := Config{
|
||||
Issuer: "http://127.0.0.1:5556/dex",
|
||||
Storage: Storage{
|
||||
Type: "sqlite3",
|
||||
Config: &sql.SQLite3{
|
||||
File: "examples/dex.db",
|
||||
Type: "postgres",
|
||||
Config: &sql.Postgres{
|
||||
Host: "10.0.0.1",
|
||||
Port: 65432,
|
||||
MaxOpenConns: 5,
|
||||
MaxIdleConns: 3,
|
||||
ConnMaxLifetime: 30,
|
||||
ConnectionTimeout: 3,
|
||||
},
|
||||
},
|
||||
Web: Web{
|
||||
|
Reference in New Issue
Block a user