codify-plugin-test 0.0.53-beta11 → 0.0.53-beta13
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/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin-process.d.ts +5 -0
- package/dist/plugin-process.js +17 -15
- package/dist/plugin-process.js.map +1 -1
- package/dist/plugin-tester.js +6 -3
- package/dist/plugin-tester.js.map +1 -1
- package/dist/spawn.d.ts +1 -0
- package/dist/spawn.js +9 -0
- package/dist/spawn.js.map +1 -1
- package/dist/test-utils.js +2 -0
- package/dist/test-utils.js.map +1 -1
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +2 -1
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -0
- package/src/plugin-process.ts +9 -14
- package/src/plugin-tester.ts +7 -5
- package/src/spawn.ts +4 -0
- package/src/utils.ts +1 -1
- package/test/plugin-tester.test.ts +11 -0
- package/test/test-plugin.ts +34 -5
- package/tsconfig.json +1 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAA;AAClC,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA"}
|
package/dist/plugin-process.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import { ApplyRequestData, ImportRequestData, ImportResponseData, InitializeResp
|
|
|
2
2
|
import { ChildProcess } from 'node:child_process';
|
|
3
3
|
export declare class PluginProcess {
|
|
4
4
|
childProcess: ChildProcess;
|
|
5
|
+
/**
|
|
6
|
+
* PluginTester is a helper class to integration test plugins. It launches plugins via fork() just like CodifyCLI does.
|
|
7
|
+
*
|
|
8
|
+
* @param pluginPath A fully qualified path
|
|
9
|
+
*/
|
|
5
10
|
constructor(pluginPath: string);
|
|
6
11
|
initialize(): Promise<InitializeResponseData>;
|
|
7
12
|
validate(data: ValidateRequestData): Promise<ValidateResponseData>;
|
package/dist/plugin-process.js
CHANGED
|
@@ -2,8 +2,6 @@ import Ajv from 'ajv';
|
|
|
2
2
|
import { CommandRequestDataSchema, IpcMessageSchema, MessageCmd } from 'codify-schemas';
|
|
3
3
|
import { nanoid } from 'nanoid';
|
|
4
4
|
import { fork } from 'node:child_process';
|
|
5
|
-
import fs from 'node:fs/promises';
|
|
6
|
-
import * as os from 'node:os';
|
|
7
5
|
import path from 'node:path';
|
|
8
6
|
import { spawnSafe } from './spawn.js';
|
|
9
7
|
import { CodifyTestUtils } from './test-utils.js';
|
|
@@ -14,12 +12,19 @@ const ipcMessageValidator = ajv.compile(IpcMessageSchema);
|
|
|
14
12
|
const commandRequestValidator = ajv.compile(CommandRequestDataSchema);
|
|
15
13
|
export class PluginProcess {
|
|
16
14
|
childProcess;
|
|
15
|
+
/**
|
|
16
|
+
* PluginTester is a helper class to integration test plugins. It launches plugins via fork() just like CodifyCLI does.
|
|
17
|
+
*
|
|
18
|
+
* @param pluginPath A fully qualified path
|
|
19
|
+
*/
|
|
17
20
|
constructor(pluginPath) {
|
|
18
21
|
if (!path.isAbsolute(pluginPath)) {
|
|
19
22
|
throw new Error('A fully qualified path must be supplied to PluginTester');
|
|
20
23
|
}
|
|
21
24
|
const debug = (process.env.DEBUG) ? ['--inspect-brk=9221'] : [];
|
|
22
25
|
this.childProcess = fork(pluginPath, [], {
|
|
26
|
+
// Use default true to test plugins in secure mode (un-able to request sudo directly)
|
|
27
|
+
// detached: true,
|
|
23
28
|
env: { ...process.env },
|
|
24
29
|
execArgv: ['--import', 'tsx/esm', ...debug],
|
|
25
30
|
stdio: 'pipe',
|
|
@@ -66,8 +71,9 @@ export class PluginProcess {
|
|
|
66
71
|
kill() {
|
|
67
72
|
this.childProcess.kill();
|
|
68
73
|
}
|
|
69
|
-
handleIncomingRequests(
|
|
70
|
-
|
|
74
|
+
handleIncomingRequests(cp) {
|
|
75
|
+
// Listen for incoming sudo incoming sudo requests
|
|
76
|
+
cp.on('message', async (message) => {
|
|
71
77
|
if (!ipcMessageValidator(message)) {
|
|
72
78
|
throw new Error(`Invalid message from plugin. ${JSON.stringify(message, null, 2)}`);
|
|
73
79
|
}
|
|
@@ -78,7 +84,7 @@ export class PluginProcess {
|
|
|
78
84
|
}
|
|
79
85
|
const { command, options } = data;
|
|
80
86
|
const result = await spawnSafe(command, options);
|
|
81
|
-
|
|
87
|
+
cp.send({
|
|
82
88
|
cmd: MessageCmd.COMMAND_REQUEST + '_Response',
|
|
83
89
|
data: result,
|
|
84
90
|
requestId,
|
|
@@ -89,7 +95,7 @@ export class PluginProcess {
|
|
|
89
95
|
if (!commandRequestValidator(data)) {
|
|
90
96
|
throw new Error(`Invalid sudo request from plugin. ${JSON.stringify(commandRequestValidator.errors, null, 2)}`);
|
|
91
97
|
}
|
|
92
|
-
|
|
98
|
+
cp.send({
|
|
93
99
|
cmd: MessageCmd.PRESS_KEY_TO_CONTINUE_REQUEST + '_Response',
|
|
94
100
|
data: {},
|
|
95
101
|
requestId,
|
|
@@ -97,17 +103,13 @@ export class PluginProcess {
|
|
|
97
103
|
}
|
|
98
104
|
if (message.cmd === MessageCmd.CODIFY_CREDENTIALS_REQUEST) {
|
|
99
105
|
const { requestId } = message;
|
|
100
|
-
const
|
|
101
|
-
if (!
|
|
102
|
-
throw new Error('Unable to
|
|
106
|
+
const testJwt = process.env.VITE_CODIFY_TEST_JWT;
|
|
107
|
+
if (!testJwt) {
|
|
108
|
+
throw new Error('Unable to parse login credentials from VITE_CODIFY_TEST_JWT env var. Please set and try again');
|
|
103
109
|
}
|
|
104
|
-
|
|
105
|
-
if (!login) {
|
|
106
|
-
throw new Error('Unable to parse login credentials');
|
|
107
|
-
}
|
|
108
|
-
process.send({
|
|
110
|
+
cp.send({
|
|
109
111
|
cmd: MessageCmd.CODIFY_CREDENTIALS_REQUEST + '_Response',
|
|
110
|
-
data:
|
|
112
|
+
data: testJwt,
|
|
111
113
|
requestId,
|
|
112
114
|
});
|
|
113
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-process.js","sourceRoot":"","sources":["../src/plugin-process.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAGL,wBAAwB,EAIxB,gBAAgB,EAEhB,UAAU,EAKX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAgB,IAAI,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-process.js","sourceRoot":"","sources":["../src/plugin-process.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAGL,wBAAwB,EAIxB,gBAAgB,EAEhB,UAAU,EAKX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAgB,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC;IAC1B,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,MAAM,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC1D,MAAM,uBAAuB,GAAG,GAAG,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAEtE,MAAM,OAAO,aAAa;IACx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G,WAAW;oBACxD,IAAI,EAAE,OAAO;oBACb,SAAS;iBACV,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CAEF"}
|
package/dist/plugin-tester.js
CHANGED
|
@@ -2,12 +2,13 @@ import chalk from 'chalk';
|
|
|
2
2
|
import { ResourceOperation, } from 'codify-schemas';
|
|
3
3
|
import unionBy from 'lodash.unionby';
|
|
4
4
|
import { PluginProcess } from './plugin-process.js';
|
|
5
|
-
import {
|
|
5
|
+
import { getPlatformOs, splitUserConfig } from './utils.js';
|
|
6
|
+
import os from 'node:os';
|
|
6
7
|
export class PluginTester {
|
|
7
8
|
static async fullTest(pluginPath, configs, options) {
|
|
8
|
-
configs = configs.filter((c) => !c.os || c.os.includes(
|
|
9
|
+
configs = configs.filter((c) => !c.os || c.os.includes(getPlatformOs()));
|
|
9
10
|
const ids = configs
|
|
10
|
-
.map((c) => `${c.type}
|
|
11
|
+
.map((c) => `${c.type}${c.name ? `.${c.name}` : ''}`)
|
|
11
12
|
.join(', ');
|
|
12
13
|
console.info(chalk.cyan(`Starting full test of [ ${ids} ]...`));
|
|
13
14
|
const { skipUninstall = false, } = options ?? {};
|
|
@@ -19,6 +20,7 @@ export class PluginTester {
|
|
|
19
20
|
if (unsupportedConfigs.length > 0) {
|
|
20
21
|
throw new Error(`The plugin does not support the following configs supplied:\n ${JSON.stringify(unsupportedConfigs, null, 2)}\n Initialize result: ${JSON.stringify(initializeResult)}`);
|
|
21
22
|
}
|
|
23
|
+
configs = configs.filter((c) => initializeResult.resourceDefinitions.find((rd) => rd.type === c.type)?.operatingSystems?.includes(os.platform()));
|
|
22
24
|
console.info(chalk.cyan('Testing validate...'));
|
|
23
25
|
const validate = await plugin.validate({ configs: configs.map((c) => {
|
|
24
26
|
const { coreParameters, parameters } = splitUserConfig(c);
|
|
@@ -107,6 +109,7 @@ ${JSON.stringify(modifyPlans, null, 2)}`);
|
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
if (!skipUninstall) {
|
|
112
|
+
// We need to add unique names to multiple configs with the same type or else it breaks the unionBy below.
|
|
110
113
|
const configsWithNames = this.addNamesToConfigs(configs);
|
|
111
114
|
const modifiedConfigs = this.addNamesToConfigs(options?.testModify?.modifiedConfigs ?? []);
|
|
112
115
|
const id = (config) => config.type + (config.name ? `.${config.name}` : '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-tester.js","sourceRoot":"","sources":["../src/plugin-tester.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"plugin-tester.js","sourceRoot":"","sources":["../src/plugin-tester.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,MAAM,OAAO,YAAY;IACvB,MAAM,CAAC,KAAK,CAAC,QAAQ,CACnB,UAAkB,EAClB,OAAyB,EACzB,OAWD;QACC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC;QACzE,MAAM,GAAG,GAAG,OAAO;aAChB,GAAG,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,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAA,CAAC,CAAC,CAAC,CAAC;YAC7E,CAAC;YAED,gBAAgB,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF"}
|
package/dist/spawn.d.ts
CHANGED
|
@@ -11,4 +11,5 @@ export interface SpawnOptions {
|
|
|
11
11
|
requiresRoot?: boolean;
|
|
12
12
|
stdin?: boolean;
|
|
13
13
|
}
|
|
14
|
+
export declare function testSpawn(cmd: string, options?: SpawnOptions): Promise<SpawnResult>;
|
|
14
15
|
export declare function spawnSafe(cmd: string, options?: SpawnOptions): Promise<SpawnResult>;
|
package/dist/spawn.js
CHANGED
|
@@ -2,6 +2,9 @@ import * as pty from '@homebridge/node-pty-prebuilt-multiarch';
|
|
|
2
2
|
import { SpawnStatus } from 'codify-schemas';
|
|
3
3
|
import stripAnsi from 'strip-ansi';
|
|
4
4
|
import { Shell, ShellUtils } from './shell.js';
|
|
5
|
+
export function testSpawn(cmd, options) {
|
|
6
|
+
return spawnSafe(cmd, { interactive: true, ...options, });
|
|
7
|
+
}
|
|
5
8
|
export function spawnSafe(cmd, options) {
|
|
6
9
|
if (cmd.toLowerCase().includes('sudo')) {
|
|
7
10
|
throw new Error('Command must not include sudo');
|
|
@@ -10,6 +13,8 @@ export function spawnSafe(cmd, options) {
|
|
|
10
13
|
return new Promise((resolve) => {
|
|
11
14
|
const output = [];
|
|
12
15
|
const historyIgnore = ShellUtils.getShell() === Shell.ZSH ? { HISTORY_IGNORE: '*' } : { HISTIGNORE: '*' };
|
|
16
|
+
// If TERM_PROGRAM=Apple_Terminal is set then ANSI escape characters may be included
|
|
17
|
+
// in the response.
|
|
13
18
|
const env = {
|
|
14
19
|
...process.env, ...options?.env,
|
|
15
20
|
TERM_PROGRAM: 'codify',
|
|
@@ -17,10 +22,12 @@ export function spawnSafe(cmd, options) {
|
|
|
17
22
|
COLORTERM: 'truecolor',
|
|
18
23
|
...historyIgnore
|
|
19
24
|
};
|
|
25
|
+
// Initial terminal dimensions
|
|
20
26
|
const initialCols = process.stdout.columns ?? 80;
|
|
21
27
|
const initialRows = process.stdout.rows ?? 24;
|
|
22
28
|
const command = options?.requiresRoot ? `sudo ${cmd}` : cmd;
|
|
23
29
|
const args = options?.interactive ? ['-i', '-c', command] : ['-c', command];
|
|
30
|
+
// Run the command in a pty for interactivity
|
|
24
31
|
const mPty = pty.spawn(ShellUtils.getDefaultShell(), args, {
|
|
25
32
|
...options,
|
|
26
33
|
cols: initialCols,
|
|
@@ -36,8 +43,10 @@ export function spawnSafe(cmd, options) {
|
|
|
36
43
|
mPty.resize(columns, rows);
|
|
37
44
|
};
|
|
38
45
|
const stdinListener = (data) => {
|
|
46
|
+
// console.log('stdinListener', data);
|
|
39
47
|
mPty.write(data.toString());
|
|
40
48
|
};
|
|
49
|
+
// Listen to resize events for the terminal window;
|
|
41
50
|
process.stdout.on('resize', resizeListener);
|
|
42
51
|
if (options?.stdin) {
|
|
43
52
|
process.stdin.on('data', stdinListener);
|
package/dist/spawn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../src/spawn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,yCAAyC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAgB/C,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,OAAsB;IAC3D,IAAI,GAAG,CAAC,WAAW,EAAE,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CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK;gBACvE,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;aAC1C,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/dist/test-utils.js
CHANGED
|
@@ -11,6 +11,7 @@ export const CodifyTestUtils = {
|
|
|
11
11
|
if (!ipcMessageValidator(response)) {
|
|
12
12
|
throw new Error(`Invalid message from plugin. ${JSON.stringify(message, null, 2)}`);
|
|
13
13
|
}
|
|
14
|
+
// Wait for the message response. Other messages such as sudoRequest may be sent before the response returns
|
|
14
15
|
if (response.requestId === message.requestId) {
|
|
15
16
|
if (response.status === MessageStatus.SUCCESS) {
|
|
16
17
|
resolve(response.data);
|
|
@@ -20,6 +21,7 @@ export const CodifyTestUtils = {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
});
|
|
24
|
+
// Send message last to ensure listeners are all registered
|
|
23
25
|
process.send(message);
|
|
24
26
|
});
|
|
25
27
|
},
|
package/dist/test-utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-utils.js","sourceRoot":"","sources":["../src/test-utils.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAgB,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/E,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC;IAC1B,MAAM,EAAE,IAAI;CACb,CAAC,CAAC;AACH,MAAM,mBAAmB,GAAG,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,2BAA2B,CAAC,OAAqB,EA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E,CAAC;wBAC9C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;oBACxB,CAAC;yBAAM,CAAC;wBACN,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;oBAC1C,CAAC;gBACH,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,2DAA2D;YAC3D,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;CAEF,CAAC"}
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -7,13 +7,14 @@ export function splitUserConfig(config) {
|
|
|
7
7
|
...(config.dependsOn ? { dependsOn: config.dependsOn } : {}),
|
|
8
8
|
...(config.os ? { os: config.os } : {}),
|
|
9
9
|
};
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
11
|
const { type, name, dependsOn, os, ...parameters } = config;
|
|
11
12
|
return {
|
|
12
13
|
parameters: parameters,
|
|
13
14
|
coreParameters,
|
|
14
15
|
};
|
|
15
16
|
}
|
|
16
|
-
export function
|
|
17
|
+
export function getPlatformOs() {
|
|
17
18
|
const currOs = os.platform();
|
|
18
19
|
switch (currOs) {
|
|
19
20
|
case 'darwin': {
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAAuB,MAAM,gBAAgB,CAAC;AACjF,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,MAAM,UAAU,eAAe,CAC7B,MAA0B;IAE1B,MAAM,cAAc,GAAG;QACrB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,E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AC;QACf,KAAK,QAAQ,CAAC,CAAC,CAAC;YACd,OAAO,UAAU,CAAC,KAAK,CAAC;QAC1B,CAAC;QAED,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,OAAO,UAAU,CAAC,KAAK,CAAC;QAC1B,CAAC;QAED,KAAK,OAAO,CAAC,CAAC,CAAC;YACb,OAAO,UAAU,CAAC,OAAO,CAAC;QAC5B,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codify-plugin-test",
|
|
3
|
-
"version": "0.0.53-
|
|
3
|
+
"version": "0.0.53-beta13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"eslint-config-oclif-typescript": "^3",
|
|
38
38
|
"eslint-config-prettier": "^9.0.0",
|
|
39
39
|
"tsx": "^4.7.3",
|
|
40
|
-
"typescript": "
|
|
40
|
+
"typescript": "5.3.3",
|
|
41
41
|
"vitest": "^1.4.0",
|
|
42
42
|
"codify-plugin-lib": "1.0.182-beta9"
|
|
43
43
|
},
|
package/src/index.ts
CHANGED
package/src/plugin-process.ts
CHANGED
|
@@ -107,9 +107,9 @@ export class PluginProcess {
|
|
|
107
107
|
this.childProcess.kill();
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
private handleIncomingRequests(
|
|
110
|
+
private handleIncomingRequests(cp: ChildProcess) {
|
|
111
111
|
// Listen for incoming sudo incoming sudo requests
|
|
112
|
-
|
|
112
|
+
cp.on('message', async (message) => {
|
|
113
113
|
if (!ipcMessageValidator(message)) {
|
|
114
114
|
throw new Error(`Invalid message from plugin. ${JSON.stringify(message, null, 2)}`);
|
|
115
115
|
}
|
|
@@ -123,7 +123,7 @@ export class PluginProcess {
|
|
|
123
123
|
const { command, options } = data as unknown as CommandRequestData;
|
|
124
124
|
const result = await spawnSafe(command, options);
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
cp.send(<IpcMessageV2>{
|
|
127
127
|
cmd: MessageCmd.COMMAND_REQUEST + '_Response',
|
|
128
128
|
data: result,
|
|
129
129
|
requestId,
|
|
@@ -136,7 +136,7 @@ export class PluginProcess {
|
|
|
136
136
|
throw new Error(`Invalid sudo request from plugin. ${JSON.stringify(commandRequestValidator.errors, null, 2)}`);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
cp.send(<IpcMessageV2>{
|
|
140
140
|
cmd: MessageCmd.PRESS_KEY_TO_CONTINUE_REQUEST + '_Response',
|
|
141
141
|
data: {},
|
|
142
142
|
requestId,
|
|
@@ -146,19 +146,14 @@ export class PluginProcess {
|
|
|
146
146
|
if (message.cmd === MessageCmd.CODIFY_CREDENTIALS_REQUEST) {
|
|
147
147
|
const { requestId } = message;
|
|
148
148
|
|
|
149
|
-
const
|
|
150
|
-
if (!
|
|
151
|
-
throw new Error('Unable to
|
|
149
|
+
const testJwt = process.env.VITE_CODIFY_TEST_JWT;
|
|
150
|
+
if (!testJwt) {
|
|
151
|
+
throw new Error('Unable to parse login credentials from VITE_CODIFY_TEST_JWT env var. Please set and try again');
|
|
152
152
|
}
|
|
153
153
|
|
|
154
|
-
|
|
155
|
-
if (!login) {
|
|
156
|
-
throw new Error('Unable to parse login credentials')
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
process.send(<IpcMessageV2>{
|
|
154
|
+
cp.send(<IpcMessageV2>{
|
|
160
155
|
cmd: MessageCmd.CODIFY_CREDENTIALS_REQUEST + '_Response',
|
|
161
|
-
data:
|
|
156
|
+
data: testJwt,
|
|
162
157
|
requestId,
|
|
163
158
|
})
|
|
164
159
|
}
|
package/src/plugin-tester.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import {
|
|
3
|
-
ImportResponseData,
|
|
3
|
+
ImportResponseData, OS,
|
|
4
4
|
PlanResponseData,
|
|
5
5
|
ResourceConfig,
|
|
6
6
|
ResourceOperation,
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
import unionBy from 'lodash.unionby';
|
|
9
9
|
|
|
10
10
|
import { PluginProcess } from './plugin-process.js';
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
11
|
+
import { getPlatformOs, splitUserConfig } from './utils.js';
|
|
12
|
+
import os from 'node:os';
|
|
13
13
|
|
|
14
14
|
export class PluginTester {
|
|
15
15
|
static async fullTest(
|
|
@@ -27,9 +27,9 @@ export class PluginTester {
|
|
|
27
27
|
validateModify?: (plans: PlanResponseData[]) => Promise<void> | void,
|
|
28
28
|
}
|
|
29
29
|
}): Promise<void> {
|
|
30
|
-
configs = configs.filter((c) => !c.os || c.os.includes(
|
|
30
|
+
configs = configs.filter((c) => !c.os || c.os.includes(getPlatformOs()));
|
|
31
31
|
const ids = configs
|
|
32
|
-
.map((c) => `${c.type}
|
|
32
|
+
.map((c) => `${c.type}${c.name ? `.${c.name}` : ''}`)
|
|
33
33
|
.join(', ')
|
|
34
34
|
console.info(chalk.cyan(`Starting full test of [ ${ids} ]...`));
|
|
35
35
|
|
|
@@ -51,6 +51,8 @@ export class PluginTester {
|
|
|
51
51
|
throw new Error(`The plugin does not support the following configs supplied:\n ${JSON.stringify(unsupportedConfigs, null, 2)}\n Initialize result: ${JSON.stringify(initializeResult)}`)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
configs = configs.filter((c) => initializeResult.resourceDefinitions.find((rd) => rd.type === c.type)?.operatingSystems?.includes(os.platform() as OS));
|
|
55
|
+
|
|
54
56
|
console.info(chalk.cyan('Testing validate...'))
|
|
55
57
|
const validate = await plugin.validate({ configs: configs.map((c) => {
|
|
56
58
|
const { coreParameters, parameters } = splitUserConfig(c)
|
package/src/spawn.ts
CHANGED
|
@@ -18,6 +18,10 @@ export interface SpawnOptions {
|
|
|
18
18
|
stdin?: boolean,
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
export function testSpawn(cmd: string, options?: SpawnOptions): Promise<SpawnResult> {
|
|
22
|
+
return spawnSafe(cmd, { interactive: true, ...options, });
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
export function spawnSafe(cmd: string, options?: SpawnOptions): Promise<SpawnResult> {
|
|
22
26
|
if (cmd.toLowerCase().includes('sudo')) {
|
|
23
27
|
throw new Error('Command must not include sudo')
|
package/src/utils.ts
CHANGED
|
@@ -313,6 +313,17 @@ describe('Plugin tester integration tests', () => {
|
|
|
313
313
|
}
|
|
314
314
|
})
|
|
315
315
|
|
|
316
|
+
it('Can filter out unsupported configs based on OS', { timeout: 300000 }, async () => {
|
|
317
|
+
await PluginTester.fullTest(pluginPath, [{
|
|
318
|
+
type: 'windows-only',
|
|
319
|
+
}], {
|
|
320
|
+
validatePlan(plan) {
|
|
321
|
+
expect(plan.length).to.eq(0);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
|
|
316
327
|
|
|
317
328
|
// it('Can uninstall two resources with the same type', async () => {
|
|
318
329
|
// await plugin.fullTest([{
|
package/test/test-plugin.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CreatePlan,
|
|
3
|
-
DestroyPlan,
|
|
3
|
+
DestroyPlan,
|
|
4
|
+
ModifyPlan,
|
|
4
5
|
ParameterChange,
|
|
5
6
|
Plugin,
|
|
6
7
|
Resource,
|
|
7
8
|
ResourceSettings,
|
|
8
9
|
runPlugin
|
|
9
10
|
} from 'codify-plugin-lib';
|
|
10
|
-
import { StringIndexedObject } from 'codify-schemas';
|
|
11
|
-
import { b } from 'vitest/dist/reporters-yx5ZTtEV';
|
|
11
|
+
import { OS, StringIndexedObject } from 'codify-schemas';
|
|
12
12
|
import * as fs from 'node:fs';
|
|
13
13
|
|
|
14
14
|
export interface TestConfig extends StringIndexedObject {
|
|
@@ -27,6 +27,7 @@ export class TestResource extends Resource<TestConfig> {
|
|
|
27
27
|
getSettings(): ResourceSettings<TestConfig> {
|
|
28
28
|
return {
|
|
29
29
|
id: 'test',
|
|
30
|
+
operatingSystems: [OS.Linux, OS.Darwin],
|
|
30
31
|
allowMultiple: true,
|
|
31
32
|
};
|
|
32
33
|
}
|
|
@@ -54,6 +55,7 @@ export class TestResource2 extends Resource<TestConfig2> {
|
|
|
54
55
|
getSettings(): ResourceSettings<TestConfig2> {
|
|
55
56
|
return {
|
|
56
57
|
id: 'test2',
|
|
58
|
+
operatingSystems: [OS.Linux, OS.Darwin],
|
|
57
59
|
parameterSettings: {
|
|
58
60
|
propB: { type: 'array' }
|
|
59
61
|
}
|
|
@@ -82,7 +84,8 @@ export class TestUninstallResource extends Resource<TestConfig> {
|
|
|
82
84
|
first = true;
|
|
83
85
|
getSettings(): ResourceSettings<TestConfig> {
|
|
84
86
|
return {
|
|
85
|
-
id: 'test-uninstall'
|
|
87
|
+
id: 'test-uninstall',
|
|
88
|
+
operatingSystems: [OS.Linux, OS.Darwin],
|
|
86
89
|
}
|
|
87
90
|
}
|
|
88
91
|
|
|
@@ -106,6 +109,7 @@ export class TestModifyResource extends Resource<TestConfig> {
|
|
|
106
109
|
getSettings(): ResourceSettings<TestConfig> {
|
|
107
110
|
return {
|
|
108
111
|
id: 'test-modify',
|
|
112
|
+
operatingSystems: [OS.Linux, OS.Darwin],
|
|
109
113
|
parameterSettings: {
|
|
110
114
|
propA: { type: 'string', canModify: true },
|
|
111
115
|
propB: { type: 'string', canModify: true },
|
|
@@ -141,6 +145,7 @@ export class TestDestroyResource extends Resource<TestConfig> {
|
|
|
141
145
|
getSettings(): ResourceSettings<TestConfig> {
|
|
142
146
|
return {
|
|
143
147
|
id: 'test-destroy',
|
|
148
|
+
operatingSystems: [OS.Linux, OS.Darwin],
|
|
144
149
|
}
|
|
145
150
|
}
|
|
146
151
|
|
|
@@ -165,6 +170,29 @@ export class TestDestroyResource extends Resource<TestConfig> {
|
|
|
165
170
|
}
|
|
166
171
|
}
|
|
167
172
|
|
|
173
|
+
export class WindowsOnlyResource extends Resource<TestConfig> {
|
|
174
|
+
private name: string;
|
|
175
|
+
|
|
176
|
+
getSettings(): ResourceSettings<TestConfig> {
|
|
177
|
+
return {
|
|
178
|
+
id: 'windows-only',
|
|
179
|
+
operatingSystems: [OS.Windows],
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
async refresh(parameters: Partial<TestConfig>): Promise<Array<Partial<TestConfig>> | Partial<TestConfig> | null> {
|
|
184
|
+
return {};
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async modify(pc: ParameterChange<TestConfig>, plan: ModifyPlan<TestConfig>): Promise<void> {
|
|
188
|
+
return super.modify(pc, plan);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async create(plan: CreatePlan<TestConfig>): Promise<void> {}
|
|
192
|
+
|
|
193
|
+
async destroy(plan: DestroyPlan<TestConfig>): Promise<void> {}
|
|
194
|
+
}
|
|
195
|
+
|
|
168
196
|
export class TestDestroyResource2 extends TestDestroyResource {
|
|
169
197
|
getSettings(): ResourceSettings<TestConfig> {
|
|
170
198
|
return {
|
|
@@ -181,6 +209,7 @@ runPlugin(Plugin.create(
|
|
|
181
209
|
new TestUninstallResource(),
|
|
182
210
|
new TestModifyResource(),
|
|
183
211
|
new TestDestroyResource(),
|
|
184
|
-
new TestDestroyResource2()
|
|
212
|
+
new TestDestroyResource2(),
|
|
213
|
+
new WindowsOnlyResource(),
|
|
185
214
|
]
|
|
186
215
|
));
|
package/tsconfig.json
CHANGED
|
@@ -7,13 +7,12 @@
|
|
|
7
7
|
"resolveJsonModule": true,
|
|
8
8
|
"alwaysStrict": true,
|
|
9
9
|
"noImplicitAny": true,
|
|
10
|
-
"removeComments": true,
|
|
11
10
|
"strictNullChecks": true,
|
|
12
11
|
"declaration": true,
|
|
13
12
|
"emitDecoratorMetadata": true,
|
|
14
13
|
"experimentalDecorators": true,
|
|
15
14
|
"rootDir": "src",
|
|
16
|
-
"outDir": "./dist"
|
|
15
|
+
"outDir": "./dist",
|
|
17
16
|
},
|
|
18
17
|
"exclude": [
|
|
19
18
|
"node_modules",
|