storage/sql: rework of the original MySQL PR

This commit is contained in:
Nandor Kracser
2019-07-12 16:29:46 +02:00
parent e53bdfabb9
commit a572ad8fec
40 changed files with 6983 additions and 74 deletions

View File

@@ -13,17 +13,19 @@ func TestPostgresTunables(t *testing.T) {
t.Skipf("test environment variable %q not set, skipping", testPostgresEnv)
}
baseCfg := &Postgres{
Database: getenv("DEX_POSTGRES_DATABASE", "postgres"),
User: getenv("DEX_POSTGRES_USER", "postgres"),
Password: getenv("DEX_POSTGRES_PASSWORD", "postgres"),
Host: host,
SSL: PostgresSSL{
Mode: sslDisable, // Postgres container doesn't support SSL.
NetworkDB: NetworkDB{
Database: getenv("DEX_POSTGRES_DATABASE", "postgres"),
User: getenv("DEX_POSTGRES_USER", "postgres"),
Password: getenv("DEX_POSTGRES_PASSWORD", "postgres"),
Host: host,
},
SSL: SSL{
Mode: pgSSLDisable, // Postgres container doesn't support SSL.
}}
t.Run("with nothing set, uses defaults", func(t *testing.T) {
cfg := *baseCfg
c, err := cfg.open(logger, cfg.createDataSourceName())
c, err := cfg.open(logger)
if err != nil {
t.Fatalf("error opening connector: %s", err.Error())
}
@@ -36,7 +38,7 @@ func TestPostgresTunables(t *testing.T) {
t.Run("with something set, uses that", func(t *testing.T) {
cfg := *baseCfg
cfg.MaxOpenConns = 101
c, err := cfg.open(logger, cfg.createDataSourceName())
c, err := cfg.open(logger)
if err != nil {
t.Fatalf("error opening connector: %s", err.Error())
}