backend-test-utils: increase max connection pool size

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-09-21 23:17:24 +02:00
parent be6157a588
commit e91e8e9c55
2 changed files with 17 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-test-utils': patch
---
Increased test database max connection pool size to reduce the risk of resource exhaustion.
@@ -28,6 +28,13 @@ import {
TestDatabaseProperties,
} from './types';
const LARGER_POOL_CONFIG = {
pool: {
min: 0,
max: 50,
},
};
/**
* Encapsulates the creation of ephemeral test database instances for use
* inside unit or integration tests.
@@ -164,6 +171,9 @@ export class TestDatabases {
new ConfigReader({
backend: {
database: {
knexConfig: properties.driver.includes('sqlite')
? {}
: LARGER_POOL_CONFIG,
client: properties.driver,
connection: connectionString,
},
@@ -203,6 +213,7 @@ export class TestDatabases {
new ConfigReader({
backend: {
database: {
knexConfig: LARGER_POOL_CONFIG,
client: 'pg',
connection: { host, port, user, password },
},
@@ -228,6 +239,7 @@ export class TestDatabases {
new ConfigReader({
backend: {
database: {
knexConfig: LARGER_POOL_CONFIG,
client: 'mysql2',
connection: { host, port, user, password },
},