diff --git a/.changeset/metal-countries-sniff.md b/.changeset/metal-countries-sniff.md new file mode 100644 index 0000000000..bef0a7209a --- /dev/null +++ b/.changeset/metal-countries-sniff.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-vault-backend': patch +--- + +Updated to test using PostgreSQL 12 and 16 diff --git a/.changeset/witty-ears-repair.md b/.changeset/witty-ears-repair.md new file mode 100644 index 0000000000..cdd4f3f271 --- /dev/null +++ b/.changeset/witty-ears-repair.md @@ -0,0 +1,7 @@ +--- +'@backstage/backend-test-utils': patch +--- + +Added support for PostgreSQL versions 15 and 16 + +Also introduced a new `setDefaults(options: { ids?: TestDatabaseId[] })` static method that can be added to the `setupTests.ts` file to define the default database ids you want to use throughout your package. Usage would look like this: `TestDatabases.setDefaults({ ids: ['POSTGRES_12','POSTGRES_16'] })` and would result in PostgreSQL versions 12 and 16 being used for your tests. diff --git a/.github/uffizzi/k8s/manifests/pg-deploy.yaml b/.github/uffizzi/k8s/manifests/pg-deploy.yaml index b842328978..950e64283f 100644 --- a/.github/uffizzi/k8s/manifests/pg-deploy.yaml +++ b/.github/uffizzi/k8s/manifests/pg-deploy.yaml @@ -15,7 +15,7 @@ spec: spec: containers: - name: postgres - image: postgres:13.2-alpine + image: postgres:12-alpine imagePullPolicy: 'IfNotPresent' ports: - containerPort: 5432 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33d89b9c96..88faadaa68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -153,8 +153,8 @@ jobs: name: Test ${{ matrix.node-version }} services: - postgres13: - image: postgres:13 + postgres16: + image: postgres:16 env: POSTGRES_PASSWORD: postgres options: >- @@ -164,8 +164,8 @@ jobs: --health-retries 5 ports: - 5432/tcp - postgres9: - image: postgres:9 + postgres12: + image: postgres:12 env: POSTGRES_PASSWORD: postgres options: >- @@ -218,8 +218,8 @@ jobs: run: yarn backstage-cli repo test --maxWorkers=2 --workerIdleMemoryLimit=1300M --since origin/master env: BACKSTAGE_TEST_DISABLE_DOCKER: 1 - BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres13.ports[5432] }} - BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres9.ports[5432] }} + 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_MYSQL8_CONNECTION_STRING: mysql://root:root@localhost:${{ job.services.mysql8.ports[3306] }}/ignored # We run the test cases before verifying the specs to prevent any failing tests from causing errors. diff --git a/.github/workflows/deploy_packages.yml b/.github/workflows/deploy_packages.yml index 72124aa363..f6ad4d9742 100644 --- a/.github/workflows/deploy_packages.yml +++ b/.github/workflows/deploy_packages.yml @@ -17,8 +17,8 @@ jobs: node-version: [18.x, 20.x] services: - postgres13: - image: postgres:13 + postgres16: + image: postgres:16 env: POSTGRES_PASSWORD: postgres options: >- @@ -28,8 +28,8 @@ jobs: --health-retries 5 ports: - 5432/tcp - postgres9: - image: postgres:9 + postgres12: + image: postgres:12 env: POSTGRES_PASSWORD: postgres options: >- @@ -106,8 +106,8 @@ jobs: bash <(curl -s https://codecov.io/bash) -f packages/core-plugin-api/coverage/* -F core-plugin-api env: BACKSTAGE_TEST_DISABLE_DOCKER: 1 - BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres13.ports[5432] }} - BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING: postgresql://postgres:postgres@localhost:${{ job.services.postgres9.ports[5432] }} + 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_MYSQL8_CONNECTION_STRING: mysql://root:root@localhost:${{ job.services.mysql8.ports[3306] }}/ignored - name: Discord notification diff --git a/.github/workflows/verify_e2e-linux.yml b/.github/workflows/verify_e2e-linux.yml index 89da89889f..e86608fcfe 100644 --- a/.github/workflows/verify_e2e-linux.yml +++ b/.github/workflows/verify_e2e-linux.yml @@ -18,7 +18,7 @@ jobs: services: postgres: - image: postgres:latest + image: postgres:12 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 d14f7de09c..4bab1d1b9b 100644 --- a/docs/backend-system/building-plugins-and-modules/02-testing.md +++ b/docs/backend-system/building-plugins-and-modules/02-testing.md @@ -120,7 +120,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_13', 'POSTGRES_9', 'SQLITE_3', 'MYSQL_8'], + ids: ['POSTGRES_16', 'POSTGRES_12', 'SQLITE_3', 'MYSQL_8'], }); // Just an example of how to conveniently bundle up the setup code diff --git a/docs/overview/versioning-policy.md b/docs/overview/versioning-policy.md index c38ba404b5..8a23251ebb 100644 --- a/docs/overview/versioning-policy.md +++ b/docs/overview/versioning-policy.md @@ -182,3 +182,11 @@ The TypeScript release cadence is roughly every three months. An important aspec Our policy is to support the last 3 TypeScript versions, for example 4.8, 4.9, and 5.0. Converted to time, this means that we typically support the TypeScript version from the last six to nine months, depending on where in the TypeScript release window we are. This policy applies as a snapshot at the time of any given Backstage release, new TypeScript releases only apply to the following Backstage main-line release, not to the current one. For anyone maintaining their own Backstage project, this means that you should strive to bump to the latest TypeScript version at least every 6 months, or you may encounter breakages as you upgrade Backstage packages. If you encounter any issues in doing so, please [file an issue in the main Backstage repository](https://github.com/backstage/backstage/issues/new/choose), as per this policy we should always support the latest version. In order to ensure that we do not start using new TypeScript features too early, the Backstage project itself uses the version at the beginning of the currently supported window, in the above example that would be version 4.8. + +## PostgreSQL Releases + +The Backstage project recommends and supports using PostgreSQL for persistent storage. + +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. diff --git a/packages/backend-tasks/src/migrations.test.ts b/packages/backend-tasks/src/migrations.test.ts index 1d701c971d..82208da975 100644 --- a/packages/backend-tasks/src/migrations.test.ts +++ b/packages/backend-tasks/src/migrations.test.ts @@ -42,9 +42,7 @@ async function migrateUntilBefore(knex: Knex, target: string): Promise { jest.setTimeout(60_000); describe('migrations', () => { - const databases = TestDatabases.create({ - ids: ['POSTGRES_13', 'POSTGRES_9', 'MYSQL_8', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); it.each(databases.eachSupportedId())( '20210928160613_init.js, %p', diff --git a/packages/backend-tasks/src/setupTests.ts b/packages/backend-tasks/src/setupTests.ts index 5245d37c26..76619a2542 100644 --- a/packages/backend-tasks/src/setupTests.ts +++ b/packages/backend-tasks/src/setupTests.ts @@ -14,7 +14,12 @@ * limitations under the License. */ +import { TestDatabases } from '@backstage/backend-test-utils'; import { Settings } from 'luxon'; // TS still thinks that methods can return null / placeholders, but we still want to throw as soon as possible when things go wrong Settings.throwOnInvalid = true; + +TestDatabases.setDefaults({ + ids: ['MYSQL_8', 'POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'], +}); diff --git a/packages/backend-tasks/src/tasks/PluginTaskSchedulerImpl.test.ts b/packages/backend-tasks/src/tasks/PluginTaskSchedulerImpl.test.ts index 6247755bbd..4b40791cb5 100644 --- a/packages/backend-tasks/src/tasks/PluginTaskSchedulerImpl.test.ts +++ b/packages/backend-tasks/src/tasks/PluginTaskSchedulerImpl.test.ts @@ -36,7 +36,7 @@ jest.setTimeout(60_000); describe('PluginTaskManagerImpl', () => { const databases = TestDatabases.create({ - ids: ['POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], + ids: ['POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'], }); beforeAll(async () => { diff --git a/packages/backend-tasks/src/tasks/PluginTaskSchedulerJanitor.test.ts b/packages/backend-tasks/src/tasks/PluginTaskSchedulerJanitor.test.ts index 50bea27d27..1f0363625e 100644 --- a/packages/backend-tasks/src/tasks/PluginTaskSchedulerJanitor.test.ts +++ b/packages/backend-tasks/src/tasks/PluginTaskSchedulerJanitor.test.ts @@ -40,8 +40,8 @@ describe('PluginTaskSchedulerJanitor', () => { const databases = TestDatabases.create({ ids: [ /* 'MYSQL_8' not supported yet */ - 'POSTGRES_13', - 'POSTGRES_9', + 'POSTGRES_16', + 'POSTGRES_12', 'SQLITE_3', 'MYSQL_8', ], diff --git a/packages/backend-tasks/src/tasks/TaskScheduler.test.ts b/packages/backend-tasks/src/tasks/TaskScheduler.test.ts index 8e419437bc..d286eaee38 100644 --- a/packages/backend-tasks/src/tasks/TaskScheduler.test.ts +++ b/packages/backend-tasks/src/tasks/TaskScheduler.test.ts @@ -25,9 +25,7 @@ jest.setTimeout(60_000); describe('TaskScheduler', () => { const logger = getVoidLogger(); - const databases = TestDatabases.create({ - ids: ['POSTGRES_13', 'POSTGRES_9', 'SQLITE_3', 'MYSQL_8'], - }); + const databases = TestDatabases.create(); const testScopedSignal = createTestScopedSignal(); async function createDatabase( diff --git a/packages/backend-tasks/src/tasks/TaskWorker.test.ts b/packages/backend-tasks/src/tasks/TaskWorker.test.ts index 45eb7d1003..a2ecdaa779 100644 --- a/packages/backend-tasks/src/tasks/TaskWorker.test.ts +++ b/packages/backend-tasks/src/tasks/TaskWorker.test.ts @@ -28,9 +28,7 @@ jest.setTimeout(60_000); describe('TaskWorker', () => { const logger = getVoidLogger(); - const databases = TestDatabases.create({ - ids: ['POSTGRES_13', 'POSTGRES_9', 'SQLITE_3', 'MYSQL_8'], - }); + const databases = TestDatabases.create(); const testScopedSignal = createTestScopedSignal(); beforeEach(() => { diff --git a/packages/backend-test-utils/api-report.md b/packages/backend-test-utils/api-report.md index ac012e2f69..204e5dc84a 100644 --- a/packages/backend-test-utils/api-report.md +++ b/packages/backend-test-utils/api-report.md @@ -307,6 +307,8 @@ export interface TestBackendOptions { // @public export type TestDatabaseId = + | 'POSTGRES_16' + | 'POSTGRES_15' | 'POSTGRES_14' | 'POSTGRES_13' | 'POSTGRES_12' @@ -325,6 +327,8 @@ export class TestDatabases { eachSupportedId(): [TestDatabaseId][]; init(id: TestDatabaseId): Promise; // (undocumented) + static setDefaults(options: { ids?: TestDatabaseId[] }): void; + // (undocumented) supports(id: TestDatabaseId): boolean; } ``` diff --git a/packages/backend-test-utils/src/database/TestDatabases.test.ts b/packages/backend-test-utils/src/database/TestDatabases.test.ts index d766d38815..64e4d76443 100644 --- a/packages/backend-test-utils/src/database/TestDatabases.test.ts +++ b/packages/backend-test-utils/src/database/TestDatabases.test.ts @@ -59,6 +59,68 @@ describe('TestDatabases', () => { describe('each connect', () => { const dbs = TestDatabases.create(); + itIfDocker( + 'obeys a provided connection string for postgres 16', + async () => { + const { host, port, user, password, stop } = + await startPostgresContainer('postgres:16'); + + try { + // Leave a mark + process.env.BACKSTAGE_TEST_DATABASE_POSTGRES16_CONNECTION_STRING = `postgresql://${user}:${password}@${host}:${port}`; + const input = await dbs.init('POSTGRES_16'); + await input.schema.createTable('a', table => + table.string('x').primary(), + ); + await input.insert({ x: 'y' }).into('a'); + + // Look for the mark + const database = input.client.config.connection.database; + const output = knexFactory({ + client: 'pg', + connection: { host, port, user, password, database }, + }); + // eslint-disable-next-line jest/no-standalone-expect + await expect(output.select('x').from('a')).resolves.toEqual([ + { x: 'y' }, + ]); + } finally { + await stop(); + } + }, + ); + + itIfDocker( + 'obeys a provided connection string for postgres 15', + async () => { + const { host, port, user, password, stop } = + await startPostgresContainer('postgres:15'); + + try { + // Leave a mark + process.env.BACKSTAGE_TEST_DATABASE_POSTGRES15_CONNECTION_STRING = `postgresql://${user}:${password}@${host}:${port}`; + const input = await dbs.init('POSTGRES_15'); + await input.schema.createTable('a', table => + table.string('x').primary(), + ); + await input.insert({ x: 'y' }).into('a'); + + // Look for the mark + const database = input.client.config.connection.database; + const output = knexFactory({ + client: 'pg', + connection: { host, port, user, password, database }, + }); + // eslint-disable-next-line jest/no-standalone-expect + await expect(output.select('x').from('a')).resolves.toEqual([ + { x: 'y' }, + ]); + } finally { + await stop(); + } + }, + ); + itIfDocker( 'obeys a provided connection string for postgres 14', async () => { diff --git a/packages/backend-test-utils/src/database/TestDatabases.ts b/packages/backend-test-utils/src/database/TestDatabases.ts index 45d2899dbb..1913075b1f 100644 --- a/packages/backend-test-utils/src/database/TestDatabases.ts +++ b/packages/backend-test-utils/src/database/TestDatabases.ts @@ -44,6 +44,7 @@ const LARGER_POOL_CONFIG = { export class TestDatabases { private readonly instanceById: Map; private readonly supportedIds: TestDatabaseId[]; + private static defaultIds?: TestDatabaseId[]; /** * Creates an empty `TestDatabases` instance, and sets up Jest to clean up @@ -60,18 +61,19 @@ export class TestDatabases { ids?: TestDatabaseId[]; disableDocker?: boolean; }): TestDatabases { - const defaultOptions = { - ids: Object.keys(allDatabases) as TestDatabaseId[], - disableDocker: isDockerDisabledForTests(), - }; + const ids = options?.ids; + const disableDocker = options?.disableDocker ?? isDockerDisabledForTests(); - const { ids, disableDocker } = Object.assign( - {}, - defaultOptions, - options ?? {}, - ); + let testDatabaseIds: TestDatabaseId[]; + if (ids) { + testDatabaseIds = ids; + } else if (TestDatabases.defaultIds) { + testDatabaseIds = TestDatabases.defaultIds; + } else { + testDatabaseIds = Object.keys(allDatabases) as TestDatabaseId[]; + } - const supportedIds = ids.filter(id => { + const supportedIds = testDatabaseIds.filter(id => { const properties = allDatabases[id]; if (!properties) { return false; @@ -107,6 +109,10 @@ export class TestDatabases { return databases; } + static setDefaults(options: { ids?: TestDatabaseId[] }) { + TestDatabases.defaultIds = options.ids; + } + private constructor(supportedIds: TestDatabaseId[]) { this.instanceById = new Map(); this.supportedIds = supportedIds; diff --git a/packages/backend-test-utils/src/database/types.ts b/packages/backend-test-utils/src/database/types.ts index a7bfdeb12d..75c24dc725 100644 --- a/packages/backend-test-utils/src/database/types.ts +++ b/packages/backend-test-utils/src/database/types.ts @@ -24,6 +24,8 @@ import { getDockerImageForName } from '../util/getDockerImageForName'; * @public */ export type TestDatabaseId = + | 'POSTGRES_16' + | 'POSTGRES_15' | 'POSTGRES_14' | 'POSTGRES_13' | 'POSTGRES_12' @@ -47,6 +49,20 @@ export type Instance = { export const allDatabases: Record = Object.freeze({ + POSTGRES_16: { + name: 'Postgres 16.x', + driver: 'pg', + dockerImageName: getDockerImageForName('postgres:16'), + connectionStringEnvironmentVariableName: + 'BACKSTAGE_TEST_DATABASE_POSTGRES16_CONNECTION_STRING', + }, + POSTGRES_15: { + name: 'Postgres 15.x', + driver: 'pg', + dockerImageName: getDockerImageForName('postgres:15'), + connectionStringEnvironmentVariableName: + 'BACKSTAGE_TEST_DATABASE_POSTGRES15_CONNECTION_STRING', + }, POSTGRES_14: { name: 'Postgres 14.x', driver: 'pg', diff --git a/plugins/app-backend/src/lib/assets/StaticAssetsStore.test.ts b/plugins/app-backend/src/lib/assets/StaticAssetsStore.test.ts index f14349a55b..e18d136b9d 100644 --- a/plugins/app-backend/src/lib/assets/StaticAssetsStore.test.ts +++ b/plugins/app-backend/src/lib/assets/StaticAssetsStore.test.ts @@ -37,7 +37,7 @@ jest.setTimeout(60_000); describe('StaticAssetsStore', () => { const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], + ids: ['MYSQL_8', 'POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'], }); it.each(databases.eachSupportedId())( diff --git a/plugins/auth-backend/src/identity/DatabaseKeyStore.test.ts b/plugins/auth-backend/src/identity/DatabaseKeyStore.test.ts index cf415c7e13..f86c4a400b 100644 --- a/plugins/auth-backend/src/identity/DatabaseKeyStore.test.ts +++ b/plugins/auth-backend/src/identity/DatabaseKeyStore.test.ts @@ -28,9 +28,7 @@ const keyBase = { jest.setTimeout(60_000); describe('DatabaseKeyStore', () => { - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); it.each(databases.eachSupportedId())( 'should store a key, %p', diff --git a/plugins/auth-backend/src/migrations.test.ts b/plugins/auth-backend/src/migrations.test.ts index 194bbbf44c..f80b729975 100644 --- a/plugins/auth-backend/src/migrations.test.ts +++ b/plugins/auth-backend/src/migrations.test.ts @@ -42,9 +42,7 @@ async function migrateUntilBefore(knex: Knex, target: string): Promise { jest.setTimeout(60_000); describe('migrations', () => { - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); it.each(databases.eachSupportedId())( '20230428155633_sessions.js, %p', diff --git a/plugins/auth-backend/src/setupTests.ts b/plugins/auth-backend/src/setupTests.ts index d3232290a7..f7c56ef27d 100644 --- a/plugins/auth-backend/src/setupTests.ts +++ b/plugins/auth-backend/src/setupTests.ts @@ -14,4 +14,10 @@ * limitations under the License. */ +import { TestDatabases } from '@backstage/backend-test-utils'; + export {}; + +TestDatabases.setDefaults({ + ids: ['MYSQL_8', 'POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'], +}); diff --git a/plugins/bazaar-backend/src/service/DatabaseHandler.test.ts b/plugins/bazaar-backend/src/service/DatabaseHandler.test.ts index 4e46581240..39fa01ed3f 100644 --- a/plugins/bazaar-backend/src/service/DatabaseHandler.test.ts +++ b/plugins/bazaar-backend/src/service/DatabaseHandler.test.ts @@ -36,7 +36,7 @@ jest.setTimeout(60_000); describe('DatabaseHandler', () => { const databases = TestDatabases.create({ - ids: ['POSTGRES_13', 'POSTGRES_9', 'SQLITE_3', 'MYSQL_8'], + ids: ['POSTGRES_16', 'POSTGRES_12', 'SQLITE_3', 'MYSQL_8'], }); function createDatabaseManager( 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 7d138e4812..9416fa27eb 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 @@ -26,7 +26,7 @@ jest.setTimeout(60_000); describe('WrapperProviders', () => { const applyDatabaseMigrations = jest.fn(); const databases = TestDatabases.create({ - ids: ['POSTGRES_13', 'POSTGRES_9', 'SQLITE_3', 'MYSQL_8'], + ids: ['POSTGRES_16', 'POSTGRES_12', 'SQLITE_3', 'MYSQL_8'], }); const config = new ConfigReader({}); const logger = getVoidLogger(); diff --git a/plugins/catalog-backend/src/database/DefaultCatalogDatabase.test.ts b/plugins/catalog-backend/src/database/DefaultCatalogDatabase.test.ts index bcc20816a4..ebcdc77287 100644 --- a/plugins/catalog-backend/src/database/DefaultCatalogDatabase.test.ts +++ b/plugins/catalog-backend/src/database/DefaultCatalogDatabase.test.ts @@ -25,9 +25,7 @@ jest.setTimeout(60_000); describe('DefaultCatalogDatabase', () => { const defaultLogger = getVoidLogger(); - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); async function createDatabase( databaseId: TestDatabaseId, diff --git a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts index db5153a8ba..080958da9b 100644 --- a/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts +++ b/plugins/catalog-backend/src/database/DefaultProcessingDatabase.test.ts @@ -37,9 +37,7 @@ jest.setTimeout(60_000); describe('DefaultProcessingDatabase', () => { const defaultLogger = getVoidLogger(); - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); async function createDatabase( databaseId: TestDatabaseId, diff --git a/plugins/catalog-backend/src/database/DefaultProviderDatabase.test.ts b/plugins/catalog-backend/src/database/DefaultProviderDatabase.test.ts index 19093b542b..0d124b6d33 100644 --- a/plugins/catalog-backend/src/database/DefaultProviderDatabase.test.ts +++ b/plugins/catalog-backend/src/database/DefaultProviderDatabase.test.ts @@ -28,9 +28,7 @@ jest.setTimeout(60_000); describe('DefaultProviderDatabase', () => { const defaultLogger = getVoidLogger(); - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); async function createDatabase( databaseId: TestDatabaseId, diff --git a/plugins/catalog-backend/src/database/operations/provider/deleteWithEagerPruningOfChildren.test.ts b/plugins/catalog-backend/src/database/operations/provider/deleteWithEagerPruningOfChildren.test.ts index 830cc20480..451f7bc1ac 100644 --- a/plugins/catalog-backend/src/database/operations/provider/deleteWithEagerPruningOfChildren.test.ts +++ b/plugins/catalog-backend/src/database/operations/provider/deleteWithEagerPruningOfChildren.test.ts @@ -28,9 +28,7 @@ import { deleteWithEagerPruningOfChildren } from './deleteWithEagerPruningOfChil jest.setTimeout(60_000); describe('deleteWithEagerPruningOfChildren', () => { - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); async function createDatabase(databaseId: TestDatabaseId) { const knex = await databases.init(databaseId); diff --git a/plugins/catalog-backend/src/database/operations/stitcher/getDeferredStitchableEntities.test.ts b/plugins/catalog-backend/src/database/operations/stitcher/getDeferredStitchableEntities.test.ts index a909515f14..b66dc74ef2 100644 --- a/plugins/catalog-backend/src/database/operations/stitcher/getDeferredStitchableEntities.test.ts +++ b/plugins/catalog-backend/src/database/operations/stitcher/getDeferredStitchableEntities.test.ts @@ -21,9 +21,7 @@ import { getDeferredStitchableEntities } from './getDeferredStitchableEntities'; jest.setTimeout(60_000); describe('getDeferredStitchableEntities', () => { - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); it.each(databases.eachSupportedId())( 'selects the right rows %p', diff --git a/plugins/catalog-backend/src/database/operations/stitcher/markDeferredStitchCompleted.test.ts b/plugins/catalog-backend/src/database/operations/stitcher/markDeferredStitchCompleted.test.ts index 76a6169cf4..b0957e0ec9 100644 --- a/plugins/catalog-backend/src/database/operations/stitcher/markDeferredStitchCompleted.test.ts +++ b/plugins/catalog-backend/src/database/operations/stitcher/markDeferredStitchCompleted.test.ts @@ -22,9 +22,7 @@ import { DbRefreshStateRow } from '../../tables'; jest.setTimeout(60_000); describe('markDeferredStitchCompleted', () => { - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); it.each(databases.eachSupportedId())( 'completes only if unchanged %p', diff --git a/plugins/catalog-backend/src/database/operations/stitcher/markForStitching.test.ts b/plugins/catalog-backend/src/database/operations/stitcher/markForStitching.test.ts index 2cae76040b..011fe54e83 100644 --- a/plugins/catalog-backend/src/database/operations/stitcher/markForStitching.test.ts +++ b/plugins/catalog-backend/src/database/operations/stitcher/markForStitching.test.ts @@ -22,9 +22,7 @@ import { DbFinalEntitiesRow, DbRefreshStateRow } from '../../tables'; jest.setTimeout(60_000); describe('markForStitching', () => { - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); it.each(databases.eachSupportedId())( 'marks the right rows in deferred mode %p', diff --git a/plugins/catalog-backend/src/database/operations/stitcher/performStitching.test.ts b/plugins/catalog-backend/src/database/operations/stitcher/performStitching.test.ts index a471f1dce2..e43424b361 100644 --- a/plugins/catalog-backend/src/database/operations/stitcher/performStitching.test.ts +++ b/plugins/catalog-backend/src/database/operations/stitcher/performStitching.test.ts @@ -30,9 +30,7 @@ import { performStitching } from './performStitching'; jest.setTimeout(60_000); describe('performStitching', () => { - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); const logger = getVoidLogger(); // NOTE(freben): Testing the deferred path since it's a superset of the immediate one diff --git a/plugins/catalog-backend/src/database/operations/util/deleteOrphanedEntities.test.ts b/plugins/catalog-backend/src/database/operations/util/deleteOrphanedEntities.test.ts index 3dacc8f09b..1dc8a42d5f 100644 --- a/plugins/catalog-backend/src/database/operations/util/deleteOrphanedEntities.test.ts +++ b/plugins/catalog-backend/src/database/operations/util/deleteOrphanedEntities.test.ts @@ -29,9 +29,7 @@ import { deleteOrphanedEntities } from './deleteOrphanedEntities'; jest.setTimeout(60_000); describe('deleteOrphanedEntities', () => { - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); async function createDatabase(databaseId: TestDatabaseId) { const knex = await databases.init(databaseId); diff --git a/plugins/catalog-backend/src/modules/core/DefaultLocationStore.test.ts b/plugins/catalog-backend/src/modules/core/DefaultLocationStore.test.ts index fca7faacf8..61eef2b8e5 100644 --- a/plugins/catalog-backend/src/modules/core/DefaultLocationStore.test.ts +++ b/plugins/catalog-backend/src/modules/core/DefaultLocationStore.test.ts @@ -22,9 +22,7 @@ import { DefaultLocationStore } from './DefaultLocationStore'; jest.setTimeout(60_000); describe('DefaultLocationStore', () => { - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); async function createLocationStore(databaseId: TestDatabaseId) { const knex = await databases.init(databaseId); diff --git a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts index fde3408c4b..fe7d57c89a 100644 --- a/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts +++ b/plugins/catalog-backend/src/service/DefaultEntitiesCatalog.test.ts @@ -44,9 +44,7 @@ describe('DefaultEntitiesCatalog', () => { await knex.destroy(); }); - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); const stitch = jest.fn(); const stitcher: Stitcher = { stitch } as any; diff --git a/plugins/catalog-backend/src/service/DefaultRefreshService.test.ts b/plugins/catalog-backend/src/service/DefaultRefreshService.test.ts index 5b29bb34d5..e1b775cce6 100644 --- a/plugins/catalog-backend/src/service/DefaultRefreshService.test.ts +++ b/plugins/catalog-backend/src/service/DefaultRefreshService.test.ts @@ -39,9 +39,7 @@ jest.setTimeout(60_000); describe('DefaultRefreshService', () => { const defaultLogger = getVoidLogger(); - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); async function createDatabase( databaseId: TestDatabaseId, diff --git a/plugins/catalog-backend/src/setupTests.ts b/plugins/catalog-backend/src/setupTests.ts index d3232290a7..f7c56ef27d 100644 --- a/plugins/catalog-backend/src/setupTests.ts +++ b/plugins/catalog-backend/src/setupTests.ts @@ -14,4 +14,10 @@ * limitations under the License. */ +import { TestDatabases } from '@backstage/backend-test-utils'; + export {}; + +TestDatabases.setDefaults({ + ids: ['MYSQL_8', 'POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'], +}); diff --git a/plugins/catalog-backend/src/stitching/DefaultStitcher.test.ts b/plugins/catalog-backend/src/stitching/DefaultStitcher.test.ts index 5b33fc424c..5e7ba7ef71 100644 --- a/plugins/catalog-backend/src/stitching/DefaultStitcher.test.ts +++ b/plugins/catalog-backend/src/stitching/DefaultStitcher.test.ts @@ -30,9 +30,7 @@ import { DefaultStitcher } from './DefaultStitcher'; jest.setTimeout(60_000); describe('Stitcher', () => { - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); const logger = getVoidLogger(); it.each(databases.eachSupportedId())( diff --git a/plugins/catalog-backend/src/tests/migrations.test.ts b/plugins/catalog-backend/src/tests/migrations.test.ts index aa305598aa..d961427f5e 100644 --- a/plugins/catalog-backend/src/tests/migrations.test.ts +++ b/plugins/catalog-backend/src/tests/migrations.test.ts @@ -42,9 +42,7 @@ async function migrateUntilBefore(knex: Knex, target: string): Promise { jest.setTimeout(60_000); describe('migrations', () => { - const databases = TestDatabases.create({ - ids: ['MYSQL_8', 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], - }); + const databases = TestDatabases.create(); it.each(databases.eachSupportedId())( 'latest version correctly cascades deletions, %p', diff --git a/plugins/catalog-backend/src/tests/performance/stitchingPerformance.test.ts b/plugins/catalog-backend/src/tests/performance/stitchingPerformance.test.ts index 7902a5e230..e0d3f87124 100644 --- a/plugins/catalog-backend/src/tests/performance/stitchingPerformance.test.ts +++ b/plugins/catalog-backend/src/tests/performance/stitchingPerformance.test.ts @@ -155,7 +155,7 @@ class Tracker { describePerformanceTest('stitchingPerformance', () => { const databases = TestDatabases.create({ - ids: [/* 'MYSQL_8', */ 'POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], + ids: [/* 'MYSQL_8', */ 'POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'], }); it.each(databases.eachSupportedId())( 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 781805b3a3..38d997c836 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_13', 'POSTGRES_9'], + ids: ['POSTGRES_16', 'POSTGRES_12'], }); if (databases.eachSupportedId().length < 1) { diff --git a/plugins/tech-insights-backend/src/service/fact/FactRetrieverEngine.test.ts b/plugins/tech-insights-backend/src/service/fact/FactRetrieverEngine.test.ts index 5473b28c62..677b778b9b 100644 --- a/plugins/tech-insights-backend/src/service/fact/FactRetrieverEngine.test.ts +++ b/plugins/tech-insights-backend/src/service/fact/FactRetrieverEngine.test.ts @@ -117,7 +117,7 @@ describe('FactRetrieverEngine', () => { } const databases = TestDatabases.create({ - ids: ['POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], + ids: ['POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'], }); async function createEngine( diff --git a/plugins/vault-backend/src/service/router.test.ts b/plugins/vault-backend/src/service/router.test.ts index 97997b30ef..3fb78a6e8d 100644 --- a/plugins/vault-backend/src/service/router.test.ts +++ b/plugins/vault-backend/src/service/router.test.ts @@ -26,7 +26,7 @@ import { createRouter } from './router'; describe('createRouter', () => { let app: express.Express; const databases = TestDatabases.create({ - ids: ['POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], + ids: ['POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'], }); beforeAll(async () => { diff --git a/plugins/vault-backend/src/service/standaloneApplication.ts b/plugins/vault-backend/src/service/standaloneApplication.ts index ba4c0edc3e..c0a011c61c 100644 --- a/plugins/vault-backend/src/service/standaloneApplication.ts +++ b/plugins/vault-backend/src/service/standaloneApplication.ts @@ -48,7 +48,7 @@ export async function createStandaloneApplication( const app = express(); const databases = TestDatabases.create({ - ids: ['POSTGRES_13', 'POSTGRES_9', 'SQLITE_3'], + ids: ['POSTGRES_16', 'POSTGRES_12', 'SQLITE_3'], }); const knex = await databases.init('SQLITE_3'); const databaseManager: Partial = {