Merge pull request #28443 from Lucifergene/bump-pg

Added support for PostgreSQL 17 and updated related test configurations
This commit is contained in:
Fredrik Adelöw
2025-03-13 22:52:13 +01:00
committed by GitHub
23 changed files with 47 additions and 33 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/backend-test-utils': patch
---
Added support for PostgreSQL version 17
+6 -6
View File
@@ -161,8 +161,8 @@ jobs:
name: Test ${{ matrix.node-version }}
services:
postgres16:
image: postgres:16
postgres17:
image: postgres:17
env:
POSTGRES_PASSWORD: postgres
options: >-
@@ -172,8 +172,8 @@ jobs:
--health-retries 5
ports:
- 5432/tcp
postgres12:
image: postgres:12
postgres13:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
options: >-
@@ -253,8 +253,8 @@ jobs:
run: yarn backstage-cli repo test --maxWorkers=3 --workerIdleMemoryLimit=1300M --since origin/master --successCache --successCacheDir .cache/backstage-cli
env:
BACKSTAGE_TEST_DISABLE_DOCKER: 1
BACKSTAGE_TEST_DATABASE_POSTGRES16_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres16.ports[5432] }}
BACKSTAGE_TEST_DATABASE_POSTGRES12_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres12.ports[5432] }}
BACKSTAGE_TEST_DATABASE_POSTGRES17_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres17.ports[5432] }}
BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres13.ports[5432] }}
BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING: mysql://root:root@localhost:${{ job.services.mysql8.ports[3306] }}/ignored
BACKSTAGE_TEST_CACHE_REDIS7_CONNECTION_STRING: redis://localhost:${{ job.services.redis.ports[6379] }}
+6 -6
View File
@@ -16,8 +16,8 @@ jobs:
node-version: [20.x, 22.x]
services:
postgres16:
image: postgres:16
postgres17:
image: postgres:17
env:
POSTGRES_PASSWORD: postgres
options: >-
@@ -27,8 +27,8 @@ jobs:
--health-retries 5
ports:
- 5432/tcp
postgres12:
image: postgres:12
postgres13:
image: postgres:13
env:
POSTGRES_PASSWORD: postgres
options: >-
@@ -122,8 +122,8 @@ jobs:
yarn backstage-cli repo test --maxWorkers=3 --workerIdleMemoryLimit=1300M --coverage --successCache --successCacheDir .cache/backstage-cli
env:
BACKSTAGE_TEST_DISABLE_DOCKER: 1
BACKSTAGE_TEST_DATABASE_POSTGRES16_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres16.ports[5432] }}
BACKSTAGE_TEST_DATABASE_POSTGRES12_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres12.ports[5432] }}
BACKSTAGE_TEST_DATABASE_POSTGRES17_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres17.ports[5432] }}
BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres13.ports[5432] }}
BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING: mysql://root:root@localhost:${{ job.services.mysql8.ports[3306] }}/ignored
BACKSTAGE_TEST_CACHE_REDIS7_CONNECTION_STRING: redis://localhost:${{ job.services.redis.ports[6379] }}
+1 -1
View File
@@ -21,7 +21,7 @@ jobs:
services:
postgres:
image: postgres:12
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
@@ -190,7 +190,7 @@ describe('MyDatabaseClass', () => {
// "physical" databases to test against is much costlier than creating the
// "logical" databases within them that the individual tests use.
const databases = TestDatabases.create({
ids: ['POSTGRES_16', 'POSTGRES_12', 'SQLITE_3', 'MYSQL_8'],
ids: ['POSTGRES_17', 'POSTGRES_13', 'SQLITE_3', 'MYSQL_8'],
});
// Just an example of how to conveniently bundle up the setup code
@@ -236,8 +236,8 @@ your CI environment is able to supply databases natively, the `TestDatabases`
support custom connection strings through the use of environment variables that
it'll take into account when present.
- `BACKSTAGE_TEST_DATABASE_POSTGRES17_CONNECTION_STRING`
- `BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING`
- `BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING`
- `BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING`
## Testing Service Factories
+2 -2
View File
@@ -106,7 +106,7 @@ be part of the `1.12` Backstage release.
The following versioning policy applies to all packages:
- Breaking changes are noted in the changelog, and documentation is updated.
- Breaking changes are prefixed with `**BREAKING**: ` in the changelog.
- Breaking changes are prefixed with `**BREAKING**:` in the changelog.
- All public exports are considered stable and will have an entry in the
changelog.
- Breaking changes are recommended to document a clear upgrade path in the
@@ -195,4 +195,4 @@ The Backstage project recommends and supports using PostgreSQL for persistent st
The PostgreSQL [versioning policy](https://www.postgresql.org/support/versioning/) is to release a new major version every year with new features which is then supported for 5 years after its initial release.
Our policy mirrors the PostgreSQL versioning policy - we will support the last 5 major versions. We will also test the newest and oldest versions in that range. For example, if the range we support is currently 12 to 16, then we would only test 12 and 16 explicitly.
Our policy mirrors the PostgreSQL versioning policy - we will support the last 5 major versions. We will also test the newest and oldest versions in that range. For example, if the range we support is currently 13 to 17, then we would only test 13 and 17 explicitly.
@@ -33,7 +33,7 @@ jest.setTimeout(60_000);
describe('PluginTaskManagerImpl', () => {
const addShutdownHook = jest.fn();
const databases = TestDatabases.create({
ids: ['POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'],
ids: ['POSTGRES_17', 'POSTGRES_13', 'SQLITE_3'],
});
beforeAll(async () => {
@@ -39,8 +39,8 @@ describe('PluginTaskSchedulerJanitor', () => {
const databases = TestDatabases.create({
ids: [
/* 'MYSQL_8' not supported yet */
'POSTGRES_16',
'POSTGRES_12',
'POSTGRES_17',
'POSTGRES_13',
'SQLITE_3',
'MYSQL_8',
],
+1 -1
View File
@@ -21,5 +21,5 @@ import { Settings } from 'luxon';
Settings.throwOnInvalid = true;
TestDatabases.setDefaults({
ids: ['MYSQL_8', 'POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'],
ids: ['MYSQL_8', 'POSTGRES_17', 'POSTGRES_13', 'SQLITE_3'],
});
@@ -478,6 +478,7 @@ export class TestCaches {
// @public
export type TestDatabaseId =
| 'POSTGRES_17'
| 'POSTGRES_16'
| 'POSTGRES_15'
| 'POSTGRES_14'
@@ -28,6 +28,7 @@ export interface Engine {
* @public
*/
export type TestDatabaseId =
| 'POSTGRES_17'
| 'POSTGRES_16'
| 'POSTGRES_15'
| 'POSTGRES_14'
@@ -47,6 +48,13 @@ export type TestDatabaseProperties = {
export const allDatabases: Record<TestDatabaseId, TestDatabaseProperties> =
Object.freeze({
POSTGRES_17: {
name: 'Postgres 17.x',
driver: 'pg',
dockerImageName: getDockerImageForName('postgres:17'),
connectionStringEnvironmentVariableName:
'BACKSTAGE_TEST_DATABASE_POSTGRES17_CONNECTION_STRING',
},
POSTGRES_16: {
name: 'Postgres 16.x',
driver: 'pg',
+1 -1
View File
@@ -17,5 +17,5 @@
import { TestDatabases } from '@backstage/backend-test-utils';
TestDatabases.setDefaults({
ids: ['MYSQL_8', 'POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'],
ids: ['MYSQL_8', 'POSTGRES_17', 'POSTGRES_13', 'SQLITE_3'],
});
+1 -1
View File
@@ -19,5 +19,5 @@ import { TestDatabases } from '@backstage/backend-test-utils';
export {};
TestDatabases.setDefaults({
ids: ['MYSQL_8', 'POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'],
ids: ['MYSQL_8', 'POSTGRES_17', 'POSTGRES_13', 'SQLITE_3'],
});
@@ -24,7 +24,7 @@ jest.setTimeout(60_000);
describe('IncrementalIngestionDatabaseManager', () => {
const databases = TestDatabases.create({
ids: ['POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'],
ids: ['POSTGRES_17', 'POSTGRES_13', 'SQLITE_3'],
});
it.each(databases.eachSupportedId())(
@@ -25,7 +25,7 @@ jest.setTimeout(60_000);
describe('WrapperProviders', () => {
const applyDatabaseMigrations = jest.fn();
const databases = TestDatabases.create({
ids: ['POSTGRES_16', 'POSTGRES_12', 'SQLITE_3', 'MYSQL_8'],
ids: ['POSTGRES_17', 'POSTGRES_13', 'SQLITE_3', 'MYSQL_8'],
});
const config = new ConfigReader({});
const logger = mockServices.logger.mock();
+1 -1
View File
@@ -19,5 +19,5 @@ import { TestDatabases } from '@backstage/backend-test-utils';
export {};
TestDatabases.setDefaults({
ids: ['MYSQL_8', 'POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'],
ids: ['MYSQL_8', 'POSTGRES_17', 'POSTGRES_13', 'SQLITE_3'],
});
@@ -40,7 +40,7 @@ import { describePerformanceTest, performanceTraceEnabled } from './lib/env';
jest.setTimeout(600_000);
const databases = TestDatabases.create({
ids: [/* 'MYSQL_8', */ 'POSTGRES_16', /* 'POSTGRES_12',*/ 'SQLITE_3'],
ids: [/* 'MYSQL_8', */ 'POSTGRES_17', /* 'POSTGRES_13',*/ 'SQLITE_3'],
disableDocker: false,
});
@@ -25,7 +25,7 @@ import { describePerformanceTest, performanceTraceEnabled } from './lib/env';
jest.setTimeout(600_000);
const databases = TestDatabases.create({
ids: [/* 'MYSQL_8', */ 'POSTGRES_16', /* 'POSTGRES_12',*/ 'SQLITE_3'],
ids: [/* 'MYSQL_8', */ 'POSTGRES_17', /* 'POSTGRES_13',*/ 'SQLITE_3'],
disableDocker: false,
});
@@ -26,7 +26,7 @@ import { DeferredEntity } from '@backstage/plugin-catalog-node';
jest.setTimeout(600_000);
const databases = TestDatabases.create({
ids: [/* 'MYSQL_8', */ 'POSTGRES_16', /* 'POSTGRES_12',*/ 'SQLITE_3'],
ids: [/* 'MYSQL_8', */ 'POSTGRES_17', /* 'POSTGRES_13',*/ 'SQLITE_3'],
disableDocker: false,
});
@@ -143,7 +143,7 @@ class Tracker {
describePerformanceTest('stitchingPerformance', () => {
const databases = TestDatabases.create({
ids: [/* 'MYSQL_8', */ 'POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'],
ids: [/* 'MYSQL_8', */ 'POSTGRES_17', 'POSTGRES_13', 'SQLITE_3'],
});
it.each(databases.eachSupportedId())(
@@ -141,7 +141,7 @@ describe('eventsPlugin', () => {
}
const databases = TestDatabases.create({
ids: ['SQLITE_3', 'MYSQL_8', 'POSTGRES_9', 'POSTGRES_13', 'POSTGRES_16'],
ids: ['SQLITE_3', 'MYSQL_8', 'POSTGRES_13', 'POSTGRES_17'],
});
async function mockKnexFactory(databaseId: TestDatabaseId) {
@@ -24,7 +24,7 @@ import { DatabaseEventBusStore } from './DatabaseEventBusStore';
const logger = mockServices.logger.mock();
const databases = TestDatabases.create({
ids: ['POSTGRES_9', 'POSTGRES_13', 'POSTGRES_16'],
ids: ['POSTGRES_13', 'POSTGRES_17'],
});
const maybeDescribe =
@@ -38,7 +38,7 @@ describe('util', () => {
describe('supported', () => {
const databases = TestDatabases.create({
ids: ['POSTGRES_16', 'POSTGRES_12'],
ids: ['POSTGRES_17', 'POSTGRES_13'],
});
if (databases.eachSupportedId().length < 1) {