fix: cap mysql connection pool
This commit is contained in:
@@ -23,4 +23,19 @@ func TestDefaultConfigUsesMeetingIMDatabase(t *testing.T) {
|
||||
if !strings.Contains(cfg.MySQL.DSN, "/meeting_im?") {
|
||||
t.Fatalf("default mysql dsn = %q, want meeting_im database", cfg.MySQL.DSN)
|
||||
}
|
||||
if cfg.MySQL.MaxOpenConns != 15 || cfg.MySQL.MaxIdleConns != 5 {
|
||||
t.Fatalf("default mysql pool = %d/%d, want 15/5", cfg.MySQL.MaxOpenConns, cfg.MySQL.MaxIdleConns)
|
||||
}
|
||||
}
|
||||
|
||||
func TestApplyEnvOverridesMySQLPool(t *testing.T) {
|
||||
t.Setenv("IM_WORKBENCH_MYSQL_MAX_OPEN_CONNS", "12")
|
||||
t.Setenv("IM_WORKBENCH_MYSQL_MAX_IDLE_CONNS", "4")
|
||||
cfg := defaultConfig()
|
||||
|
||||
applyEnv(cfg)
|
||||
|
||||
if cfg.MySQL.MaxOpenConns != 12 || cfg.MySQL.MaxIdleConns != 4 {
|
||||
t.Fatalf("mysql pool = %d/%d, want 12/4", cfg.MySQL.MaxOpenConns, cfg.MySQL.MaxIdleConns)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user