From c3a91d510327d97bc3630e6f8f935000bb768337 Mon Sep 17 00:00:00 2001 From: Lucifergene <47265560+Lucifergene@users.noreply.github.com> Date: Mon, 13 Jan 2025 20:09:19 +0530 Subject: [PATCH] Add support for PostgreSQL 17 and update related test configurations Signed-off-by: Lucifergene <47265560+Lucifergene@users.noreply.github.com> --- .changeset/long-apples-jog.md | 5 +++++ .github/workflows/ci.yml | 12 ++++++------ .github/workflows/deploy_packages.yml | 12 ++++++------ .github/workflows/verify_e2e-linux.yml | 2 +- .../building-plugins-and-modules/02-testing.md | 4 ++-- docs/overview/versioning-policy.md | 4 ++-- .../scheduler/lib/PluginTaskSchedulerImpl.test.ts | 2 +- .../scheduler/lib/PluginTaskSchedulerJanitor.test.ts | 4 ++-- packages/backend-defaults/src/setupTests.ts | 2 +- packages/backend-test-utils/report.api.md | 1 + packages/backend-test-utils/src/database/types.ts | 8 ++++++++ plugins/app-backend/src/setupTests.ts | 2 +- plugins/auth-backend/src/setupTests.ts | 2 +- .../IncrementalIngestionDatabaseManager.test.ts | 2 +- .../src/module/WrapperProviders.test.ts | 2 +- plugins/catalog-backend/src/setupTests.ts | 2 +- .../tests/performance/getEntitiesPerformance.test.ts | 2 +- .../getProcessableEntitiesPerformance.test.ts | 2 +- .../tests/performance/providerDeltaMutations.test.ts | 2 +- .../tests/performance/stitchingPerformance.test.ts | 2 +- .../events-backend/src/service/EventsPlugin.test.ts | 2 +- .../src/service/hub/DatabaseEventBusStore.test.ts | 2 +- .../src/database/util.test.ts | 2 +- 23 files changed, 47 insertions(+), 33 deletions(-) create mode 100644 .changeset/long-apples-jog.md diff --git a/.changeset/long-apples-jog.md b/.changeset/long-apples-jog.md new file mode 100644 index 0000000000..4f57576cc4 --- /dev/null +++ b/.changeset/long-apples-jog.md @@ -0,0 +1,5 @@ +--- +'@backstage/backend-test-utils': patch +--- + +Added support for PostgreSQL version 17 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e8bf57cc95..6a03d81e96 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -157,8 +157,8 @@ jobs: name: Test ${{ matrix.node-version }} services: - postgres16: - image: postgres:16 + postgres17: + image: postgres:17 env: POSTGRES_PASSWORD: postgres options: >- @@ -168,8 +168,8 @@ jobs: --health-retries 5 ports: - 5432/tcp - postgres12: - image: postgres:12 + postgres13: + image: postgres:13 env: POSTGRES_PASSWORD: postgres options: >- @@ -249,8 +249,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] }} diff --git a/.github/workflows/deploy_packages.yml b/.github/workflows/deploy_packages.yml index d1d7d3fd7c..3c67b2c387 100644 --- a/.github/workflows/deploy_packages.yml +++ b/.github/workflows/deploy_packages.yml @@ -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: >- @@ -118,8 +118,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] }} diff --git a/.github/workflows/verify_e2e-linux.yml b/.github/workflows/verify_e2e-linux.yml index 30887980a4..a32d7bc26e 100644 --- a/.github/workflows/verify_e2e-linux.yml +++ b/.github/workflows/verify_e2e-linux.yml @@ -21,7 +21,7 @@ jobs: services: postgres: - image: postgres:12 + image: postgres:13 env: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres diff --git a/docs/backend-system/building-plugins-and-modules/02-testing.md b/docs/backend-system/building-plugins-and-modules/02-testing.md index 1ec100cff3..439fed597a 100644 --- a/docs/backend-system/building-plugins-and-modules/02-testing.md +++ b/docs/backend-system/building-plugins-and-modules/02-testing.md @@ -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 diff --git a/docs/overview/versioning-policy.md b/docs/overview/versioning-policy.md index f5e2e222f8..12103f255d 100644 --- a/docs/overview/versioning-policy.md +++ b/docs/overview/versioning-policy.md @@ -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. diff --git a/packages/backend-defaults/src/entrypoints/scheduler/lib/PluginTaskSchedulerImpl.test.ts b/packages/backend-defaults/src/entrypoints/scheduler/lib/PluginTaskSchedulerImpl.test.ts index 1ce1401829..712ed63a2f 100644 --- a/packages/backend-defaults/src/entrypoints/scheduler/lib/PluginTaskSchedulerImpl.test.ts +++ b/packages/backend-defaults/src/entrypoints/scheduler/lib/PluginTaskSchedulerImpl.test.ts @@ -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 () => { diff --git a/packages/backend-defaults/src/entrypoints/scheduler/lib/PluginTaskSchedulerJanitor.test.ts b/packages/backend-defaults/src/entrypoints/scheduler/lib/PluginTaskSchedulerJanitor.test.ts index 388f882afc..b2c6af24cb 100644 --- a/packages/backend-defaults/src/entrypoints/scheduler/lib/PluginTaskSchedulerJanitor.test.ts +++ b/packages/backend-defaults/src/entrypoints/scheduler/lib/PluginTaskSchedulerJanitor.test.ts @@ -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', ], diff --git a/packages/backend-defaults/src/setupTests.ts b/packages/backend-defaults/src/setupTests.ts index 76619a2542..c9745b280d 100644 --- a/packages/backend-defaults/src/setupTests.ts +++ b/packages/backend-defaults/src/setupTests.ts @@ -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'], }); diff --git a/packages/backend-test-utils/report.api.md b/packages/backend-test-utils/report.api.md index a79bd9d03c..879d7dd28f 100644 --- a/packages/backend-test-utils/report.api.md +++ b/packages/backend-test-utils/report.api.md @@ -459,6 +459,7 @@ export class TestCaches { // @public export type TestDatabaseId = + | 'POSTGRES_17' | 'POSTGRES_16' | 'POSTGRES_15' | 'POSTGRES_14' diff --git a/packages/backend-test-utils/src/database/types.ts b/packages/backend-test-utils/src/database/types.ts index 39a8af065c..e1ef61a93b 100644 --- a/packages/backend-test-utils/src/database/types.ts +++ b/packages/backend-test-utils/src/database/types.ts @@ -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 = 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', diff --git a/plugins/app-backend/src/setupTests.ts b/plugins/app-backend/src/setupTests.ts index 4ed508a382..ea10a94839 100644 --- a/plugins/app-backend/src/setupTests.ts +++ b/plugins/app-backend/src/setupTests.ts @@ -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'], }); diff --git a/plugins/auth-backend/src/setupTests.ts b/plugins/auth-backend/src/setupTests.ts index f7c56ef27d..5af5f05360 100644 --- a/plugins/auth-backend/src/setupTests.ts +++ b/plugins/auth-backend/src/setupTests.ts @@ -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'], }); diff --git a/plugins/catalog-backend-module-incremental-ingestion/src/database/IncrementalIngestionDatabaseManager.test.ts b/plugins/catalog-backend-module-incremental-ingestion/src/database/IncrementalIngestionDatabaseManager.test.ts index a8862cfc2a..bed216b5de 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/src/database/IncrementalIngestionDatabaseManager.test.ts +++ b/plugins/catalog-backend-module-incremental-ingestion/src/database/IncrementalIngestionDatabaseManager.test.ts @@ -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())( diff --git a/plugins/catalog-backend-module-incremental-ingestion/src/module/WrapperProviders.test.ts b/plugins/catalog-backend-module-incremental-ingestion/src/module/WrapperProviders.test.ts index 95b3f203c4..877e32acfb 100644 --- a/plugins/catalog-backend-module-incremental-ingestion/src/module/WrapperProviders.test.ts +++ b/plugins/catalog-backend-module-incremental-ingestion/src/module/WrapperProviders.test.ts @@ -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(); diff --git a/plugins/catalog-backend/src/setupTests.ts b/plugins/catalog-backend/src/setupTests.ts index f7c56ef27d..5af5f05360 100644 --- a/plugins/catalog-backend/src/setupTests.ts +++ b/plugins/catalog-backend/src/setupTests.ts @@ -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'], }); diff --git a/plugins/catalog-backend/src/tests/performance/getEntitiesPerformance.test.ts b/plugins/catalog-backend/src/tests/performance/getEntitiesPerformance.test.ts index 9d1bb8d80a..aa76bace54 100644 --- a/plugins/catalog-backend/src/tests/performance/getEntitiesPerformance.test.ts +++ b/plugins/catalog-backend/src/tests/performance/getEntitiesPerformance.test.ts @@ -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, }); diff --git a/plugins/catalog-backend/src/tests/performance/getProcessableEntitiesPerformance.test.ts b/plugins/catalog-backend/src/tests/performance/getProcessableEntitiesPerformance.test.ts index 8218ae82cc..e2ed160b42 100644 --- a/plugins/catalog-backend/src/tests/performance/getProcessableEntitiesPerformance.test.ts +++ b/plugins/catalog-backend/src/tests/performance/getProcessableEntitiesPerformance.test.ts @@ -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, }); diff --git a/plugins/catalog-backend/src/tests/performance/providerDeltaMutations.test.ts b/plugins/catalog-backend/src/tests/performance/providerDeltaMutations.test.ts index 6e95c2535a..377843643b 100644 --- a/plugins/catalog-backend/src/tests/performance/providerDeltaMutations.test.ts +++ b/plugins/catalog-backend/src/tests/performance/providerDeltaMutations.test.ts @@ -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, }); diff --git a/plugins/catalog-backend/src/tests/performance/stitchingPerformance.test.ts b/plugins/catalog-backend/src/tests/performance/stitchingPerformance.test.ts index a4d843649e..d0bf7c2cd8 100644 --- a/plugins/catalog-backend/src/tests/performance/stitchingPerformance.test.ts +++ b/plugins/catalog-backend/src/tests/performance/stitchingPerformance.test.ts @@ -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())( diff --git a/plugins/events-backend/src/service/EventsPlugin.test.ts b/plugins/events-backend/src/service/EventsPlugin.test.ts index 35813d7b8e..12a0f63002 100644 --- a/plugins/events-backend/src/service/EventsPlugin.test.ts +++ b/plugins/events-backend/src/service/EventsPlugin.test.ts @@ -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) { diff --git a/plugins/events-backend/src/service/hub/DatabaseEventBusStore.test.ts b/plugins/events-backend/src/service/hub/DatabaseEventBusStore.test.ts index ade462a920..959341cbc0 100644 --- a/plugins/events-backend/src/service/hub/DatabaseEventBusStore.test.ts +++ b/plugins/events-backend/src/service/hub/DatabaseEventBusStore.test.ts @@ -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 = diff --git a/plugins/search-backend-module-pg/src/database/util.test.ts b/plugins/search-backend-module-pg/src/database/util.test.ts index 38d997c836..45f0aea2c9 100644 --- a/plugins/search-backend-module-pg/src/database/util.test.ts +++ b/plugins/search-backend-module-pg/src/database/util.test.ts @@ -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) {