@codifycli/plugin-test 1.1.0-beta1 → 1.1.0-beta3
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/.claude/settings.local.json +5 -0
- package/dist/plugin-tester.d.ts +20 -12
- package/dist/plugin-tester.js +141 -114
- package/dist/plugin-tester.js.map +1 -1
- package/dist/spawn.js +3 -2
- package/dist/spawn.js.map +1 -1
- package/package.json +1 -1
- package/src/plugin-tester.ts +191 -150
- package/src/spawn.ts +4 -2
package/dist/plugin-tester.d.ts
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
import { ImportResponseData, PlanResponseData, ResourceConfig } from '@codifycli/schemas';
|
|
2
|
+
export interface FullTestOptions {
|
|
3
|
+
skipUninstall?: boolean;
|
|
4
|
+
skipImport?: boolean;
|
|
5
|
+
prerequisites?: ResourceConfig[];
|
|
6
|
+
validatePlan?: (plans: PlanResponseData[]) => Promise<void> | void;
|
|
7
|
+
validateApply?: (plans: PlanResponseData[]) => Promise<void> | void;
|
|
8
|
+
validateDestroy?: (plans: PlanResponseData[]) => Promise<void> | void;
|
|
9
|
+
validateImport?: (importResults: (ImportResponseData['result'][0])[]) => Promise<void> | void;
|
|
10
|
+
testModify?: {
|
|
11
|
+
modifiedConfigs: ResourceConfig[];
|
|
12
|
+
validateModify?: (plans: PlanResponseData[]) => Promise<void> | void;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
2
15
|
export declare class PluginTester {
|
|
3
|
-
static fullTest(pluginPath: string, configs: ResourceConfig[], options?:
|
|
4
|
-
skipUninstall?: boolean;
|
|
5
|
-
skipImport?: boolean;
|
|
6
|
-
validatePlan?: (plans: PlanResponseData[]) => Promise<void> | void;
|
|
7
|
-
validateApply?: (plans: PlanResponseData[]) => Promise<void> | void;
|
|
8
|
-
validateDestroy?: (plans: PlanResponseData[]) => Promise<void> | void;
|
|
9
|
-
validateImport?: (importResults: (ImportResponseData['result'][0])[]) => Promise<void> | void;
|
|
10
|
-
testModify?: {
|
|
11
|
-
modifiedConfigs: ResourceConfig[];
|
|
12
|
-
validateModify?: (plans: PlanResponseData[]) => Promise<void> | void;
|
|
13
|
-
};
|
|
14
|
-
}): Promise<void>;
|
|
16
|
+
static fullTest(pluginPath: string, configs: ResourceConfig[], options?: FullTestOptions): Promise<void>;
|
|
15
17
|
static install(pluginPath: string, configs: ResourceConfig[]): Promise<void>;
|
|
16
18
|
static uninstall(pluginPath: string, configs: ResourceConfig[], options?: {
|
|
17
19
|
validateDestroy?: (plans: PlanResponseData[]) => Promise<void> | void;
|
|
18
20
|
}): Promise<void>;
|
|
21
|
+
private static ensurePrerequisites;
|
|
22
|
+
private static initializeAndValidate;
|
|
23
|
+
private static planConfigs;
|
|
24
|
+
private static applyPlans;
|
|
25
|
+
private static runImportPhase;
|
|
26
|
+
private static runModifyPhase;
|
|
19
27
|
private static addNamesToConfigs;
|
|
20
28
|
}
|
package/dist/plugin-tester.js
CHANGED
|
@@ -10,47 +10,20 @@ export class PluginTester {
|
|
|
10
10
|
.map((c) => `${c.type}${c.name ? `.${c.name}` : ''}`)
|
|
11
11
|
.join(', ');
|
|
12
12
|
console.info(chalk.cyan(`Starting full test of [ ${ids} ]...`));
|
|
13
|
-
const { skipUninstall = false
|
|
13
|
+
const { skipUninstall = false } = options ?? {};
|
|
14
|
+
if (options?.prerequisites?.length) {
|
|
15
|
+
await this.ensurePrerequisites(pluginPath, options.prerequisites);
|
|
16
|
+
}
|
|
14
17
|
const plugin = new PluginProcess(pluginPath);
|
|
15
18
|
try {
|
|
16
|
-
|
|
17
|
-
const initializeResult = await plugin.initialize();
|
|
18
|
-
const unsupportedConfigs = configs.filter((c) => !initializeResult.resourceDefinitions.some((rd) => rd.type === c.type));
|
|
19
|
-
if (unsupportedConfigs.length > 0) {
|
|
20
|
-
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
|
-
// configs = configs.filter((c) => initializeResult.resourceDefinitions.find((rd) => rd.type === c.type)?.operatingSystems?.includes(os.platform() as OS));
|
|
23
|
-
console.info(chalk.cyan('Testing validate...'));
|
|
24
|
-
const validate = await plugin.validate({
|
|
25
|
-
configs: configs.map((c) => {
|
|
26
|
-
const { coreParameters, parameters } = splitUserConfig(c);
|
|
27
|
-
return { core: coreParameters, parameters };
|
|
28
|
-
})
|
|
29
|
-
});
|
|
30
|
-
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid);
|
|
31
|
-
if (invalidConfigs.length > 0) {
|
|
32
|
-
throw new Error(`The following configs did not validate:\n ${JSON.stringify(invalidConfigs, null, 2)}`);
|
|
33
|
-
}
|
|
19
|
+
await this.initializeAndValidate(plugin, configs);
|
|
34
20
|
console.info(chalk.cyan('Testing plan...'));
|
|
35
|
-
const plans =
|
|
36
|
-
for (const config of configs) {
|
|
37
|
-
const { coreParameters, parameters } = splitUserConfig(config);
|
|
38
|
-
plans.push(await plugin.plan({
|
|
39
|
-
core: coreParameters,
|
|
40
|
-
desired: parameters,
|
|
41
|
-
isStateful: false,
|
|
42
|
-
state: undefined,
|
|
43
|
-
}));
|
|
44
|
-
}
|
|
21
|
+
const plans = await this.planConfigs(plugin, configs);
|
|
45
22
|
if (options?.validatePlan) {
|
|
46
23
|
await options.validatePlan(plans);
|
|
47
24
|
}
|
|
48
25
|
console.info(chalk.cyan('Testing apply...'));
|
|
49
|
-
|
|
50
|
-
await plugin.apply({
|
|
51
|
-
planId: plan.planId
|
|
52
|
-
});
|
|
53
|
-
}
|
|
26
|
+
await this.applyPlans(plugin, plans);
|
|
54
27
|
if (options?.validateApply) {
|
|
55
28
|
await options.validateApply(plans);
|
|
56
29
|
}
|
|
@@ -59,55 +32,10 @@ export class PluginTester {
|
|
|
59
32
|
plugin.kill();
|
|
60
33
|
}
|
|
61
34
|
if (!options?.skipImport) {
|
|
62
|
-
|
|
63
|
-
try {
|
|
64
|
-
await importPlugin.initialize();
|
|
65
|
-
console.info(chalk.cyan('Testing import...'));
|
|
66
|
-
const importResults = [];
|
|
67
|
-
for (const config of configs) {
|
|
68
|
-
const { coreParameters, parameters } = splitUserConfig(config);
|
|
69
|
-
const importResult = await importPlugin.import({ core: coreParameters, parameters });
|
|
70
|
-
importResults.push(importResult);
|
|
71
|
-
}
|
|
72
|
-
if (options?.validateImport) {
|
|
73
|
-
await options.validateImport(importResults.map((r) => r.result[0]));
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
finally {
|
|
77
|
-
importPlugin.kill();
|
|
78
|
-
}
|
|
35
|
+
await this.runImportPhase(pluginPath, configs, options?.validateImport);
|
|
79
36
|
}
|
|
80
37
|
if (options?.testModify) {
|
|
81
|
-
|
|
82
|
-
try {
|
|
83
|
-
await modifyPlugin.initialize();
|
|
84
|
-
console.info(chalk.cyan('Testing modify...'));
|
|
85
|
-
const modifyPlans = [];
|
|
86
|
-
for (const config of options.testModify.modifiedConfigs) {
|
|
87
|
-
const { coreParameters, parameters } = splitUserConfig(config);
|
|
88
|
-
modifyPlans.push(await modifyPlugin.plan({
|
|
89
|
-
core: coreParameters,
|
|
90
|
-
desired: parameters,
|
|
91
|
-
isStateful: false,
|
|
92
|
-
state: undefined,
|
|
93
|
-
}));
|
|
94
|
-
}
|
|
95
|
-
if (modifyPlans.some((p) => p.operation !== ResourceOperation.MODIFY)) {
|
|
96
|
-
throw new Error(`Error while testing modify. Non-modify results were found in the plan:
|
|
97
|
-
${JSON.stringify(modifyPlans, null, 2)}`);
|
|
98
|
-
}
|
|
99
|
-
for (const plan of modifyPlans) {
|
|
100
|
-
await modifyPlugin.apply({
|
|
101
|
-
planId: plan.planId
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
if (options.testModify.validateModify) {
|
|
105
|
-
await options.testModify.validateModify(modifyPlans);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
finally {
|
|
109
|
-
modifyPlugin.kill();
|
|
110
|
-
}
|
|
38
|
+
await this.runModifyPhase(pluginPath, options.testModify);
|
|
111
39
|
}
|
|
112
40
|
if (!skipUninstall) {
|
|
113
41
|
// We need to add unique names to multiple configs with the same type or else it breaks the unionBy below.
|
|
@@ -121,41 +49,11 @@ ${JSON.stringify(modifyPlans, null, 2)}`);
|
|
|
121
49
|
static async install(pluginPath, configs) {
|
|
122
50
|
const plugin = new PluginProcess(pluginPath);
|
|
123
51
|
try {
|
|
124
|
-
|
|
125
|
-
const initializeResult = await plugin.initialize();
|
|
126
|
-
const unsupportedConfigs = configs.filter((c) => !initializeResult.resourceDefinitions.some((rd) => rd.type === c.type));
|
|
127
|
-
if (unsupportedConfigs.length > 0) {
|
|
128
|
-
throw new Error(`The plugin does not support the following configs supplied:\n ${JSON.stringify(unsupportedConfigs, null, 2)}\n Initialize result: ${JSON.stringify(initializeResult)}`);
|
|
129
|
-
}
|
|
130
|
-
// configs = configs.filter((c) => initializeResult.resourceDefinitions.find((rd) => rd.type === c.type)?.operatingSystems?.includes(os.platform() as OS));
|
|
131
|
-
console.info(chalk.cyan('Testing validate...'));
|
|
132
|
-
const validate = await plugin.validate({
|
|
133
|
-
configs: configs.map((c) => {
|
|
134
|
-
const { coreParameters, parameters } = splitUserConfig(c);
|
|
135
|
-
return { core: coreParameters, parameters };
|
|
136
|
-
})
|
|
137
|
-
});
|
|
138
|
-
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid);
|
|
139
|
-
if (invalidConfigs.length > 0) {
|
|
140
|
-
throw new Error(`The following configs did not validate:\n ${JSON.stringify(invalidConfigs, null, 2)}`);
|
|
141
|
-
}
|
|
52
|
+
await this.initializeAndValidate(plugin, configs);
|
|
142
53
|
console.info(chalk.cyan('Testing plan...'));
|
|
143
|
-
const plans =
|
|
144
|
-
for (const config of configs) {
|
|
145
|
-
const { coreParameters, parameters } = splitUserConfig(config);
|
|
146
|
-
plans.push(await plugin.plan({
|
|
147
|
-
core: coreParameters,
|
|
148
|
-
desired: parameters,
|
|
149
|
-
isStateful: false,
|
|
150
|
-
state: undefined,
|
|
151
|
-
}));
|
|
152
|
-
}
|
|
54
|
+
const plans = await this.planConfigs(plugin, configs);
|
|
153
55
|
console.info(chalk.cyan('Testing apply...'));
|
|
154
|
-
|
|
155
|
-
await plugin.apply({
|
|
156
|
-
planId: plan.planId
|
|
157
|
-
});
|
|
158
|
-
}
|
|
56
|
+
await this.applyPlans(plugin, plans);
|
|
159
57
|
}
|
|
160
58
|
finally {
|
|
161
59
|
plugin.kill();
|
|
@@ -192,6 +90,135 @@ ${JSON.stringify(modifyPlans, null, 2)}`);
|
|
|
192
90
|
destroyPlugin.kill();
|
|
193
91
|
}
|
|
194
92
|
}
|
|
93
|
+
static async ensurePrerequisites(pluginPath, prerequisites) {
|
|
94
|
+
prerequisites = prerequisites.filter((c) => !c.os || c.os.includes(getPlatformOs()));
|
|
95
|
+
if (prerequisites.length === 0)
|
|
96
|
+
return;
|
|
97
|
+
const ids = prerequisites.map((c) => `${c.type}${c.name ? `.${c.name}` : ''}`).join(', ');
|
|
98
|
+
console.info(chalk.cyan(`Checking prerequisites [ ${ids} ]...`));
|
|
99
|
+
const plugin = new PluginProcess(pluginPath);
|
|
100
|
+
try {
|
|
101
|
+
const initializeResult = await plugin.initialize();
|
|
102
|
+
const unsupportedConfigs = prerequisites.filter((c) => !initializeResult.resourceDefinitions.some((rd) => rd.type === c.type));
|
|
103
|
+
if (unsupportedConfigs.length > 0) {
|
|
104
|
+
throw new Error(`The plugin does not support the following prerequisite configs:\n ${JSON.stringify(unsupportedConfigs, null, 2)}`);
|
|
105
|
+
}
|
|
106
|
+
const validate = await plugin.validate({
|
|
107
|
+
configs: prerequisites.map((c) => {
|
|
108
|
+
const { coreParameters, parameters } = splitUserConfig(c);
|
|
109
|
+
return { core: coreParameters, parameters };
|
|
110
|
+
})
|
|
111
|
+
});
|
|
112
|
+
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid);
|
|
113
|
+
if (invalidConfigs.length > 0) {
|
|
114
|
+
console.error(chalk.red(`Prerequisites validation failed:\n ${JSON.stringify(invalidConfigs, null, 2)}`));
|
|
115
|
+
throw new Error(`The following prerequisite configs did not validate:\n ${JSON.stringify(invalidConfigs, null, 2)}`);
|
|
116
|
+
}
|
|
117
|
+
for (const config of prerequisites) {
|
|
118
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
119
|
+
const plan = await plugin.plan({
|
|
120
|
+
core: coreParameters,
|
|
121
|
+
desired: parameters,
|
|
122
|
+
isStateful: false,
|
|
123
|
+
state: undefined,
|
|
124
|
+
});
|
|
125
|
+
const label = `${config.type}${config.name ? `.${config.name}` : ''}`;
|
|
126
|
+
if (plan.operation === ResourceOperation.NOOP) {
|
|
127
|
+
console.info(chalk.cyan(`Prerequisite already satisfied: ${label}`));
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
await plugin.apply({ planId: plan.planId });
|
|
131
|
+
console.info(chalk.cyan(`Prerequisite installed: ${label}`));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
plugin.kill();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
static async initializeAndValidate(plugin, configs) {
|
|
140
|
+
console.info(chalk.cyan('Testing initialization...'));
|
|
141
|
+
const initializeResult = await plugin.initialize();
|
|
142
|
+
const unsupportedConfigs = configs.filter((c) => !initializeResult.resourceDefinitions.some((rd) => rd.type === c.type));
|
|
143
|
+
if (unsupportedConfigs.length > 0) {
|
|
144
|
+
throw new Error(`The plugin does not support the following configs supplied:\n ${JSON.stringify(unsupportedConfigs, null, 2)}\n Initialize result: ${JSON.stringify(initializeResult)}`);
|
|
145
|
+
}
|
|
146
|
+
console.info(chalk.cyan('Testing validate...'));
|
|
147
|
+
const validate = await plugin.validate({
|
|
148
|
+
configs: configs.map((c) => {
|
|
149
|
+
const { coreParameters, parameters } = splitUserConfig(c);
|
|
150
|
+
return { core: coreParameters, parameters };
|
|
151
|
+
})
|
|
152
|
+
});
|
|
153
|
+
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid);
|
|
154
|
+
if (invalidConfigs.length > 0) {
|
|
155
|
+
throw new Error(`The following configs did not validate:\n ${JSON.stringify(invalidConfigs, null, 2)}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
static async planConfigs(plugin, configs) {
|
|
159
|
+
const plans = [];
|
|
160
|
+
for (const config of configs) {
|
|
161
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
162
|
+
plans.push(await plugin.plan({
|
|
163
|
+
core: coreParameters,
|
|
164
|
+
desired: parameters,
|
|
165
|
+
isStateful: false,
|
|
166
|
+
state: undefined,
|
|
167
|
+
}));
|
|
168
|
+
}
|
|
169
|
+
return plans;
|
|
170
|
+
}
|
|
171
|
+
static async applyPlans(plugin, plans) {
|
|
172
|
+
for (const plan of plans) {
|
|
173
|
+
await plugin.apply({ planId: plan.planId });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
static async runImportPhase(pluginPath, configs, validateImport) {
|
|
177
|
+
const importPlugin = new PluginProcess(pluginPath);
|
|
178
|
+
try {
|
|
179
|
+
await importPlugin.initialize();
|
|
180
|
+
console.info(chalk.cyan('Testing import...'));
|
|
181
|
+
const importResults = [];
|
|
182
|
+
for (const config of configs) {
|
|
183
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
184
|
+
importResults.push(await importPlugin.import({ core: coreParameters, parameters }));
|
|
185
|
+
}
|
|
186
|
+
if (validateImport) {
|
|
187
|
+
await validateImport(importResults.map((r) => r.result[0]));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
finally {
|
|
191
|
+
importPlugin.kill();
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
static async runModifyPhase(pluginPath, testModify) {
|
|
195
|
+
const modifyPlugin = new PluginProcess(pluginPath);
|
|
196
|
+
try {
|
|
197
|
+
await modifyPlugin.initialize();
|
|
198
|
+
console.info(chalk.cyan('Testing modify...'));
|
|
199
|
+
const modifyPlans = [];
|
|
200
|
+
for (const config of testModify.modifiedConfigs) {
|
|
201
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
202
|
+
modifyPlans.push(await modifyPlugin.plan({
|
|
203
|
+
core: coreParameters,
|
|
204
|
+
desired: parameters,
|
|
205
|
+
isStateful: false,
|
|
206
|
+
state: undefined,
|
|
207
|
+
}));
|
|
208
|
+
}
|
|
209
|
+
if (modifyPlans.some((p) => p.operation !== ResourceOperation.MODIFY)) {
|
|
210
|
+
throw new Error(`Error while testing modify. Non-modify results were found in the plan:
|
|
211
|
+
${JSON.stringify(modifyPlans, null, 2)}`);
|
|
212
|
+
}
|
|
213
|
+
await this.applyPlans(modifyPlugin, modifyPlans);
|
|
214
|
+
if (testModify.validateModify) {
|
|
215
|
+
await testModify.validateModify(modifyPlans);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
finally {
|
|
219
|
+
modifyPlugin.kill();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
195
222
|
static addNamesToConfigs(configs) {
|
|
196
223
|
const configsWithNames = new Array();
|
|
197
224
|
const typeSet = new Set(configs.map((c) => c.type));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-tester.js","sourceRoot":"","sources":["../src/plugin-tester.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE5D,MAAM,OAAO,YAAY;IACvB,MAAM,CAAC,KAAK,CAAC,QAAQ,CACnB,UAAkB,EAClB,OAAyB,EACzB,OAWC;QACD,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EA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IAC1B,CAAC;CACF"}
|
package/dist/spawn.js
CHANGED
|
@@ -49,14 +49,15 @@ export function spawnSafe(cmd, options) {
|
|
|
49
49
|
if (options?.stdin) {
|
|
50
50
|
process.stdin.off('data', stdinListener);
|
|
51
51
|
}
|
|
52
|
+
const raw = stripAnsi(output.join('')).replace(/\r\n/g, '\n').replace(/\r/g, '\n').trim();
|
|
52
53
|
if (options?.throws && result.exitCode !== 0) {
|
|
53
|
-
reject(new Error(
|
|
54
|
+
reject(new Error(raw));
|
|
54
55
|
return;
|
|
55
56
|
}
|
|
56
57
|
resolve({
|
|
57
58
|
status: result.exitCode === 0 ? SpawnStatus.SUCCESS : SpawnStatus.ERROR,
|
|
58
59
|
exitCode: result.exitCode,
|
|
59
|
-
data:
|
|
60
|
+
data: raw,
|
|
60
61
|
});
|
|
61
62
|
});
|
|
62
63
|
});
|
package/dist/spawn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.js","sourceRoot":"","sources":["../src/spawn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,GAAG,MAAM,yCAAyC,CAAC;AAC/D,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAiB/C,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,OAAsB;IAC3D,OAAO,SAAS,CAAC,GAAG,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,OAAO,GAAI,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,GAAW,EAAE,OAAsB;IAC3D,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;IAClD,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,oBAA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AAC,CAAC,CAAC;gBACvB,OAAO;YACT,CAAC;YAED,OAAO,CAAC;gBACN,MAAM,EAAE,MAAM,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK;gBACvE,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,IAAI,EAAE,GAAG;aACV,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codifycli/plugin-test",
|
|
3
|
-
"version": "1.1.0-
|
|
3
|
+
"version": "1.1.0-beta3",
|
|
4
4
|
"description": "Testing framework for Codify plugins with complete lifecycle testing, IPC communication, and cross-platform support",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
package/src/plugin-tester.ts
CHANGED
|
@@ -10,84 +10,54 @@ import unionBy from 'lodash.unionby';
|
|
|
10
10
|
import { PluginProcess } from './plugin-process.js';
|
|
11
11
|
import { getPlatformOs, splitUserConfig } from './utils.js';
|
|
12
12
|
|
|
13
|
+
export interface FullTestOptions {
|
|
14
|
+
skipUninstall?: boolean,
|
|
15
|
+
skipImport?: boolean,
|
|
16
|
+
|
|
17
|
+
// Ensure these resources are installed before testing starts. Will install if missing, but never destroy after.
|
|
18
|
+
prerequisites?: ResourceConfig[],
|
|
19
|
+
|
|
20
|
+
validatePlan?: (plans: PlanResponseData[]) => Promise<void> | void
|
|
21
|
+
validateApply?: (plans: PlanResponseData[]) => Promise<void> | void,
|
|
22
|
+
validateDestroy?: (plans: PlanResponseData[]) => Promise<void> | void,
|
|
23
|
+
validateImport?: (importResults: (ImportResponseData['result'][0])[]) => Promise<void> | void,
|
|
24
|
+
testModify?: {
|
|
25
|
+
modifiedConfigs: ResourceConfig[],
|
|
26
|
+
validateModify?: (plans: PlanResponseData[]) => Promise<void> | void,
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
13
30
|
export class PluginTester {
|
|
14
31
|
static async fullTest(
|
|
15
32
|
pluginPath: string,
|
|
16
33
|
configs: ResourceConfig[],
|
|
17
|
-
options?:
|
|
18
|
-
|
|
19
|
-
skipImport?: boolean,
|
|
20
|
-
validatePlan?: (plans: PlanResponseData[]) => Promise<void> | void
|
|
21
|
-
validateApply?: (plans: PlanResponseData[]) => Promise<void> | void,
|
|
22
|
-
validateDestroy?: (plans: PlanResponseData[]) => Promise<void> | void,
|
|
23
|
-
validateImport?: (importResults: (ImportResponseData['result'][0])[]) => Promise<void> | void,
|
|
24
|
-
testModify?: {
|
|
25
|
-
modifiedConfigs: ResourceConfig[],
|
|
26
|
-
validateModify?: (plans: PlanResponseData[]) => Promise<void> | void,
|
|
27
|
-
}
|
|
28
|
-
}): Promise<void> {
|
|
34
|
+
options?: FullTestOptions,
|
|
35
|
+
): Promise<void> {
|
|
29
36
|
configs = configs.filter((c) => !c.os || c.os.includes(getPlatformOs()));
|
|
30
37
|
const ids = configs
|
|
31
38
|
.map((c) => `${c.type}${c.name ? `.${c.name}` : ''}`)
|
|
32
39
|
.join(', ')
|
|
33
40
|
console.info(chalk.cyan(`Starting full test of [ ${ids} ]...`));
|
|
34
41
|
|
|
42
|
+
const { skipUninstall = false } = options ?? {}
|
|
35
43
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
44
|
+
if (options?.prerequisites?.length) {
|
|
45
|
+
await this.ensurePrerequisites(pluginPath, options.prerequisites);
|
|
46
|
+
}
|
|
40
47
|
|
|
41
48
|
const plugin = new PluginProcess(pluginPath);
|
|
42
49
|
try {
|
|
43
|
-
|
|
44
|
-
const initializeResult = await plugin.initialize();
|
|
45
|
-
|
|
46
|
-
const unsupportedConfigs = configs.filter((c) =>
|
|
47
|
-
!initializeResult.resourceDefinitions.some((rd) => rd.type === c.type)
|
|
48
|
-
)
|
|
49
|
-
if (unsupportedConfigs.length > 0) {
|
|
50
|
-
throw new Error(`The plugin does not support the following configs supplied:\n ${JSON.stringify(unsupportedConfigs, null, 2)}\n Initialize result: ${JSON.stringify(initializeResult)}`)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// configs = configs.filter((c) => initializeResult.resourceDefinitions.find((rd) => rd.type === c.type)?.operatingSystems?.includes(os.platform() as OS));
|
|
54
|
-
|
|
55
|
-
console.info(chalk.cyan('Testing validate...'))
|
|
56
|
-
const validate = await plugin.validate({
|
|
57
|
-
configs: configs.map((c) => {
|
|
58
|
-
const { coreParameters, parameters } = splitUserConfig(c)
|
|
59
|
-
return { core: coreParameters, parameters };
|
|
60
|
-
})
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid)
|
|
64
|
-
if (invalidConfigs.length > 0) {
|
|
65
|
-
throw new Error(`The following configs did not validate:\n ${JSON.stringify(invalidConfigs, null, 2)}`)
|
|
66
|
-
}
|
|
50
|
+
await this.initializeAndValidate(plugin, configs);
|
|
67
51
|
|
|
68
52
|
console.info(chalk.cyan('Testing plan...'))
|
|
69
|
-
const plans =
|
|
70
|
-
for (const config of configs) {
|
|
71
|
-
const { coreParameters, parameters } = splitUserConfig(config);
|
|
72
|
-
|
|
73
|
-
plans.push(await plugin.plan({
|
|
74
|
-
core: coreParameters,
|
|
75
|
-
desired: parameters,
|
|
76
|
-
isStateful: false,
|
|
77
|
-
state: undefined,
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
53
|
+
const plans = await this.planConfigs(plugin, configs);
|
|
80
54
|
|
|
81
55
|
if (options?.validatePlan) {
|
|
82
56
|
await options.validatePlan(plans);
|
|
83
57
|
}
|
|
84
58
|
|
|
85
59
|
console.info(chalk.cyan('Testing apply...'))
|
|
86
|
-
|
|
87
|
-
await plugin.apply({
|
|
88
|
-
planId: plan.planId
|
|
89
|
-
});
|
|
90
|
-
}
|
|
60
|
+
await this.applyPlans(plugin, plans);
|
|
91
61
|
|
|
92
62
|
if (options?.validateApply) {
|
|
93
63
|
await options.validateApply(plans);
|
|
@@ -97,63 +67,11 @@ export class PluginTester {
|
|
|
97
67
|
}
|
|
98
68
|
|
|
99
69
|
if (!options?.skipImport) {
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
await importPlugin.initialize();
|
|
103
|
-
console.info(chalk.cyan('Testing import...'))
|
|
104
|
-
|
|
105
|
-
const importResults = [];
|
|
106
|
-
for (const config of configs) {
|
|
107
|
-
const { coreParameters, parameters } = splitUserConfig(config);
|
|
108
|
-
|
|
109
|
-
const importResult = await importPlugin.import({ core: coreParameters, parameters })
|
|
110
|
-
importResults.push(importResult);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (options?.validateImport) {
|
|
114
|
-
await options.validateImport(importResults.map((r) => r.result[0]));
|
|
115
|
-
}
|
|
116
|
-
} finally {
|
|
117
|
-
importPlugin.kill();
|
|
118
|
-
}
|
|
70
|
+
await this.runImportPhase(pluginPath, configs, options?.validateImport);
|
|
119
71
|
}
|
|
120
72
|
|
|
121
73
|
if (options?.testModify) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
try {
|
|
125
|
-
await modifyPlugin.initialize();
|
|
126
|
-
console.info(chalk.cyan('Testing modify...'))
|
|
127
|
-
|
|
128
|
-
const modifyPlans = [];
|
|
129
|
-
for (const config of options.testModify.modifiedConfigs) {
|
|
130
|
-
const { coreParameters, parameters } = splitUserConfig(config);
|
|
131
|
-
|
|
132
|
-
modifyPlans.push(await modifyPlugin.plan({
|
|
133
|
-
core: coreParameters,
|
|
134
|
-
desired: parameters,
|
|
135
|
-
isStateful: false,
|
|
136
|
-
state: undefined,
|
|
137
|
-
}));
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (modifyPlans.some((p) => p.operation !== ResourceOperation.MODIFY)) {
|
|
141
|
-
throw new Error(`Error while testing modify. Non-modify results were found in the plan:
|
|
142
|
-
${JSON.stringify(modifyPlans, null, 2)}`)
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
for (const plan of modifyPlans) {
|
|
146
|
-
await modifyPlugin.apply({
|
|
147
|
-
planId: plan.planId
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
if (options.testModify.validateModify) {
|
|
152
|
-
await options.testModify.validateModify(modifyPlans);
|
|
153
|
-
}
|
|
154
|
-
} finally {
|
|
155
|
-
modifyPlugin.kill();
|
|
156
|
-
}
|
|
74
|
+
await this.runModifyPhase(pluginPath, options.testModify);
|
|
157
75
|
}
|
|
158
76
|
|
|
159
77
|
if (!skipUninstall) {
|
|
@@ -172,50 +90,13 @@ ${JSON.stringify(modifyPlans, null, 2)}`)
|
|
|
172
90
|
const plugin = new PluginProcess(pluginPath);
|
|
173
91
|
|
|
174
92
|
try {
|
|
175
|
-
|
|
176
|
-
const initializeResult = await plugin.initialize();
|
|
177
|
-
|
|
178
|
-
const unsupportedConfigs = configs.filter((c) =>
|
|
179
|
-
!initializeResult.resourceDefinitions.some((rd) => rd.type === c.type)
|
|
180
|
-
)
|
|
181
|
-
if (unsupportedConfigs.length > 0) {
|
|
182
|
-
throw new Error(`The plugin does not support the following configs supplied:\n ${JSON.stringify(unsupportedConfigs, null, 2)}\n Initialize result: ${JSON.stringify(initializeResult)}`)
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// configs = configs.filter((c) => initializeResult.resourceDefinitions.find((rd) => rd.type === c.type)?.operatingSystems?.includes(os.platform() as OS));
|
|
186
|
-
|
|
187
|
-
console.info(chalk.cyan('Testing validate...'))
|
|
188
|
-
const validate = await plugin.validate({
|
|
189
|
-
configs: configs.map((c) => {
|
|
190
|
-
const { coreParameters, parameters } = splitUserConfig(c)
|
|
191
|
-
return { core: coreParameters, parameters };
|
|
192
|
-
})
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid)
|
|
196
|
-
if (invalidConfigs.length > 0) {
|
|
197
|
-
throw new Error(`The following configs did not validate:\n ${JSON.stringify(invalidConfigs, null, 2)}`)
|
|
198
|
-
}
|
|
93
|
+
await this.initializeAndValidate(plugin, configs);
|
|
199
94
|
|
|
200
95
|
console.info(chalk.cyan('Testing plan...'))
|
|
201
|
-
const plans =
|
|
202
|
-
for (const config of configs) {
|
|
203
|
-
const { coreParameters, parameters } = splitUserConfig(config);
|
|
204
|
-
|
|
205
|
-
plans.push(await plugin.plan({
|
|
206
|
-
core: coreParameters,
|
|
207
|
-
desired: parameters,
|
|
208
|
-
isStateful: false,
|
|
209
|
-
state: undefined,
|
|
210
|
-
}));
|
|
211
|
-
}
|
|
96
|
+
const plans = await this.planConfigs(plugin, configs);
|
|
212
97
|
|
|
213
98
|
console.info(chalk.cyan('Testing apply...'))
|
|
214
|
-
|
|
215
|
-
await plugin.apply({
|
|
216
|
-
planId: plan.planId
|
|
217
|
-
});
|
|
218
|
-
}
|
|
99
|
+
await this.applyPlans(plugin, plans);
|
|
219
100
|
} finally {
|
|
220
101
|
plugin.kill();
|
|
221
102
|
}
|
|
@@ -260,6 +141,166 @@ ${JSON.stringify(modifyPlans, null, 2)}`)
|
|
|
260
141
|
}
|
|
261
142
|
}
|
|
262
143
|
|
|
144
|
+
private static async ensurePrerequisites(pluginPath: string, prerequisites: ResourceConfig[]): Promise<void> {
|
|
145
|
+
prerequisites = prerequisites.filter((c) => !c.os || c.os.includes(getPlatformOs()));
|
|
146
|
+
if (prerequisites.length === 0) return;
|
|
147
|
+
|
|
148
|
+
const ids = prerequisites.map((c) => `${c.type}${c.name ? `.${c.name}` : ''}`).join(', ');
|
|
149
|
+
console.info(chalk.cyan(`Checking prerequisites [ ${ids} ]...`));
|
|
150
|
+
|
|
151
|
+
const plugin = new PluginProcess(pluginPath);
|
|
152
|
+
try {
|
|
153
|
+
const initializeResult = await plugin.initialize();
|
|
154
|
+
|
|
155
|
+
const unsupportedConfigs = prerequisites.filter((c) =>
|
|
156
|
+
!initializeResult.resourceDefinitions.some((rd) => rd.type === c.type)
|
|
157
|
+
)
|
|
158
|
+
if (unsupportedConfigs.length > 0) {
|
|
159
|
+
throw new Error(`The plugin does not support the following prerequisite configs:\n ${JSON.stringify(unsupportedConfigs, null, 2)}`)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const validate = await plugin.validate({
|
|
163
|
+
configs: prerequisites.map((c) => {
|
|
164
|
+
const { coreParameters, parameters } = splitUserConfig(c)
|
|
165
|
+
return { core: coreParameters, parameters };
|
|
166
|
+
})
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid)
|
|
170
|
+
if (invalidConfigs.length > 0) {
|
|
171
|
+
console.error(chalk.red(`Prerequisites validation failed:\n ${JSON.stringify(invalidConfigs, null, 2)}`));
|
|
172
|
+
throw new Error(`The following prerequisite configs did not validate:\n ${JSON.stringify(invalidConfigs, null, 2)}`)
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
for (const config of prerequisites) {
|
|
176
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
177
|
+
const plan = await plugin.plan({
|
|
178
|
+
core: coreParameters,
|
|
179
|
+
desired: parameters,
|
|
180
|
+
isStateful: false,
|
|
181
|
+
state: undefined,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
const label = `${config.type}${config.name ? `.${config.name}` : ''}`;
|
|
185
|
+
if (plan.operation === ResourceOperation.NOOP) {
|
|
186
|
+
console.info(chalk.cyan(`Prerequisite already satisfied: ${label}`));
|
|
187
|
+
} else {
|
|
188
|
+
await plugin.apply({ planId: plan.planId });
|
|
189
|
+
console.info(chalk.cyan(`Prerequisite installed: ${label}`));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
} finally {
|
|
193
|
+
plugin.kill();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
private static async initializeAndValidate(plugin: PluginProcess, configs: ResourceConfig[]): Promise<void> {
|
|
198
|
+
console.info(chalk.cyan('Testing initialization...'))
|
|
199
|
+
const initializeResult = await plugin.initialize();
|
|
200
|
+
|
|
201
|
+
const unsupportedConfigs = configs.filter((c) =>
|
|
202
|
+
!initializeResult.resourceDefinitions.some((rd) => rd.type === c.type)
|
|
203
|
+
)
|
|
204
|
+
if (unsupportedConfigs.length > 0) {
|
|
205
|
+
throw new Error(`The plugin does not support the following configs supplied:\n ${JSON.stringify(unsupportedConfigs, null, 2)}\n Initialize result: ${JSON.stringify(initializeResult)}`)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
console.info(chalk.cyan('Testing validate...'))
|
|
209
|
+
const validate = await plugin.validate({
|
|
210
|
+
configs: configs.map((c) => {
|
|
211
|
+
const { coreParameters, parameters } = splitUserConfig(c)
|
|
212
|
+
return { core: coreParameters, parameters };
|
|
213
|
+
})
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid)
|
|
217
|
+
if (invalidConfigs.length > 0) {
|
|
218
|
+
throw new Error(`The following configs did not validate:\n ${JSON.stringify(invalidConfigs, null, 2)}`)
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
private static async planConfigs(plugin: PluginProcess, configs: ResourceConfig[]): Promise<PlanResponseData[]> {
|
|
223
|
+
const plans = [];
|
|
224
|
+
for (const config of configs) {
|
|
225
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
226
|
+
plans.push(await plugin.plan({
|
|
227
|
+
core: coreParameters,
|
|
228
|
+
desired: parameters,
|
|
229
|
+
isStateful: false,
|
|
230
|
+
state: undefined,
|
|
231
|
+
}));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
return plans;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
private static async applyPlans(plugin: PluginProcess, plans: PlanResponseData[]): Promise<void> {
|
|
238
|
+
for (const plan of plans) {
|
|
239
|
+
await plugin.apply({ planId: plan.planId });
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
private static async runImportPhase(
|
|
244
|
+
pluginPath: string,
|
|
245
|
+
configs: ResourceConfig[],
|
|
246
|
+
validateImport?: (importResults: (ImportResponseData['result'][0])[]) => Promise<void> | void,
|
|
247
|
+
): Promise<void> {
|
|
248
|
+
const importPlugin = new PluginProcess(pluginPath);
|
|
249
|
+
try {
|
|
250
|
+
await importPlugin.initialize();
|
|
251
|
+
console.info(chalk.cyan('Testing import...'))
|
|
252
|
+
|
|
253
|
+
const importResults = [];
|
|
254
|
+
for (const config of configs) {
|
|
255
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
256
|
+
importResults.push(await importPlugin.import({ core: coreParameters, parameters }));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (validateImport) {
|
|
260
|
+
await validateImport(importResults.map((r) => r.result[0]));
|
|
261
|
+
}
|
|
262
|
+
} finally {
|
|
263
|
+
importPlugin.kill();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
private static async runModifyPhase(
|
|
268
|
+
pluginPath: string,
|
|
269
|
+
testModify: { modifiedConfigs: ResourceConfig[], validateModify?: (plans: PlanResponseData[]) => Promise<void> | void },
|
|
270
|
+
): Promise<void> {
|
|
271
|
+
const modifyPlugin = new PluginProcess(pluginPath);
|
|
272
|
+
|
|
273
|
+
try {
|
|
274
|
+
await modifyPlugin.initialize();
|
|
275
|
+
console.info(chalk.cyan('Testing modify...'))
|
|
276
|
+
|
|
277
|
+
const modifyPlans = [];
|
|
278
|
+
for (const config of testModify.modifiedConfigs) {
|
|
279
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
280
|
+
|
|
281
|
+
modifyPlans.push(await modifyPlugin.plan({
|
|
282
|
+
core: coreParameters,
|
|
283
|
+
desired: parameters,
|
|
284
|
+
isStateful: false,
|
|
285
|
+
state: undefined,
|
|
286
|
+
}));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
if (modifyPlans.some((p) => p.operation !== ResourceOperation.MODIFY)) {
|
|
290
|
+
throw new Error(`Error while testing modify. Non-modify results were found in the plan:
|
|
291
|
+
${JSON.stringify(modifyPlans, null, 2)}`)
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
await this.applyPlans(modifyPlugin, modifyPlans);
|
|
295
|
+
|
|
296
|
+
if (testModify.validateModify) {
|
|
297
|
+
await testModify.validateModify(modifyPlans);
|
|
298
|
+
}
|
|
299
|
+
} finally {
|
|
300
|
+
modifyPlugin.kill();
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
263
304
|
private static addNamesToConfigs(configs: ResourceConfig[]): ResourceConfig[] {
|
|
264
305
|
const configsWithNames = new Array<ResourceConfig>();
|
|
265
306
|
|
package/src/spawn.ts
CHANGED
|
@@ -79,15 +79,17 @@ export function spawnSafe(cmd: string, options?: SpawnOptions): Promise<SpawnRes
|
|
|
79
79
|
process.stdin.off('data', stdinListener);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
const raw = stripAnsi(output.join('')).replace(/\r\n/g, '\n').replace(/\r/g, '\n').trim();
|
|
83
|
+
|
|
82
84
|
if (options?.throws && result.exitCode !== 0) {
|
|
83
|
-
reject(new Error(
|
|
85
|
+
reject(new Error(raw));
|
|
84
86
|
return;
|
|
85
87
|
}
|
|
86
88
|
|
|
87
89
|
resolve({
|
|
88
90
|
status: result.exitCode === 0 ? SpawnStatus.SUCCESS : SpawnStatus.ERROR,
|
|
89
91
|
exitCode: result.exitCode,
|
|
90
|
-
data:
|
|
92
|
+
data: raw,
|
|
91
93
|
})
|
|
92
94
|
})
|
|
93
95
|
})
|