Introduced version policy for PostgreSQL
Signed-off-by: Andre Wanlin <awanlin@spotify.com> Added changeset Signed-off-by: Andre Wanlin <awanlin@spotify.com> Updated API Report Signed-off-by: Andre Wanlin <awanlin@spotify.com> Updated references to use 12 and 16 Signed-off-by: Andre Wanlin <awanlin@spotify.com> Attempt to fix tests Signed-off-by: Andre Wanlin <awanlin@spotify.com> Added back old Ids Signed-off-by: Andre Wanlin <awanlin@spotify.com> Fixed test Signed-off-by: Andre Wanlin <awanlin@spotify.com> Updated API Report and test Signed-off-by: Andre Wanlin <awanlin@spotify.com> Added new setDefaults static method and related changes Signed-off-by: Andre Wanlin <awanlin@spotify.com> Updated API Report Signed-off-by: Andre Wanlin <awanlin@spotify.com> Improved logic based on feedback Signed-off-by: Andre Wanlin <awanlin@spotify.com> Added missing changeset Signed-off-by: Andre Wanlin <awanlin@spotify.com> Changes based on feedback Signed-off-by: Andre Wanlin <awanlin@spotify.com> API Report correction Signed-off-by: Andre Wanlin <awanlin@spotify.com> Updated to use new setDefaults Signed-off-by: Andre Wanlin <awanlin@spotify.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-vault-backend': patch
|
||||
---
|
||||
|
||||
Updated to test using PostgreSQL 12 and 16
|
||||
@@ -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.
|
||||
@@ -15,7 +15,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: postgres
|
||||
image: postgres:13.2-alpine
|
||||
image: postgres:12-alpine
|
||||
imagePullPolicy: 'IfNotPresent'
|
||||
ports:
|
||||
- containerPort: 5432
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:latest
|
||||
image: postgres:12
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -42,9 +42,7 @@ async function migrateUntilBefore(knex: Knex, target: string): Promise<void> {
|
||||
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',
|
||||
|
||||
@@ -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'],
|
||||
});
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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',
|
||||
],
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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(() => {
|
||||
|
||||
@@ -307,6 +307,8 @@ export interface TestBackendOptions<TExtensionPoints extends any[]> {
|
||||
|
||||
// @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<Knex>;
|
||||
// (undocumented)
|
||||
static setDefaults(options: { ids?: TestDatabaseId[] }): void;
|
||||
// (undocumented)
|
||||
supports(id: TestDatabaseId): boolean;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -44,6 +44,7 @@ const LARGER_POOL_CONFIG = {
|
||||
export class TestDatabases {
|
||||
private readonly instanceById: Map<string, Instance>;
|
||||
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;
|
||||
|
||||
@@ -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<TestDatabaseId, TestDatabaseProperties> =
|
||||
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',
|
||||
|
||||
@@ -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())(
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -42,9 +42,7 @@ async function migrateUntilBefore(knex: Knex, target: string): Promise<void> {
|
||||
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',
|
||||
|
||||
@@ -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'],
|
||||
});
|
||||
|
||||
@@ -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(
|
||||
|
||||
+1
-1
@@ -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();
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
+1
-3
@@ -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);
|
||||
|
||||
+1
-3
@@ -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',
|
||||
|
||||
+1
-3
@@ -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',
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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'],
|
||||
});
|
||||
|
||||
@@ -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())(
|
||||
|
||||
@@ -42,9 +42,7 @@ async function migrateUntilBefore(knex: Knex, target: string): Promise<void> {
|
||||
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',
|
||||
|
||||
@@ -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())(
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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 () => {
|
||||
|
||||
@@ -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<DatabaseManager> = {
|
||||
|
||||
Reference in New Issue
Block a user