@backstage/backend-test-utils 0.1.34-next.2 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +1 -1
- package/alpha/package.json +1 -1
- package/dist/index.alpha.d.ts +17 -17
- package/dist/index.beta.d.ts +83 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +83 -4
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @backstage/backend-test-utils
|
|
2
2
|
|
|
3
|
+
## 0.1.34
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- baf6e4c96a: Removed unnecessary `@backstage/cli` dependency.
|
|
8
|
+
- c51efce2a0: Update docs to always use `yarn add --cwd` for app & backend
|
|
9
|
+
- 1835311713: Added explicit return type signature for `mockServices.config()`.
|
|
10
|
+
- e716946103: Updated usage of the lifecycle service.
|
|
11
|
+
- 7e7557a2be: Updated the `mockServices.rootLogger` options to accept a single level option instead.
|
|
12
|
+
- 610d65e143: Updates to match new `BackendFeature` type.
|
|
13
|
+
- e412d33025: Use the new `*ServiceFactory` exports from `@backstage/backend-app-api`
|
|
14
|
+
- b86efa2d04: Updated usage of `ServiceFactory`.
|
|
15
|
+
- 17b573e4be: The new backend system testing utilities have now been marked as stable API.
|
|
16
|
+
- f1adb2e36b: Removed the `ref` from all `mockServices`.
|
|
17
|
+
- d0901c9ba4: All mock service factories and mock service implementations are now available via the new experimental `mockServices` export.
|
|
18
|
+
- 71a5ec0f06: Updated usages of `LogMeta`.
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @backstage/backend-app-api@0.4.0
|
|
21
|
+
- @backstage/backend-plugin-api@0.4.0
|
|
22
|
+
- @backstage/backend-common@0.18.2
|
|
23
|
+
- @backstage/config@1.0.6
|
|
24
|
+
- @backstage/types@1.0.2
|
|
25
|
+
- @backstage/plugin-auth-node@0.2.11
|
|
26
|
+
|
|
3
27
|
## 0.1.34-next.2
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ Test helpers library for Backstage backends.
|
|
|
7
7
|
Add the library as a `devDependency` to your backend package:
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
# From
|
|
10
|
+
# From your Backstage root directory, go to your backend package, or to a backend plugin
|
|
11
11
|
cd plugins/my-plugin-backend
|
|
12
12
|
yarn add --dev @backstage/backend-test-utils
|
|
13
13
|
```
|
package/alpha/package.json
CHANGED
package/dist/index.alpha.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ import { UrlReaderService } from '@backstage/backend-plugin-api';
|
|
|
30
30
|
export declare function isDockerDisabledForTests(): boolean;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
|
-
* @
|
|
33
|
+
* @public
|
|
34
34
|
*/
|
|
35
35
|
export declare namespace mockServices {
|
|
36
36
|
export function config(options?: config.Options): ConfigService;
|
|
@@ -38,49 +38,49 @@ export declare namespace mockServices {
|
|
|
38
38
|
export type Options = {
|
|
39
39
|
data?: JsonObject;
|
|
40
40
|
};
|
|
41
|
-
const factory: (options?: Options | undefined) => ServiceFactory<ConfigService>;
|
|
41
|
+
const factory: (options?: Options | undefined) => ServiceFactory<ConfigService, "root">;
|
|
42
42
|
}
|
|
43
43
|
export function rootLogger(options?: rootLogger.Options): LoggerService;
|
|
44
44
|
export namespace rootLogger {
|
|
45
45
|
export type Options = {
|
|
46
46
|
level?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
47
47
|
};
|
|
48
|
-
const factory: (options?: Options | undefined) => ServiceFactory<LoggerService>;
|
|
48
|
+
const factory: (options?: Options | undefined) => ServiceFactory<LoggerService, "root">;
|
|
49
49
|
}
|
|
50
50
|
export function tokenManager(): TokenManagerService;
|
|
51
51
|
export namespace tokenManager {
|
|
52
|
-
const factory: () => ServiceFactory<TokenManagerService>;
|
|
52
|
+
const factory: () => ServiceFactory<TokenManagerService, "plugin">;
|
|
53
53
|
}
|
|
54
54
|
export function identity(): IdentityService;
|
|
55
55
|
export namespace identity {
|
|
56
|
-
const factory: () => ServiceFactory<IdentityService>;
|
|
56
|
+
const factory: () => ServiceFactory<IdentityService, "plugin">;
|
|
57
57
|
}
|
|
58
58
|
export namespace cache {
|
|
59
|
-
const factory: () => ServiceFactory<CacheService>;
|
|
59
|
+
const factory: () => ServiceFactory<CacheService, "plugin">;
|
|
60
60
|
}
|
|
61
61
|
export namespace database {
|
|
62
|
-
const factory: () => ServiceFactory<DatabaseService>;
|
|
62
|
+
const factory: () => ServiceFactory<DatabaseService, "plugin">;
|
|
63
63
|
}
|
|
64
64
|
export namespace httpRouter {
|
|
65
|
-
const factory: (options?: HttpRouterFactoryOptions | undefined) => ServiceFactory<HttpRouterService>;
|
|
65
|
+
const factory: (options?: HttpRouterFactoryOptions | undefined) => ServiceFactory<HttpRouterService, "plugin">;
|
|
66
66
|
}
|
|
67
67
|
export namespace lifecycle {
|
|
68
|
-
const factory: () => ServiceFactory<LifecycleService>;
|
|
68
|
+
const factory: () => ServiceFactory<LifecycleService, "plugin">;
|
|
69
69
|
}
|
|
70
70
|
export namespace logger {
|
|
71
|
-
const factory: () => ServiceFactory<LoggerService>;
|
|
71
|
+
const factory: () => ServiceFactory<LoggerService, "plugin">;
|
|
72
72
|
}
|
|
73
73
|
export namespace permissions {
|
|
74
|
-
const factory: () => ServiceFactory<PermissionsService>;
|
|
74
|
+
const factory: () => ServiceFactory<PermissionsService, "plugin">;
|
|
75
75
|
}
|
|
76
76
|
export namespace rootLifecycle {
|
|
77
|
-
const factory: () => ServiceFactory<RootLifecycleService>;
|
|
77
|
+
const factory: () => ServiceFactory<RootLifecycleService, "root">;
|
|
78
78
|
}
|
|
79
79
|
export namespace scheduler {
|
|
80
|
-
const factory: () => ServiceFactory<SchedulerService>;
|
|
80
|
+
const factory: () => ServiceFactory<SchedulerService, "plugin">;
|
|
81
81
|
}
|
|
82
82
|
export namespace urlReader {
|
|
83
|
-
const factory: () => ServiceFactory<UrlReaderService>;
|
|
83
|
+
const factory: () => ServiceFactory<UrlReaderService, "plugin">;
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -95,10 +95,10 @@ export declare function setupRequestMockHandlers(worker: {
|
|
|
95
95
|
resetHandlers: () => void;
|
|
96
96
|
}): void;
|
|
97
97
|
|
|
98
|
-
/** @
|
|
98
|
+
/** @public */
|
|
99
99
|
export declare function startTestBackend<TServices extends any[], TExtensionPoints extends any[]>(options: TestBackendOptions<TServices, TExtensionPoints>): Promise<TestBackend>;
|
|
100
100
|
|
|
101
|
-
/** @
|
|
101
|
+
/** @public */
|
|
102
102
|
export declare interface TestBackend extends Backend {
|
|
103
103
|
/**
|
|
104
104
|
* Provides access to the underling HTTP server for use with utilities
|
|
@@ -109,7 +109,7 @@ export declare interface TestBackend extends Backend {
|
|
|
109
109
|
readonly server: ExtendedHttpServer;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
/** @
|
|
112
|
+
/** @public */
|
|
113
113
|
export declare interface TestBackendOptions<TServices extends any[], TExtensionPoints extends any[]> {
|
|
114
114
|
services?: readonly [
|
|
115
115
|
...{
|
package/dist/index.beta.d.ts
CHANGED
|
@@ -29,7 +29,60 @@ import { UrlReaderService } from '@backstage/backend-plugin-api';
|
|
|
29
29
|
/** @public */
|
|
30
30
|
export declare function isDockerDisabledForTests(): boolean;
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export declare namespace mockServices {
|
|
36
|
+
export function config(options?: config.Options): ConfigService;
|
|
37
|
+
export namespace config {
|
|
38
|
+
export type Options = {
|
|
39
|
+
data?: JsonObject;
|
|
40
|
+
};
|
|
41
|
+
const factory: (options?: Options | undefined) => ServiceFactory<ConfigService, "root">;
|
|
42
|
+
}
|
|
43
|
+
export function rootLogger(options?: rootLogger.Options): LoggerService;
|
|
44
|
+
export namespace rootLogger {
|
|
45
|
+
export type Options = {
|
|
46
|
+
level?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
47
|
+
};
|
|
48
|
+
const factory: (options?: Options | undefined) => ServiceFactory<LoggerService, "root">;
|
|
49
|
+
}
|
|
50
|
+
export function tokenManager(): TokenManagerService;
|
|
51
|
+
export namespace tokenManager {
|
|
52
|
+
const factory: () => ServiceFactory<TokenManagerService, "plugin">;
|
|
53
|
+
}
|
|
54
|
+
export function identity(): IdentityService;
|
|
55
|
+
export namespace identity {
|
|
56
|
+
const factory: () => ServiceFactory<IdentityService, "plugin">;
|
|
57
|
+
}
|
|
58
|
+
export namespace cache {
|
|
59
|
+
const factory: () => ServiceFactory<CacheService, "plugin">;
|
|
60
|
+
}
|
|
61
|
+
export namespace database {
|
|
62
|
+
const factory: () => ServiceFactory<DatabaseService, "plugin">;
|
|
63
|
+
}
|
|
64
|
+
export namespace httpRouter {
|
|
65
|
+
const factory: (options?: HttpRouterFactoryOptions | undefined) => ServiceFactory<HttpRouterService, "plugin">;
|
|
66
|
+
}
|
|
67
|
+
export namespace lifecycle {
|
|
68
|
+
const factory: () => ServiceFactory<LifecycleService, "plugin">;
|
|
69
|
+
}
|
|
70
|
+
export namespace logger {
|
|
71
|
+
const factory: () => ServiceFactory<LoggerService, "plugin">;
|
|
72
|
+
}
|
|
73
|
+
export namespace permissions {
|
|
74
|
+
const factory: () => ServiceFactory<PermissionsService, "plugin">;
|
|
75
|
+
}
|
|
76
|
+
export namespace rootLifecycle {
|
|
77
|
+
const factory: () => ServiceFactory<RootLifecycleService, "root">;
|
|
78
|
+
}
|
|
79
|
+
export namespace scheduler {
|
|
80
|
+
const factory: () => ServiceFactory<SchedulerService, "plugin">;
|
|
81
|
+
}
|
|
82
|
+
export namespace urlReader {
|
|
83
|
+
const factory: () => ServiceFactory<UrlReaderService, "plugin">;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
33
86
|
|
|
34
87
|
/**
|
|
35
88
|
* Sets up handlers for request mocking
|
|
@@ -42,11 +95,37 @@ export declare function setupRequestMockHandlers(worker: {
|
|
|
42
95
|
resetHandlers: () => void;
|
|
43
96
|
}): void;
|
|
44
97
|
|
|
45
|
-
|
|
98
|
+
/** @public */
|
|
99
|
+
export declare function startTestBackend<TServices extends any[], TExtensionPoints extends any[]>(options: TestBackendOptions<TServices, TExtensionPoints>): Promise<TestBackend>;
|
|
46
100
|
|
|
47
|
-
|
|
101
|
+
/** @public */
|
|
102
|
+
export declare interface TestBackend extends Backend {
|
|
103
|
+
/**
|
|
104
|
+
* Provides access to the underling HTTP server for use with utilities
|
|
105
|
+
* such as `supertest`.
|
|
106
|
+
*
|
|
107
|
+
* If the root http router service has been replaced, this will throw an error.
|
|
108
|
+
*/
|
|
109
|
+
readonly server: ExtendedHttpServer;
|
|
110
|
+
}
|
|
48
111
|
|
|
49
|
-
|
|
112
|
+
/** @public */
|
|
113
|
+
export declare interface TestBackendOptions<TServices extends any[], TExtensionPoints extends any[]> {
|
|
114
|
+
services?: readonly [
|
|
115
|
+
...{
|
|
116
|
+
[index in keyof TServices]: ServiceFactory<TServices[index]> | (() => ServiceFactory<TServices[index]>) | [ServiceRef<TServices[index]>, Partial<TServices[index]>];
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
extensionPoints?: readonly [
|
|
120
|
+
...{
|
|
121
|
+
[index in keyof TExtensionPoints]: [
|
|
122
|
+
ExtensionPoint<TExtensionPoints[index]>,
|
|
123
|
+
Partial<TExtensionPoints[index]>
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
];
|
|
127
|
+
features?: BackendFeature[];
|
|
128
|
+
}
|
|
50
129
|
|
|
51
130
|
/**
|
|
52
131
|
* The possible databases to test against.
|
package/dist/index.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs.js","sources":["../src/util/isDockerDisabledForTests.ts","../src/database/startMysqlContainer.ts","../src/database/startPostgresContainer.ts","../src/database/types.ts","../src/database/TestDatabases.ts","../src/msw/setupRequestMockHandlers.ts","../src/next/services/MockIdentityService.ts","../src/next/services/MockRootLoggerService.ts","../src/next/services/mockServices.ts","../src/next/wiring/TestBackend.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @public */\nexport function isDockerDisabledForTests() {\n // If we are not running in continuous integration, the default is to skip\n // the (relatively heavy, long running) docker based tests. If you want to\n // still run local tests for all databases, just pass either the CI=1 env\n // parameter to your test runner, or individual connection strings per\n // database.\n return (\n Boolean(process.env.BACKSTAGE_TEST_DISABLE_DOCKER) ||\n !Boolean(process.env.CI)\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport createConnection, { Knex } from 'knex';\nimport { v4 as uuid } from 'uuid';\n\nasync function waitForMysqlReady(\n connection: Knex.MySqlConnectionConfig,\n): Promise<void> {\n const startTime = Date.now();\n const db = createConnection({ client: 'mysql2', connection });\n\n try {\n for (;;) {\n try {\n const result = await db.select(db.raw('version() AS version'));\n if (result[0]?.version) {\n return;\n }\n } catch (e) {\n if (Date.now() - startTime > 30_000) {\n throw new Error(\n `Timed out waiting for the database to be ready for connections, ${e}`,\n );\n }\n }\n\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n } finally {\n db.destroy();\n }\n}\n\nexport async function startMysqlContainer(image: string) {\n const user = 'root';\n const password = uuid();\n\n // Lazy-load to avoid side-effect of importing testcontainers\n const { GenericContainer } = await import('testcontainers');\n\n const container = await new GenericContainer(image)\n .withExposedPorts(3306)\n .withEnv('MYSQL_ROOT_PASSWORD', password)\n .withTmpFs({ '/var/lib/mysql': 'rw' })\n .start();\n\n const host = container.getHost();\n const port = container.getMappedPort(3306);\n const stop = async () => {\n await container.stop({ timeout: 10_000 });\n };\n\n await waitForMysqlReady({ host, port, user, password });\n\n return { host, port, user, password, stop };\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport createConnection, { Knex } from 'knex';\nimport { v4 as uuid } from 'uuid';\n\nasync function waitForPostgresReady(\n connection: Knex.PgConnectionConfig,\n): Promise<void> {\n const startTime = Date.now();\n const db = createConnection({ client: 'pg', connection });\n\n try {\n for (;;) {\n try {\n const result = await db.select(db.raw('version()'));\n if (Array.isArray(result) && result[0]?.version) {\n return;\n }\n } catch (e) {\n if (Date.now() - startTime > 30_000) {\n throw new Error(\n `Timed out waiting for the database to be ready for connections, ${e}`,\n );\n }\n }\n\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n } finally {\n db.destroy();\n }\n}\n\nexport async function startPostgresContainer(image: string) {\n const user = 'postgres';\n const password = uuid();\n\n // Lazy-load to avoid side-effect of importing testcontainers\n const { GenericContainer } = await import('testcontainers');\n\n const container = await new GenericContainer(image)\n .withExposedPorts(5432)\n .withEnv('POSTGRES_PASSWORD', password)\n .withTmpFs({ '/var/lib/postgresql/data': 'rw' })\n .start();\n\n const host = container.getHost();\n const port = container.getMappedPort(5432);\n const stop = async () => {\n await container.stop({ timeout: 10_000 });\n };\n\n await waitForPostgresReady({ host, port, user, password });\n\n return { host, port, user, password, stop };\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DatabaseManager } from '@backstage/backend-common';\nimport { Knex } from 'knex';\n\n/**\n * The possible databases to test against.\n *\n * @public\n */\nexport type TestDatabaseId =\n | 'POSTGRES_13'\n | 'POSTGRES_9'\n | 'MYSQL_8'\n | 'SQLITE_3';\n\nexport type TestDatabaseProperties = {\n name: string;\n driver: string;\n dockerImageName?: string;\n connectionStringEnvironmentVariableName?: string;\n};\n\nexport type Instance = {\n stopContainer?: () => Promise<void>;\n databaseManager: DatabaseManager;\n connections: Array<Knex>;\n};\n\nexport const allDatabases: Record<TestDatabaseId, TestDatabaseProperties> =\n Object.freeze({\n POSTGRES_13: {\n name: 'Postgres 13.x',\n driver: 'pg',\n dockerImageName: 'postgres:13',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING',\n },\n POSTGRES_9: {\n name: 'Postgres 9.x',\n driver: 'pg',\n dockerImageName: 'postgres:9',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING',\n },\n MYSQL_8: {\n name: 'MySQL 8.x',\n driver: 'mysql2',\n dockerImageName: 'mysql:8',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING',\n },\n SQLITE_3: {\n name: 'SQLite 3.x',\n driver: 'better-sqlite3',\n },\n });\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DatabaseManager } from '@backstage/backend-common';\nimport { ConfigReader } from '@backstage/config';\nimport { randomBytes } from 'crypto';\nimport { Knex } from 'knex';\nimport { isDockerDisabledForTests } from '../util/isDockerDisabledForTests';\nimport { startMysqlContainer } from './startMysqlContainer';\nimport { startPostgresContainer } from './startPostgresContainer';\nimport {\n allDatabases,\n Instance,\n TestDatabaseId,\n TestDatabaseProperties,\n} from './types';\n\nconst LARGER_POOL_CONFIG = {\n pool: {\n min: 0,\n max: 50,\n },\n};\n\n/**\n * Encapsulates the creation of ephemeral test database instances for use\n * inside unit or integration tests.\n *\n * @public\n */\nexport class TestDatabases {\n private readonly instanceById: Map<string, Instance>;\n private readonly supportedIds: TestDatabaseId[];\n\n /**\n * Creates an empty `TestDatabases` instance, and sets up Jest to clean up\n * all of its acquired resources after all tests finish.\n *\n * You typically want to create just a single instance like this at the top\n * of your test file or `describe` block, and then call `init` many times on\n * that instance inside the individual tests. Spinning up a \"physical\"\n * database instance takes a considerable amount of time, slowing down tests.\n * But initializing a new logical database inside that instance using `init`\n * is very fast.\n */\n static create(options?: {\n ids?: TestDatabaseId[];\n disableDocker?: boolean;\n }): TestDatabases {\n const defaultOptions = {\n ids: Object.keys(allDatabases) as TestDatabaseId[],\n disableDocker: isDockerDisabledForTests(),\n };\n\n const { ids, disableDocker } = Object.assign(\n {},\n defaultOptions,\n options ?? {},\n );\n\n const supportedIds = ids.filter(id => {\n const properties = allDatabases[id];\n if (!properties) {\n return false;\n }\n // If the caller has set up the env with an explicit connection string,\n // we'll assume that this database will work\n if (\n properties.connectionStringEnvironmentVariableName &&\n process.env[properties.connectionStringEnvironmentVariableName]\n ) {\n return true;\n }\n // If the database doesn't require docker at all, there's nothing to worry\n // about\n if (!properties.dockerImageName) {\n return true;\n }\n // If the database requires docker, but docker is disabled, we will fail.\n if (disableDocker) {\n return false;\n }\n return true;\n });\n\n const databases = new TestDatabases(supportedIds);\n\n if (supportedIds.length > 0) {\n afterAll(async () => {\n await databases.shutdown();\n });\n }\n\n return databases;\n }\n\n private constructor(supportedIds: TestDatabaseId[]) {\n this.instanceById = new Map();\n this.supportedIds = supportedIds;\n }\n\n supports(id: TestDatabaseId): boolean {\n return this.supportedIds.includes(id);\n }\n\n eachSupportedId(): [TestDatabaseId][] {\n return this.supportedIds.map(id => [id]);\n }\n\n /**\n * Returns a fresh, unique, empty logical database on an instance of the\n * given database ID platform.\n *\n * @param id - The ID of the database platform to use, e.g. 'POSTGRES_13'\n * @returns A `Knex` connection object\n */\n async init(id: TestDatabaseId): Promise<Knex> {\n const properties = allDatabases[id];\n if (!properties) {\n const candidates = Object.keys(allDatabases).join(', ');\n throw new Error(\n `Unknown test database ${id}, possible values are ${candidates}`,\n );\n }\n if (!this.supportedIds.includes(id)) {\n const candidates = this.supportedIds.join(', ');\n throw new Error(\n `Unsupported test database ${id} for this environment, possible values are ${candidates}`,\n );\n }\n\n let instance: Instance | undefined = this.instanceById.get(id);\n\n // Ensure that a testcontainers instance is up for this ID\n if (!instance) {\n instance = await this.initAny(properties);\n this.instanceById.set(id, instance);\n }\n\n // Ensure that a unique logical database is created in the instance\n const connection = await instance.databaseManager\n .forPlugin(`db${randomBytes(16).toString('hex')}`)\n .getClient();\n\n instance.connections.push(connection);\n\n return connection;\n }\n\n private async initAny(properties: TestDatabaseProperties): Promise<Instance> {\n // Use the connection string if provided\n if (properties.driver === 'pg' || properties.driver === 'mysql2') {\n const envVarName = properties.connectionStringEnvironmentVariableName;\n if (envVarName) {\n const connectionString = process.env[envVarName];\n if (connectionString) {\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n knexConfig: properties.driver.includes('sqlite')\n ? {}\n : LARGER_POOL_CONFIG,\n client: properties.driver,\n connection: connectionString,\n },\n },\n }),\n );\n return {\n databaseManager,\n connections: [],\n };\n }\n }\n }\n\n // Otherwise start a container for the purpose\n switch (properties.driver) {\n case 'pg':\n return this.initPostgres(properties);\n case 'mysql2':\n return this.initMysql(properties);\n case 'better-sqlite3':\n case 'sqlite3':\n return this.initSqlite(properties);\n default:\n throw new Error(`Unknown database driver ${properties.driver}`);\n }\n }\n\n private async initPostgres(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const { host, port, user, password, stop } = await startPostgresContainer(\n properties.dockerImageName!,\n );\n\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n knexConfig: LARGER_POOL_CONFIG,\n client: 'pg',\n connection: { host, port, user, password },\n },\n },\n }),\n );\n\n return {\n stopContainer: stop,\n databaseManager,\n connections: [],\n };\n }\n\n private async initMysql(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const { host, port, user, password, stop } = await startMysqlContainer(\n properties.dockerImageName!,\n );\n\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n knexConfig: LARGER_POOL_CONFIG,\n client: 'mysql2',\n connection: { host, port, user, password },\n },\n },\n }),\n );\n\n return {\n stopContainer: stop,\n databaseManager,\n connections: [],\n };\n }\n\n private async initSqlite(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n client: properties.driver,\n connection: ':memory:',\n },\n },\n }),\n );\n\n return {\n databaseManager,\n connections: [],\n };\n }\n\n private async shutdown() {\n const instances = [...this.instanceById.values()];\n await Promise.all(\n instances.map(async ({ stopContainer, connections }) => {\n try {\n await Promise.all(connections.map(c => c.destroy()));\n } catch {\n // ignore\n }\n try {\n await stopContainer?.();\n } catch {\n // ignore\n }\n }),\n );\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Sets up handlers for request mocking\n * @public\n * @param worker - service worker\n */\nexport function setupRequestMockHandlers(worker: {\n listen: (t: any) => void;\n close: () => void;\n resetHandlers: () => void;\n}) {\n beforeAll(() => worker.listen({ onUnhandledRequest: 'error' }));\n afterAll(() => worker.close());\n afterEach(() => worker.resetHandlers());\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { IdentityService } from '@backstage/backend-plugin-api';\nimport {\n IdentityApiGetIdentityRequest,\n BackstageIdentityResponse,\n} from '@backstage/plugin-auth-node';\n\nexport class MockIdentityService implements IdentityService {\n getIdentity(\n _options: IdentityApiGetIdentityRequest,\n ): Promise<BackstageIdentityResponse | undefined> {\n return Promise.resolve({\n token: 'mock-token',\n identity: {\n type: 'user',\n userEntityRef: 'user:default/mock-user',\n ownershipEntityRefs: [],\n },\n });\n }\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n LoggerService,\n RootLoggerService,\n} from '@backstage/backend-plugin-api';\nimport { JsonObject } from '@backstage/types';\nimport type { mockServices } from './mockServices';\n\nconst levels = {\n none: 0,\n error: 1,\n warn: 2,\n info: 3,\n debug: 4,\n};\n\nexport class MockRootLoggerService implements RootLoggerService {\n #level: number;\n #meta: JsonObject;\n\n static create(\n options?: mockServices.rootLogger.Options,\n ): MockRootLoggerService {\n const level = options?.level ?? 'none';\n if (!(level in levels)) {\n throw new Error(`Invalid log level '${level}'`);\n }\n return new MockRootLoggerService(levels[level], {});\n }\n\n error(message: string, meta?: JsonObject | Error | undefined): void {\n this.#log('error', message, meta);\n }\n\n warn(message: string, meta?: JsonObject | Error | undefined): void {\n this.#log('warn', message, meta);\n }\n\n info(message: string, meta?: JsonObject | Error | undefined): void {\n this.#log('info', message, meta);\n }\n\n debug(message: string, meta?: JsonObject | Error | undefined): void {\n this.#log('debug', message, meta);\n }\n\n child(meta: JsonObject): LoggerService {\n return new MockRootLoggerService(this.#level, { ...this.#meta, ...meta });\n }\n\n private constructor(level: number, meta: JsonObject) {\n this.#level = level;\n this.#meta = meta;\n }\n\n #log(\n level: 'error' | 'warn' | 'info' | 'debug',\n message: string,\n meta?: JsonObject | Error | undefined,\n ) {\n const levelValue = levels[level] ?? 0;\n if (levelValue <= this.#level) {\n const labels = Object.entries(this.#meta)\n .map(([key, value]) => `${key}=${value}`)\n .join(',');\n console[level](`${labels} ${message}`, meta);\n }\n }\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ConfigService,\n coreServices,\n createServiceFactory,\n IdentityService,\n LoggerService,\n ServiceFactory,\n ServiceRef,\n TokenManagerService,\n} from '@backstage/backend-plugin-api';\nimport {\n cacheServiceFactory,\n databaseServiceFactory,\n httpRouterServiceFactory,\n lifecycleServiceFactory,\n loggerServiceFactory,\n permissionsServiceFactory,\n rootLifecycleServiceFactory,\n schedulerServiceFactory,\n urlReaderServiceFactory,\n} from '@backstage/backend-app-api';\nimport { ConfigReader } from '@backstage/config';\nimport { JsonObject } from '@backstage/types';\nimport { MockIdentityService } from './MockIdentityService';\nimport { MockRootLoggerService } from './MockRootLoggerService';\n\nfunction simpleFactory<TService, TOptions extends [options?: object] = []>(\n ref: ServiceRef<TService>,\n factory: (...options: TOptions) => TService,\n): (...options: TOptions) => ServiceFactory<TService> {\n return createServiceFactory((options: unknown) => ({\n service: ref as ServiceRef<TService, any>,\n deps: {},\n async factory() {\n return (factory as any)(options);\n },\n }));\n}\n\n/**\n * @alpha\n */\nexport namespace mockServices {\n export function config(options?: config.Options): ConfigService {\n return new ConfigReader(options?.data, 'mock-config');\n }\n export namespace config {\n export type Options = { data?: JsonObject };\n\n export const factory = simpleFactory(coreServices.config, config);\n }\n\n export function rootLogger(options?: rootLogger.Options): LoggerService {\n return MockRootLoggerService.create(options);\n }\n export namespace rootLogger {\n export type Options = {\n level?: 'none' | 'error' | 'warn' | 'info' | 'debug';\n };\n\n export const factory = simpleFactory(coreServices.rootLogger, rootLogger);\n }\n\n export function tokenManager(): TokenManagerService {\n return {\n async getToken(): Promise<{ token: string }> {\n return { token: 'mock-token' };\n },\n async authenticate(token: string): Promise<void> {\n if (token !== 'mock-token') {\n throw new Error('Invalid token');\n }\n },\n };\n }\n export namespace tokenManager {\n export const factory = simpleFactory(\n coreServices.tokenManager,\n tokenManager,\n );\n }\n\n export function identity(): IdentityService {\n return new MockIdentityService();\n }\n export namespace identity {\n export const factory = simpleFactory(coreServices.identity, identity);\n }\n\n // TODO(Rugvip): Not all core services have implementations available here yet.\n // some may need a bit more refactoring for it to be simpler to\n // re-implement functioning mock versions here.\n export namespace cache {\n export const factory = cacheServiceFactory;\n }\n export namespace database {\n export const factory = databaseServiceFactory;\n }\n export namespace httpRouter {\n export const factory = httpRouterServiceFactory;\n }\n export namespace lifecycle {\n export const factory = lifecycleServiceFactory;\n }\n export namespace logger {\n export const factory = loggerServiceFactory;\n }\n export namespace permissions {\n export const factory = permissionsServiceFactory;\n }\n export namespace rootLifecycle {\n export const factory = rootLifecycleServiceFactory;\n }\n export namespace scheduler {\n export const factory = schedulerServiceFactory;\n }\n export namespace urlReader {\n export const factory = urlReaderServiceFactory;\n }\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Backend,\n createSpecializedBackend,\n MiddlewareFactory,\n createHttpServer,\n ExtendedHttpServer,\n DefaultRootHttpRouter,\n} from '@backstage/backend-app-api';\nimport { SingleHostDiscovery } from '@backstage/backend-common';\nimport {\n ServiceFactory,\n ServiceRef,\n createServiceFactory,\n BackendFeature,\n ExtensionPoint,\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { mockServices } from '../services';\nimport { ConfigReader } from '@backstage/config';\nimport express from 'express';\n\n/** @alpha */\nexport interface TestBackendOptions<\n TServices extends any[],\n TExtensionPoints extends any[],\n> {\n services?: readonly [\n ...{\n [index in keyof TServices]:\n | ServiceFactory<TServices[index]>\n | (() => ServiceFactory<TServices[index]>)\n | [ServiceRef<TServices[index]>, Partial<TServices[index]>];\n },\n ];\n extensionPoints?: readonly [\n ...{\n [index in keyof TExtensionPoints]: [\n ExtensionPoint<TExtensionPoints[index]>,\n Partial<TExtensionPoints[index]>,\n ];\n },\n ];\n features?: BackendFeature[];\n}\n\n/** @alpha */\nexport interface TestBackend extends Backend {\n /**\n * Provides access to the underling HTTP server for use with utilities\n * such as `supertest`.\n *\n * If the root http router service has been replaced, this will throw an error.\n */\n readonly server: ExtendedHttpServer;\n}\n\nconst defaultServiceFactories = [\n mockServices.cache.factory(),\n mockServices.config.factory(),\n mockServices.database.factory(),\n mockServices.httpRouter.factory(),\n mockServices.identity.factory(),\n mockServices.lifecycle.factory(),\n mockServices.logger.factory(),\n mockServices.permissions.factory(),\n mockServices.rootLifecycle.factory(),\n mockServices.rootLogger.factory(),\n mockServices.scheduler.factory(),\n mockServices.tokenManager.factory(),\n mockServices.urlReader.factory(),\n];\n\nconst backendInstancesToCleanUp = new Array<Backend>();\n\n/** @alpha */\nexport async function startTestBackend<\n TServices extends any[],\n TExtensionPoints extends any[],\n>(\n options: TestBackendOptions<TServices, TExtensionPoints>,\n): Promise<TestBackend> {\n const {\n services = [],\n extensionPoints = [],\n features = [],\n ...otherOptions\n } = options;\n\n let server: ExtendedHttpServer;\n\n const rootHttpRouterFactory = createServiceFactory({\n service: coreServices.rootHttpRouter,\n deps: {\n config: coreServices.config,\n lifecycle: coreServices.rootLifecycle,\n rootLogger: coreServices.rootLogger,\n },\n async factory({ config, lifecycle, rootLogger }) {\n const router = DefaultRootHttpRouter.create();\n const logger = rootLogger.child({ service: 'rootHttpRouter' });\n\n const app = express();\n\n const middleware = MiddlewareFactory.create({ config, logger });\n\n app.use(router.handler());\n app.use(middleware.notFound());\n app.use(middleware.error());\n\n server = await createHttpServer(\n app,\n { listen: { host: '', port: 0 } },\n { logger },\n );\n\n lifecycle.addShutdownHook(() => server.stop(), { logger });\n\n await server.start();\n\n return router;\n },\n });\n\n const discoveryFactory = createServiceFactory({\n service: coreServices.discovery,\n deps: {\n rootHttpRouter: coreServices.rootHttpRouter,\n },\n async factory() {\n if (!server) {\n throw new Error('Test server not started yet');\n }\n const port = server.port();\n const discovery = SingleHostDiscovery.fromConfig(\n new ConfigReader({\n backend: { baseUrl: `http://localhost:${port}`, listen: { port } },\n }),\n );\n return discovery;\n },\n });\n\n const factories = services.map(serviceDef => {\n if (Array.isArray(serviceDef)) {\n // if type is ExtensionPoint?\n // do something differently?\n const [ref, impl] = serviceDef;\n if (ref.scope === 'plugin') {\n return createServiceFactory({\n service: ref as ServiceRef<unknown, 'plugin'>,\n deps: {},\n factory: async () => impl,\n })();\n }\n return createServiceFactory({\n service: ref as ServiceRef<unknown, 'root'>,\n deps: {},\n factory: async () => impl,\n })();\n }\n if (typeof serviceDef === 'function') {\n return serviceDef();\n }\n return serviceDef as ServiceFactory;\n });\n\n for (const factory of defaultServiceFactories) {\n if (!factories.some(f => f.service.id === factory.service.id)) {\n factories.push(factory);\n }\n }\n\n const backend = createSpecializedBackend({\n ...otherOptions,\n services: [...factories, rootHttpRouterFactory, discoveryFactory],\n });\n\n backendInstancesToCleanUp.push(backend);\n\n backend.add(\n createBackendPlugin({\n pluginId: `---test-extension-point-registrar`,\n register(reg) {\n for (const [ref, impl] of extensionPoints) {\n reg.registerExtensionPoint(ref, impl);\n }\n\n reg.registerInit({ deps: {}, async init() {} });\n },\n })(),\n );\n\n for (const feature of features) {\n backend.add(feature);\n }\n\n await backend.start();\n\n return Object.assign(backend, {\n get server() {\n if (!server) {\n throw new Error('TestBackend server is not available');\n }\n return server;\n },\n });\n}\n\nlet registered = false;\nfunction registerTestHooks() {\n if (typeof afterAll !== 'function') {\n return;\n }\n if (registered) {\n return;\n }\n registered = true;\n\n afterAll(async () => {\n await Promise.all(\n backendInstancesToCleanUp.map(async backend => {\n try {\n await backend.stop();\n } catch (error) {\n console.error(`Failed to stop backend after tests, ${error}`);\n }\n }),\n );\n backendInstancesToCleanUp.length = 0;\n });\n}\n\nregisterTestHooks();\n"],"names":["createConnection","uuid","randomBytes","DatabaseManager","ConfigReader","createServiceFactory","mockServices","config","coreServices","rootLogger","tokenManager","identity","cache","cacheServiceFactory","database","databaseServiceFactory","httpRouter","httpRouterServiceFactory","lifecycle","lifecycleServiceFactory","logger","loggerServiceFactory","permissions","permissionsServiceFactory","rootLifecycle","rootLifecycleServiceFactory","scheduler","schedulerServiceFactory","urlReader","urlReaderServiceFactory","DefaultRootHttpRouter","express","MiddlewareFactory","createHttpServer","SingleHostDiscovery","createSpecializedBackend","createBackendPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,SAAS,wBAA2B,GAAA;AAMzC,EACE,OAAA,OAAA,CAAQ,QAAQ,GAAI,CAAA,6BAA6B,KACjD,CAAC,OAAA,CAAQ,OAAQ,CAAA,GAAA,CAAI,EAAE,CAAA,CAAA;AAE3B;;ACRA,eAAe,kBACb,UACe,EAAA;AArBjB,EAAA,IAAA,EAAA,CAAA;AAsBE,EAAM,MAAA,SAAA,GAAY,KAAK,GAAI,EAAA,CAAA;AAC3B,EAAA,MAAM,KAAKA,oCAAiB,CAAA,EAAE,MAAQ,EAAA,QAAA,EAAU,YAAY,CAAA,CAAA;AAE5D,EAAI,IAAA;AACF,IAAS,WAAA;AACP,MAAI,IAAA;AACF,QAAA,MAAM,SAAS,MAAM,EAAA,CAAG,OAAO,EAAG,CAAA,GAAA,CAAI,sBAAsB,CAAC,CAAA,CAAA;AAC7D,QAAA,IAAA,CAAI,EAAO,GAAA,MAAA,CAAA,CAAC,CAAR,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAW,OAAS,EAAA;AACtB,UAA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QAAA,CAAS,YAAY;AACnB,IAAA,MAAM,OAAQ,CAAA,GAAA;AAAA,MACZ,yBAAA,CAA0B,GAAI,CAAA,OAAM,OAAW,KAAA;AAC7C,QAAI,IAAA;AACF,UAAA,MAAM,QAAQ,IAAK,EAAA,CAAA;AAAA,iBACZ,KAAP,EAAA;AACA,UAAQ,OAAA,CAAA,KAAA,CAAM,uCAAuC,KAAO,CAAA,CAAA,CAAA,CAAA;AAAA,SAC9D;AAAA,OACD,CAAA;AAAA,KACH,CAAA;AACA,IAAA,yBAAA,CAA0B,MAAS,GAAA,CAAA,CAAA;AAAA,GACpC,CAAA,CAAA;AACH,CAAA;AAEA,iBAAkB,EAAA;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs.js","sources":["../src/util/isDockerDisabledForTests.ts","../src/database/startMysqlContainer.ts","../src/database/startPostgresContainer.ts","../src/database/types.ts","../src/database/TestDatabases.ts","../src/msw/setupRequestMockHandlers.ts","../src/next/services/MockIdentityService.ts","../src/next/services/MockRootLoggerService.ts","../src/next/services/mockServices.ts","../src/next/wiring/TestBackend.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/** @public */\nexport function isDockerDisabledForTests() {\n // If we are not running in continuous integration, the default is to skip\n // the (relatively heavy, long running) docker based tests. If you want to\n // still run local tests for all databases, just pass either the CI=1 env\n // parameter to your test runner, or individual connection strings per\n // database.\n return (\n Boolean(process.env.BACKSTAGE_TEST_DISABLE_DOCKER) ||\n !Boolean(process.env.CI)\n );\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport createConnection, { Knex } from 'knex';\nimport { v4 as uuid } from 'uuid';\n\nasync function waitForMysqlReady(\n connection: Knex.MySqlConnectionConfig,\n): Promise<void> {\n const startTime = Date.now();\n const db = createConnection({ client: 'mysql2', connection });\n\n try {\n for (;;) {\n try {\n const result = await db.select(db.raw('version() AS version'));\n if (result[0]?.version) {\n return;\n }\n } catch (e) {\n if (Date.now() - startTime > 30_000) {\n throw new Error(\n `Timed out waiting for the database to be ready for connections, ${e}`,\n );\n }\n }\n\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n } finally {\n db.destroy();\n }\n}\n\nexport async function startMysqlContainer(image: string) {\n const user = 'root';\n const password = uuid();\n\n // Lazy-load to avoid side-effect of importing testcontainers\n const { GenericContainer } = await import('testcontainers');\n\n const container = await new GenericContainer(image)\n .withExposedPorts(3306)\n .withEnv('MYSQL_ROOT_PASSWORD', password)\n .withTmpFs({ '/var/lib/mysql': 'rw' })\n .start();\n\n const host = container.getHost();\n const port = container.getMappedPort(3306);\n const stop = async () => {\n await container.stop({ timeout: 10_000 });\n };\n\n await waitForMysqlReady({ host, port, user, password });\n\n return { host, port, user, password, stop };\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport createConnection, { Knex } from 'knex';\nimport { v4 as uuid } from 'uuid';\n\nasync function waitForPostgresReady(\n connection: Knex.PgConnectionConfig,\n): Promise<void> {\n const startTime = Date.now();\n const db = createConnection({ client: 'pg', connection });\n\n try {\n for (;;) {\n try {\n const result = await db.select(db.raw('version()'));\n if (Array.isArray(result) && result[0]?.version) {\n return;\n }\n } catch (e) {\n if (Date.now() - startTime > 30_000) {\n throw new Error(\n `Timed out waiting for the database to be ready for connections, ${e}`,\n );\n }\n }\n\n await new Promise(resolve => setTimeout(resolve, 100));\n }\n } finally {\n db.destroy();\n }\n}\n\nexport async function startPostgresContainer(image: string) {\n const user = 'postgres';\n const password = uuid();\n\n // Lazy-load to avoid side-effect of importing testcontainers\n const { GenericContainer } = await import('testcontainers');\n\n const container = await new GenericContainer(image)\n .withExposedPorts(5432)\n .withEnv('POSTGRES_PASSWORD', password)\n .withTmpFs({ '/var/lib/postgresql/data': 'rw' })\n .start();\n\n const host = container.getHost();\n const port = container.getMappedPort(5432);\n const stop = async () => {\n await container.stop({ timeout: 10_000 });\n };\n\n await waitForPostgresReady({ host, port, user, password });\n\n return { host, port, user, password, stop };\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DatabaseManager } from '@backstage/backend-common';\nimport { Knex } from 'knex';\n\n/**\n * The possible databases to test against.\n *\n * @public\n */\nexport type TestDatabaseId =\n | 'POSTGRES_13'\n | 'POSTGRES_9'\n | 'MYSQL_8'\n | 'SQLITE_3';\n\nexport type TestDatabaseProperties = {\n name: string;\n driver: string;\n dockerImageName?: string;\n connectionStringEnvironmentVariableName?: string;\n};\n\nexport type Instance = {\n stopContainer?: () => Promise<void>;\n databaseManager: DatabaseManager;\n connections: Array<Knex>;\n};\n\nexport const allDatabases: Record<TestDatabaseId, TestDatabaseProperties> =\n Object.freeze({\n POSTGRES_13: {\n name: 'Postgres 13.x',\n driver: 'pg',\n dockerImageName: 'postgres:13',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_POSTGRES13_CONNECTION_STRING',\n },\n POSTGRES_9: {\n name: 'Postgres 9.x',\n driver: 'pg',\n dockerImageName: 'postgres:9',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_POSTGRES9_CONNECTION_STRING',\n },\n MYSQL_8: {\n name: 'MySQL 8.x',\n driver: 'mysql2',\n dockerImageName: 'mysql:8',\n connectionStringEnvironmentVariableName:\n 'BACKSTAGE_TEST_DATABASE_MYSQL8_CONNECTION_STRING',\n },\n SQLITE_3: {\n name: 'SQLite 3.x',\n driver: 'better-sqlite3',\n },\n });\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DatabaseManager } from '@backstage/backend-common';\nimport { ConfigReader } from '@backstage/config';\nimport { randomBytes } from 'crypto';\nimport { Knex } from 'knex';\nimport { isDockerDisabledForTests } from '../util/isDockerDisabledForTests';\nimport { startMysqlContainer } from './startMysqlContainer';\nimport { startPostgresContainer } from './startPostgresContainer';\nimport {\n allDatabases,\n Instance,\n TestDatabaseId,\n TestDatabaseProperties,\n} from './types';\n\nconst LARGER_POOL_CONFIG = {\n pool: {\n min: 0,\n max: 50,\n },\n};\n\n/**\n * Encapsulates the creation of ephemeral test database instances for use\n * inside unit or integration tests.\n *\n * @public\n */\nexport class TestDatabases {\n private readonly instanceById: Map<string, Instance>;\n private readonly supportedIds: TestDatabaseId[];\n\n /**\n * Creates an empty `TestDatabases` instance, and sets up Jest to clean up\n * all of its acquired resources after all tests finish.\n *\n * You typically want to create just a single instance like this at the top\n * of your test file or `describe` block, and then call `init` many times on\n * that instance inside the individual tests. Spinning up a \"physical\"\n * database instance takes a considerable amount of time, slowing down tests.\n * But initializing a new logical database inside that instance using `init`\n * is very fast.\n */\n static create(options?: {\n ids?: TestDatabaseId[];\n disableDocker?: boolean;\n }): TestDatabases {\n const defaultOptions = {\n ids: Object.keys(allDatabases) as TestDatabaseId[],\n disableDocker: isDockerDisabledForTests(),\n };\n\n const { ids, disableDocker } = Object.assign(\n {},\n defaultOptions,\n options ?? {},\n );\n\n const supportedIds = ids.filter(id => {\n const properties = allDatabases[id];\n if (!properties) {\n return false;\n }\n // If the caller has set up the env with an explicit connection string,\n // we'll assume that this database will work\n if (\n properties.connectionStringEnvironmentVariableName &&\n process.env[properties.connectionStringEnvironmentVariableName]\n ) {\n return true;\n }\n // If the database doesn't require docker at all, there's nothing to worry\n // about\n if (!properties.dockerImageName) {\n return true;\n }\n // If the database requires docker, but docker is disabled, we will fail.\n if (disableDocker) {\n return false;\n }\n return true;\n });\n\n const databases = new TestDatabases(supportedIds);\n\n if (supportedIds.length > 0) {\n afterAll(async () => {\n await databases.shutdown();\n });\n }\n\n return databases;\n }\n\n private constructor(supportedIds: TestDatabaseId[]) {\n this.instanceById = new Map();\n this.supportedIds = supportedIds;\n }\n\n supports(id: TestDatabaseId): boolean {\n return this.supportedIds.includes(id);\n }\n\n eachSupportedId(): [TestDatabaseId][] {\n return this.supportedIds.map(id => [id]);\n }\n\n /**\n * Returns a fresh, unique, empty logical database on an instance of the\n * given database ID platform.\n *\n * @param id - The ID of the database platform to use, e.g. 'POSTGRES_13'\n * @returns A `Knex` connection object\n */\n async init(id: TestDatabaseId): Promise<Knex> {\n const properties = allDatabases[id];\n if (!properties) {\n const candidates = Object.keys(allDatabases).join(', ');\n throw new Error(\n `Unknown test database ${id}, possible values are ${candidates}`,\n );\n }\n if (!this.supportedIds.includes(id)) {\n const candidates = this.supportedIds.join(', ');\n throw new Error(\n `Unsupported test database ${id} for this environment, possible values are ${candidates}`,\n );\n }\n\n let instance: Instance | undefined = this.instanceById.get(id);\n\n // Ensure that a testcontainers instance is up for this ID\n if (!instance) {\n instance = await this.initAny(properties);\n this.instanceById.set(id, instance);\n }\n\n // Ensure that a unique logical database is created in the instance\n const connection = await instance.databaseManager\n .forPlugin(`db${randomBytes(16).toString('hex')}`)\n .getClient();\n\n instance.connections.push(connection);\n\n return connection;\n }\n\n private async initAny(properties: TestDatabaseProperties): Promise<Instance> {\n // Use the connection string if provided\n if (properties.driver === 'pg' || properties.driver === 'mysql2') {\n const envVarName = properties.connectionStringEnvironmentVariableName;\n if (envVarName) {\n const connectionString = process.env[envVarName];\n if (connectionString) {\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n knexConfig: properties.driver.includes('sqlite')\n ? {}\n : LARGER_POOL_CONFIG,\n client: properties.driver,\n connection: connectionString,\n },\n },\n }),\n );\n return {\n databaseManager,\n connections: [],\n };\n }\n }\n }\n\n // Otherwise start a container for the purpose\n switch (properties.driver) {\n case 'pg':\n return this.initPostgres(properties);\n case 'mysql2':\n return this.initMysql(properties);\n case 'better-sqlite3':\n case 'sqlite3':\n return this.initSqlite(properties);\n default:\n throw new Error(`Unknown database driver ${properties.driver}`);\n }\n }\n\n private async initPostgres(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const { host, port, user, password, stop } = await startPostgresContainer(\n properties.dockerImageName!,\n );\n\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n knexConfig: LARGER_POOL_CONFIG,\n client: 'pg',\n connection: { host, port, user, password },\n },\n },\n }),\n );\n\n return {\n stopContainer: stop,\n databaseManager,\n connections: [],\n };\n }\n\n private async initMysql(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const { host, port, user, password, stop } = await startMysqlContainer(\n properties.dockerImageName!,\n );\n\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n knexConfig: LARGER_POOL_CONFIG,\n client: 'mysql2',\n connection: { host, port, user, password },\n },\n },\n }),\n );\n\n return {\n stopContainer: stop,\n databaseManager,\n connections: [],\n };\n }\n\n private async initSqlite(\n properties: TestDatabaseProperties,\n ): Promise<Instance> {\n const databaseManager = DatabaseManager.fromConfig(\n new ConfigReader({\n backend: {\n database: {\n client: properties.driver,\n connection: ':memory:',\n },\n },\n }),\n );\n\n return {\n databaseManager,\n connections: [],\n };\n }\n\n private async shutdown() {\n const instances = [...this.instanceById.values()];\n await Promise.all(\n instances.map(async ({ stopContainer, connections }) => {\n try {\n await Promise.all(connections.map(c => c.destroy()));\n } catch {\n // ignore\n }\n try {\n await stopContainer?.();\n } catch {\n // ignore\n }\n }),\n );\n }\n}\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Sets up handlers for request mocking\n * @public\n * @param worker - service worker\n */\nexport function setupRequestMockHandlers(worker: {\n listen: (t: any) => void;\n close: () => void;\n resetHandlers: () => void;\n}) {\n beforeAll(() => worker.listen({ onUnhandledRequest: 'error' }));\n afterAll(() => worker.close());\n afterEach(() => worker.resetHandlers());\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { IdentityService } from '@backstage/backend-plugin-api';\nimport {\n IdentityApiGetIdentityRequest,\n BackstageIdentityResponse,\n} from '@backstage/plugin-auth-node';\n\nexport class MockIdentityService implements IdentityService {\n getIdentity(\n _options: IdentityApiGetIdentityRequest,\n ): Promise<BackstageIdentityResponse | undefined> {\n return Promise.resolve({\n token: 'mock-token',\n identity: {\n type: 'user',\n userEntityRef: 'user:default/mock-user',\n ownershipEntityRefs: [],\n },\n });\n }\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n LoggerService,\n RootLoggerService,\n} from '@backstage/backend-plugin-api';\nimport { JsonObject } from '@backstage/types';\nimport type { mockServices } from './mockServices';\n\nconst levels = {\n none: 0,\n error: 1,\n warn: 2,\n info: 3,\n debug: 4,\n};\n\nexport class MockRootLoggerService implements RootLoggerService {\n #level: number;\n #meta: JsonObject;\n\n static create(\n options?: mockServices.rootLogger.Options,\n ): MockRootLoggerService {\n const level = options?.level ?? 'none';\n if (!(level in levels)) {\n throw new Error(`Invalid log level '${level}'`);\n }\n return new MockRootLoggerService(levels[level], {});\n }\n\n error(message: string, meta?: JsonObject | Error | undefined): void {\n this.#log('error', message, meta);\n }\n\n warn(message: string, meta?: JsonObject | Error | undefined): void {\n this.#log('warn', message, meta);\n }\n\n info(message: string, meta?: JsonObject | Error | undefined): void {\n this.#log('info', message, meta);\n }\n\n debug(message: string, meta?: JsonObject | Error | undefined): void {\n this.#log('debug', message, meta);\n }\n\n child(meta: JsonObject): LoggerService {\n return new MockRootLoggerService(this.#level, { ...this.#meta, ...meta });\n }\n\n private constructor(level: number, meta: JsonObject) {\n this.#level = level;\n this.#meta = meta;\n }\n\n #log(\n level: 'error' | 'warn' | 'info' | 'debug',\n message: string,\n meta?: JsonObject | Error | undefined,\n ) {\n const levelValue = levels[level] ?? 0;\n if (levelValue <= this.#level) {\n const labels = Object.entries(this.#meta)\n .map(([key, value]) => `${key}=${value}`)\n .join(',');\n console[level](`${labels} ${message}`, meta);\n }\n }\n}\n","/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ConfigService,\n coreServices,\n createServiceFactory,\n IdentityService,\n LoggerService,\n ServiceFactory,\n ServiceRef,\n TokenManagerService,\n} from '@backstage/backend-plugin-api';\nimport {\n cacheServiceFactory,\n databaseServiceFactory,\n httpRouterServiceFactory,\n lifecycleServiceFactory,\n loggerServiceFactory,\n permissionsServiceFactory,\n rootLifecycleServiceFactory,\n schedulerServiceFactory,\n urlReaderServiceFactory,\n} from '@backstage/backend-app-api';\nimport { ConfigReader } from '@backstage/config';\nimport { JsonObject } from '@backstage/types';\nimport { MockIdentityService } from './MockIdentityService';\nimport { MockRootLoggerService } from './MockRootLoggerService';\n\nfunction simpleFactory<\n TService,\n TScope extends 'root' | 'plugin',\n TOptions extends [options?: object] = [],\n>(\n ref: ServiceRef<TService, TScope>,\n factory: (...options: TOptions) => TService,\n): (...options: TOptions) => ServiceFactory<TService, TScope> {\n return createServiceFactory((options: unknown) => ({\n service: ref as ServiceRef<TService, any>,\n deps: {},\n async factory() {\n return (factory as any)(options);\n },\n })) as (...options: TOptions) => ServiceFactory<TService, any>;\n}\n\n/**\n * @public\n */\nexport namespace mockServices {\n export function config(options?: config.Options): ConfigService {\n return new ConfigReader(options?.data, 'mock-config');\n }\n export namespace config {\n export type Options = { data?: JsonObject };\n\n export const factory = simpleFactory(coreServices.config, config);\n }\n\n export function rootLogger(options?: rootLogger.Options): LoggerService {\n return MockRootLoggerService.create(options);\n }\n export namespace rootLogger {\n export type Options = {\n level?: 'none' | 'error' | 'warn' | 'info' | 'debug';\n };\n\n export const factory = simpleFactory(coreServices.rootLogger, rootLogger);\n }\n\n export function tokenManager(): TokenManagerService {\n return {\n async getToken(): Promise<{ token: string }> {\n return { token: 'mock-token' };\n },\n async authenticate(token: string): Promise<void> {\n if (token !== 'mock-token') {\n throw new Error('Invalid token');\n }\n },\n };\n }\n export namespace tokenManager {\n export const factory = simpleFactory(\n coreServices.tokenManager,\n tokenManager,\n );\n }\n\n export function identity(): IdentityService {\n return new MockIdentityService();\n }\n export namespace identity {\n export const factory = simpleFactory(coreServices.identity, identity);\n }\n\n // TODO(Rugvip): Not all core services have implementations available here yet.\n // some may need a bit more refactoring for it to be simpler to\n // re-implement functioning mock versions here.\n export namespace cache {\n export const factory = cacheServiceFactory;\n }\n export namespace database {\n export const factory = databaseServiceFactory;\n }\n export namespace httpRouter {\n export const factory = httpRouterServiceFactory;\n }\n export namespace lifecycle {\n export const factory = lifecycleServiceFactory;\n }\n export namespace logger {\n export const factory = loggerServiceFactory;\n }\n export namespace permissions {\n export const factory = permissionsServiceFactory;\n }\n export namespace rootLifecycle {\n export const factory = rootLifecycleServiceFactory;\n }\n export namespace scheduler {\n export const factory = schedulerServiceFactory;\n }\n export namespace urlReader {\n export const factory = urlReaderServiceFactory;\n }\n}\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n Backend,\n createSpecializedBackend,\n MiddlewareFactory,\n createHttpServer,\n ExtendedHttpServer,\n DefaultRootHttpRouter,\n} from '@backstage/backend-app-api';\nimport { SingleHostDiscovery } from '@backstage/backend-common';\nimport {\n ServiceFactory,\n ServiceRef,\n createServiceFactory,\n BackendFeature,\n ExtensionPoint,\n coreServices,\n createBackendPlugin,\n} from '@backstage/backend-plugin-api';\nimport { mockServices } from '../services';\nimport { ConfigReader } from '@backstage/config';\nimport express from 'express';\n\n/** @public */\nexport interface TestBackendOptions<\n TServices extends any[],\n TExtensionPoints extends any[],\n> {\n services?: readonly [\n ...{\n [index in keyof TServices]:\n | ServiceFactory<TServices[index]>\n | (() => ServiceFactory<TServices[index]>)\n | [ServiceRef<TServices[index]>, Partial<TServices[index]>];\n },\n ];\n extensionPoints?: readonly [\n ...{\n [index in keyof TExtensionPoints]: [\n ExtensionPoint<TExtensionPoints[index]>,\n Partial<TExtensionPoints[index]>,\n ];\n },\n ];\n features?: BackendFeature[];\n}\n\n/** @public */\nexport interface TestBackend extends Backend {\n /**\n * Provides access to the underling HTTP server for use with utilities\n * such as `supertest`.\n *\n * If the root http router service has been replaced, this will throw an error.\n */\n readonly server: ExtendedHttpServer;\n}\n\nconst defaultServiceFactories = [\n mockServices.cache.factory(),\n mockServices.config.factory(),\n mockServices.database.factory(),\n mockServices.httpRouter.factory(),\n mockServices.identity.factory(),\n mockServices.lifecycle.factory(),\n mockServices.logger.factory(),\n mockServices.permissions.factory(),\n mockServices.rootLifecycle.factory(),\n mockServices.rootLogger.factory(),\n mockServices.scheduler.factory(),\n mockServices.tokenManager.factory(),\n mockServices.urlReader.factory(),\n];\n\nconst backendInstancesToCleanUp = new Array<Backend>();\n\n/** @public */\nexport async function startTestBackend<\n TServices extends any[],\n TExtensionPoints extends any[],\n>(\n options: TestBackendOptions<TServices, TExtensionPoints>,\n): Promise<TestBackend> {\n const {\n services = [],\n extensionPoints = [],\n features = [],\n ...otherOptions\n } = options;\n\n let server: ExtendedHttpServer;\n\n const rootHttpRouterFactory = createServiceFactory({\n service: coreServices.rootHttpRouter,\n deps: {\n config: coreServices.config,\n lifecycle: coreServices.rootLifecycle,\n rootLogger: coreServices.rootLogger,\n },\n async factory({ config, lifecycle, rootLogger }) {\n const router = DefaultRootHttpRouter.create();\n const logger = rootLogger.child({ service: 'rootHttpRouter' });\n\n const app = express();\n\n const middleware = MiddlewareFactory.create({ config, logger });\n\n app.use(router.handler());\n app.use(middleware.notFound());\n app.use(middleware.error());\n\n server = await createHttpServer(\n app,\n { listen: { host: '', port: 0 } },\n { logger },\n );\n\n lifecycle.addShutdownHook(() => server.stop(), { logger });\n\n await server.start();\n\n return router;\n },\n });\n\n const discoveryFactory = createServiceFactory({\n service: coreServices.discovery,\n deps: {\n rootHttpRouter: coreServices.rootHttpRouter,\n },\n async factory() {\n if (!server) {\n throw new Error('Test server not started yet');\n }\n const port = server.port();\n const discovery = SingleHostDiscovery.fromConfig(\n new ConfigReader({\n backend: { baseUrl: `http://localhost:${port}`, listen: { port } },\n }),\n );\n return discovery;\n },\n });\n\n const factories = services.map(serviceDef => {\n if (Array.isArray(serviceDef)) {\n // if type is ExtensionPoint?\n // do something differently?\n const [ref, impl] = serviceDef;\n if (ref.scope === 'plugin') {\n return createServiceFactory({\n service: ref as ServiceRef<unknown, 'plugin'>,\n deps: {},\n factory: async () => impl,\n })();\n }\n return createServiceFactory({\n service: ref as ServiceRef<unknown, 'root'>,\n deps: {},\n factory: async () => impl,\n })();\n }\n if (typeof serviceDef === 'function') {\n return serviceDef();\n }\n return serviceDef as ServiceFactory;\n });\n\n for (const factory of defaultServiceFactories) {\n if (!factories.some(f => f.service.id === factory.service.id)) {\n factories.push(factory);\n }\n }\n\n const backend = createSpecializedBackend({\n ...otherOptions,\n services: [...factories, rootHttpRouterFactory, discoveryFactory],\n });\n\n backendInstancesToCleanUp.push(backend);\n\n backend.add(\n createBackendPlugin({\n pluginId: `---test-extension-point-registrar`,\n register(reg) {\n for (const [ref, impl] of extensionPoints) {\n reg.registerExtensionPoint(ref, impl);\n }\n\n reg.registerInit({ deps: {}, async init() {} });\n },\n })(),\n );\n\n for (const feature of features) {\n backend.add(feature);\n }\n\n await backend.start();\n\n return Object.assign(backend, {\n get server() {\n if (!server) {\n throw new Error('TestBackend server is not available');\n }\n return server;\n },\n });\n}\n\nlet registered = false;\nfunction registerTestHooks() {\n if (typeof afterAll !== 'function') {\n return;\n }\n if (registered) {\n return;\n }\n registered = true;\n\n afterAll(async () => {\n await Promise.all(\n backendInstancesToCleanUp.map(async backend => {\n try {\n await backend.stop();\n } catch (error) {\n console.error(`Failed to stop backend after tests, ${error}`);\n }\n }),\n );\n backendInstancesToCleanUp.length = 0;\n });\n}\n\nregisterTestHooks();\n"],"names":["createConnection","uuid","randomBytes","DatabaseManager","ConfigReader","createServiceFactory","mockServices","config","coreServices","rootLogger","tokenManager","identity","cache","cacheServiceFactory","database","databaseServiceFactory","httpRouter","httpRouterServiceFactory","lifecycle","lifecycleServiceFactory","logger","loggerServiceFactory","permissions","permissionsServiceFactory","rootLifecycle","rootLifecycleServiceFactory","scheduler","schedulerServiceFactory","urlReader","urlReaderServiceFactory","DefaultRootHttpRouter","express","MiddlewareFactory","createHttpServer","SingleHostDiscovery","createSpecializedBackend","createBackendPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,SAAS,wBAA2B,GAAA;AAMzC,EACE,OAAA,OAAA,CAAQ,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;AAC9B,IAAA,OAAA,CAAQ,IAAI,OAAO,CAAA,CAAA;AAAA,GACrB;AAEA,EAAA,MAAM,QAAQ,KAAM,EAAA,CAAA;AAEpB,EAAO,OAAA,MAAA,CAAO,OAAO,OAAS,EAAA;AAAA,IAC5B,IAAI,MAAS,GAAA;AACX,MAAA,IAAI,CAAC,MAAQ,EAAA;AACX,QAAM,MAAA,IAAI,MAAM,qCAAqC,CAAA,CAAA;AAAA,OACvD;AACA,MAAO,OAAA,MAAA,CAAA;AAAA,KACT;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAEA,IAAI,UAAa,GAAA,KAAA,CAAA;AACjB,SAAS,iBAAoB,GAAA;AAC3B,EAAI,IAAA,OAAO,aAAa,UAAY,EAAA;AAClC,IAAA,OAAA;AAAA,GACF;AACA,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,OAAA;AAAA,GACF;AACA,EAAa,UAAA,GAAA,IAAA,CAAA;AAEb,EAAA,QAAA,CAAS,YAAY;AACnB,IAAA,MAAM,OAAQ,CAAA,GAAA;AAAA,MACZ,yBAAA,CAA0B,GAAI,CAAA,OAAM,OAAW,KAAA;AAC7C,QAAI,IAAA;AACF,UAAA,MAAM,QAAQ,IAAK,EAAA,CAAA;AAAA,iBACZ,KAAP,EAAA;AACA,UAAQ,OAAA,CAAA,KAAA,CAAM,uCAAuC,KAAO,CAAA,CAAA,CAAA,CAAA;AAAA,SAC9D;AAAA,OACD,CAAA;AAAA,KACH,CAAA;AACA,IAAA,yBAAA,CAA0B,MAAS,GAAA,CAAA,CAAA;AAAA,GACpC,CAAA,CAAA;AACH,CAAA;AAEA,iBAAkB,EAAA;;;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,60 @@ import { UrlReaderService } from '@backstage/backend-plugin-api';
|
|
|
29
29
|
/** @public */
|
|
30
30
|
export declare function isDockerDisabledForTests(): boolean;
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
/**
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export declare namespace mockServices {
|
|
36
|
+
export function config(options?: config.Options): ConfigService;
|
|
37
|
+
export namespace config {
|
|
38
|
+
export type Options = {
|
|
39
|
+
data?: JsonObject;
|
|
40
|
+
};
|
|
41
|
+
const factory: (options?: Options | undefined) => ServiceFactory<ConfigService, "root">;
|
|
42
|
+
}
|
|
43
|
+
export function rootLogger(options?: rootLogger.Options): LoggerService;
|
|
44
|
+
export namespace rootLogger {
|
|
45
|
+
export type Options = {
|
|
46
|
+
level?: 'none' | 'error' | 'warn' | 'info' | 'debug';
|
|
47
|
+
};
|
|
48
|
+
const factory: (options?: Options | undefined) => ServiceFactory<LoggerService, "root">;
|
|
49
|
+
}
|
|
50
|
+
export function tokenManager(): TokenManagerService;
|
|
51
|
+
export namespace tokenManager {
|
|
52
|
+
const factory: () => ServiceFactory<TokenManagerService, "plugin">;
|
|
53
|
+
}
|
|
54
|
+
export function identity(): IdentityService;
|
|
55
|
+
export namespace identity {
|
|
56
|
+
const factory: () => ServiceFactory<IdentityService, "plugin">;
|
|
57
|
+
}
|
|
58
|
+
export namespace cache {
|
|
59
|
+
const factory: () => ServiceFactory<CacheService, "plugin">;
|
|
60
|
+
}
|
|
61
|
+
export namespace database {
|
|
62
|
+
const factory: () => ServiceFactory<DatabaseService, "plugin">;
|
|
63
|
+
}
|
|
64
|
+
export namespace httpRouter {
|
|
65
|
+
const factory: (options?: HttpRouterFactoryOptions | undefined) => ServiceFactory<HttpRouterService, "plugin">;
|
|
66
|
+
}
|
|
67
|
+
export namespace lifecycle {
|
|
68
|
+
const factory: () => ServiceFactory<LifecycleService, "plugin">;
|
|
69
|
+
}
|
|
70
|
+
export namespace logger {
|
|
71
|
+
const factory: () => ServiceFactory<LoggerService, "plugin">;
|
|
72
|
+
}
|
|
73
|
+
export namespace permissions {
|
|
74
|
+
const factory: () => ServiceFactory<PermissionsService, "plugin">;
|
|
75
|
+
}
|
|
76
|
+
export namespace rootLifecycle {
|
|
77
|
+
const factory: () => ServiceFactory<RootLifecycleService, "root">;
|
|
78
|
+
}
|
|
79
|
+
export namespace scheduler {
|
|
80
|
+
const factory: () => ServiceFactory<SchedulerService, "plugin">;
|
|
81
|
+
}
|
|
82
|
+
export namespace urlReader {
|
|
83
|
+
const factory: () => ServiceFactory<UrlReaderService, "plugin">;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
33
86
|
|
|
34
87
|
/**
|
|
35
88
|
* Sets up handlers for request mocking
|
|
@@ -42,11 +95,37 @@ export declare function setupRequestMockHandlers(worker: {
|
|
|
42
95
|
resetHandlers: () => void;
|
|
43
96
|
}): void;
|
|
44
97
|
|
|
45
|
-
|
|
98
|
+
/** @public */
|
|
99
|
+
export declare function startTestBackend<TServices extends any[], TExtensionPoints extends any[]>(options: TestBackendOptions<TServices, TExtensionPoints>): Promise<TestBackend>;
|
|
46
100
|
|
|
47
|
-
|
|
101
|
+
/** @public */
|
|
102
|
+
export declare interface TestBackend extends Backend {
|
|
103
|
+
/**
|
|
104
|
+
* Provides access to the underling HTTP server for use with utilities
|
|
105
|
+
* such as `supertest`.
|
|
106
|
+
*
|
|
107
|
+
* If the root http router service has been replaced, this will throw an error.
|
|
108
|
+
*/
|
|
109
|
+
readonly server: ExtendedHttpServer;
|
|
110
|
+
}
|
|
48
111
|
|
|
49
|
-
|
|
112
|
+
/** @public */
|
|
113
|
+
export declare interface TestBackendOptions<TServices extends any[], TExtensionPoints extends any[]> {
|
|
114
|
+
services?: readonly [
|
|
115
|
+
...{
|
|
116
|
+
[index in keyof TServices]: ServiceFactory<TServices[index]> | (() => ServiceFactory<TServices[index]>) | [ServiceRef<TServices[index]>, Partial<TServices[index]>];
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
extensionPoints?: readonly [
|
|
120
|
+
...{
|
|
121
|
+
[index in keyof TExtensionPoints]: [
|
|
122
|
+
ExtensionPoint<TExtensionPoints[index]>,
|
|
123
|
+
Partial<TExtensionPoints[index]>
|
|
124
|
+
];
|
|
125
|
+
}
|
|
126
|
+
];
|
|
127
|
+
features?: BackendFeature[];
|
|
128
|
+
}
|
|
50
129
|
|
|
51
130
|
/**
|
|
52
131
|
* The possible databases to test against.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/backend-test-utils",
|
|
3
3
|
"description": "Test helpers library for Backstage backends",
|
|
4
|
-
"version": "0.1.34
|
|
4
|
+
"version": "0.1.34",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"publishConfig": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"start": "backstage-cli package start"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@backstage/backend-app-api": "^0.4.0
|
|
38
|
-
"@backstage/backend-common": "^0.18.2
|
|
39
|
-
"@backstage/backend-plugin-api": "^0.4.0
|
|
37
|
+
"@backstage/backend-app-api": "^0.4.0",
|
|
38
|
+
"@backstage/backend-common": "^0.18.2",
|
|
39
|
+
"@backstage/backend-plugin-api": "^0.4.0",
|
|
40
40
|
"@backstage/config": "^1.0.6",
|
|
41
|
-
"@backstage/plugin-auth-node": "^0.2.11
|
|
41
|
+
"@backstage/plugin-auth-node": "^0.2.11",
|
|
42
42
|
"@backstage/types": "^1.0.2",
|
|
43
43
|
"better-sqlite3": "^8.0.0",
|
|
44
44
|
"express": "^4.17.1",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"uuid": "^8.0.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@backstage/cli": "^0.22.2
|
|
53
|
+
"@backstage/cli": "^0.22.2",
|
|
54
54
|
"@types/supertest": "^2.0.8",
|
|
55
55
|
"supertest": "^6.1.3"
|
|
56
56
|
},
|