@codifycli/plugin-test 1.1.0-beta2 → 1.1.0-beta4
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-process.d.ts +2 -1
- package/dist/plugin-process.js +7 -0
- package/dist/plugin-process.js.map +1 -1
- package/dist/plugin-tester.d.ts +22 -12
- package/dist/plugin-tester.js +202 -114
- package/dist/plugin-tester.js.map +1 -1
- package/package.json +3 -3
- package/src/plugin-process.ts +10 -0
- package/src/plugin-tester.ts +266 -150
- package/test/test-plugin.ts +38 -5
package/dist/plugin-process.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
-
import { ApplyRequestData, ImportRequestData, ImportResponseData, InitializeResponseData, PlanRequestData, PlanResponseData, ValidateRequestData, ValidateResponseData } from '@codifycli/schemas';
|
|
2
|
+
import { ApplyRequestData, GetResourceInfoRequestData, GetResourceInfoResponseData, ImportRequestData, ImportResponseData, InitializeResponseData, PlanRequestData, PlanResponseData, ValidateRequestData, ValidateResponseData } from '@codifycli/schemas';
|
|
3
3
|
import { ChildProcess } from 'node:child_process';
|
|
4
4
|
export declare class PluginProcess {
|
|
5
5
|
childProcess: ChildProcess;
|
|
@@ -14,6 +14,7 @@ export declare class PluginProcess {
|
|
|
14
14
|
plan(data: PlanRequestData): Promise<PlanResponseData>;
|
|
15
15
|
apply(data: ApplyRequestData): Promise<void>;
|
|
16
16
|
import(data: ImportRequestData): Promise<ImportResponseData>;
|
|
17
|
+
getResourceInfo(data: GetResourceInfoRequestData): Promise<GetResourceInfoResponseData>;
|
|
17
18
|
kill(): void;
|
|
18
19
|
private handleIncomingRequests;
|
|
19
20
|
}
|
package/dist/plugin-process.js
CHANGED
|
@@ -68,6 +68,13 @@ export class PluginProcess {
|
|
|
68
68
|
requestId: nanoid(6),
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
|
+
async getResourceInfo(data) {
|
|
72
|
+
return TestUtils.sendMessageAndAwaitResponse(this.childProcess, {
|
|
73
|
+
cmd: 'getResourceInfo',
|
|
74
|
+
data,
|
|
75
|
+
requestId: nanoid(6),
|
|
76
|
+
});
|
|
77
|
+
}
|
|
71
78
|
kill() {
|
|
72
79
|
this.childProcess.kill();
|
|
73
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-process.js","sourceRoot":"","sources":["../src/plugin-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,
|
|
1
|
+
{"version":3,"file":"plugin-process.js","sourceRoot":"","sources":["../src/plugin-process.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,wBAAwB,EAMxB,gBAAgB,EAEhB,UAAU,EAKX,MAAM,oBAAoB,CAAC;AAC5B,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAgB,IAAI,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,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;IACxB,YAAY,CAAc;IAE1B;;;;OAIG;IACH,YAAY,UAAkB;QAC5B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YACjC,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC7E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BACpB,GAAG,EAAE,UAAU,CAAC,0BAA0B,GAAG,WAAW;oBACxD,IAAI,EAAE,OAAO;oBACb,SAAS;iBACV,CAAC,CAAA;YACJ,CAAC;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CAEF"}
|
package/dist/plugin-tester.d.ts
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
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 validateExampleAndDefaultConfigs;
|
|
24
|
+
private static validateSingleExampleConfig;
|
|
25
|
+
private static planConfigs;
|
|
26
|
+
private static applyPlans;
|
|
27
|
+
private static runImportPhase;
|
|
28
|
+
private static runModifyPhase;
|
|
19
29
|
private static addNamesToConfigs;
|
|
20
30
|
}
|
package/dist/plugin-tester.js
CHANGED
|
@@ -10,47 +10,21 @@ 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
|
-
|
|
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);
|
|
20
|
+
await this.validateExampleAndDefaultConfigs(plugin, configs);
|
|
34
21
|
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
|
-
}
|
|
22
|
+
const plans = await this.planConfigs(plugin, configs);
|
|
45
23
|
if (options?.validatePlan) {
|
|
46
24
|
await options.validatePlan(plans);
|
|
47
25
|
}
|
|
48
26
|
console.info(chalk.cyan('Testing apply...'));
|
|
49
|
-
|
|
50
|
-
await plugin.apply({
|
|
51
|
-
planId: plan.planId
|
|
52
|
-
});
|
|
53
|
-
}
|
|
27
|
+
await this.applyPlans(plugin, plans);
|
|
54
28
|
if (options?.validateApply) {
|
|
55
29
|
await options.validateApply(plans);
|
|
56
30
|
}
|
|
@@ -59,55 +33,10 @@ export class PluginTester {
|
|
|
59
33
|
plugin.kill();
|
|
60
34
|
}
|
|
61
35
|
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
|
-
}
|
|
36
|
+
await this.runImportPhase(pluginPath, configs, options?.validateImport);
|
|
79
37
|
}
|
|
80
38
|
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
|
-
}
|
|
39
|
+
await this.runModifyPhase(pluginPath, options.testModify);
|
|
111
40
|
}
|
|
112
41
|
if (!skipUninstall) {
|
|
113
42
|
// We need to add unique names to multiple configs with the same type or else it breaks the unionBy below.
|
|
@@ -121,41 +50,11 @@ ${JSON.stringify(modifyPlans, null, 2)}`);
|
|
|
121
50
|
static async install(pluginPath, configs) {
|
|
122
51
|
const plugin = new PluginProcess(pluginPath);
|
|
123
52
|
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
|
-
}
|
|
53
|
+
await this.initializeAndValidate(plugin, configs);
|
|
142
54
|
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
|
-
}
|
|
55
|
+
const plans = await this.planConfigs(plugin, configs);
|
|
153
56
|
console.info(chalk.cyan('Testing apply...'));
|
|
154
|
-
|
|
155
|
-
await plugin.apply({
|
|
156
|
-
planId: plan.planId
|
|
157
|
-
});
|
|
158
|
-
}
|
|
57
|
+
await this.applyPlans(plugin, plans);
|
|
159
58
|
}
|
|
160
59
|
finally {
|
|
161
60
|
plugin.kill();
|
|
@@ -192,6 +91,195 @@ ${JSON.stringify(modifyPlans, null, 2)}`);
|
|
|
192
91
|
destroyPlugin.kill();
|
|
193
92
|
}
|
|
194
93
|
}
|
|
94
|
+
static async ensurePrerequisites(pluginPath, prerequisites) {
|
|
95
|
+
prerequisites = prerequisites.filter((c) => !c.os || c.os.includes(getPlatformOs()));
|
|
96
|
+
if (prerequisites.length === 0)
|
|
97
|
+
return;
|
|
98
|
+
const ids = prerequisites.map((c) => `${c.type}${c.name ? `.${c.name}` : ''}`).join(', ');
|
|
99
|
+
console.info(chalk.cyan(`Checking prerequisites [ ${ids} ]...`));
|
|
100
|
+
const plugin = new PluginProcess(pluginPath);
|
|
101
|
+
try {
|
|
102
|
+
const initializeResult = await plugin.initialize();
|
|
103
|
+
const unsupportedConfigs = prerequisites.filter((c) => !initializeResult.resourceDefinitions.some((rd) => rd.type === c.type));
|
|
104
|
+
if (unsupportedConfigs.length > 0) {
|
|
105
|
+
throw new Error(`The plugin does not support the following prerequisite configs:\n ${JSON.stringify(unsupportedConfigs, null, 2)}`);
|
|
106
|
+
}
|
|
107
|
+
const validate = await plugin.validate({
|
|
108
|
+
configs: prerequisites.map((c) => {
|
|
109
|
+
const { coreParameters, parameters } = splitUserConfig(c);
|
|
110
|
+
return { core: coreParameters, parameters };
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid);
|
|
114
|
+
if (invalidConfigs.length > 0) {
|
|
115
|
+
console.error(chalk.red(`Prerequisites validation failed:\n ${JSON.stringify(invalidConfigs, null, 2)}`));
|
|
116
|
+
throw new Error(`The following prerequisite configs did not validate:\n ${JSON.stringify(invalidConfigs, null, 2)}`);
|
|
117
|
+
}
|
|
118
|
+
for (const config of prerequisites) {
|
|
119
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
120
|
+
const plan = await plugin.plan({
|
|
121
|
+
core: coreParameters,
|
|
122
|
+
desired: parameters,
|
|
123
|
+
isStateful: false,
|
|
124
|
+
state: undefined,
|
|
125
|
+
});
|
|
126
|
+
const label = `${config.type}${config.name ? `.${config.name}` : ''}`;
|
|
127
|
+
if (plan.operation === ResourceOperation.NOOP) {
|
|
128
|
+
console.info(chalk.cyan(`Prerequisite already satisfied: ${label}`));
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
await plugin.apply({ planId: plan.planId });
|
|
132
|
+
console.info(chalk.cyan(`Prerequisite installed: ${label}`));
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
finally {
|
|
137
|
+
plugin.kill();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
static async initializeAndValidate(plugin, configs) {
|
|
141
|
+
console.info(chalk.cyan('Testing initialization...'));
|
|
142
|
+
const initializeResult = await plugin.initialize();
|
|
143
|
+
const unsupportedConfigs = configs.filter((c) => !initializeResult.resourceDefinitions.some((rd) => rd.type === c.type));
|
|
144
|
+
if (unsupportedConfigs.length > 0) {
|
|
145
|
+
throw new Error(`The plugin does not support the following configs supplied:\n ${JSON.stringify(unsupportedConfigs, null, 2)}\n Initialize result: ${JSON.stringify(initializeResult)}`);
|
|
146
|
+
}
|
|
147
|
+
console.info(chalk.cyan('Testing validate...'));
|
|
148
|
+
const validate = await plugin.validate({
|
|
149
|
+
configs: configs.map((c) => {
|
|
150
|
+
const { coreParameters, parameters } = splitUserConfig(c);
|
|
151
|
+
return { core: coreParameters, parameters };
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid);
|
|
155
|
+
if (invalidConfigs.length > 0) {
|
|
156
|
+
const invalidWithConfigs = invalidConfigs.map((v) => ({
|
|
157
|
+
config: configs.find((c) => c.type === v.resourceType && (!v.resourceName || c.name === v.resourceName)),
|
|
158
|
+
validation: v,
|
|
159
|
+
}));
|
|
160
|
+
throw new Error(`The following configs did not validate:\n ${JSON.stringify(invalidWithConfigs, null, 2)}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
static async validateExampleAndDefaultConfigs(plugin, configs) {
|
|
164
|
+
console.info(chalk.cyan('Validating examples and default config...'));
|
|
165
|
+
const uniqueTypes = [...new Set(configs.map((c) => c.type))];
|
|
166
|
+
const errors = [];
|
|
167
|
+
for (const type of uniqueTypes) {
|
|
168
|
+
const { defaultConfig, exampleConfigs } = await plugin.getResourceInfo({ type });
|
|
169
|
+
// Validate exampleConfigs — these should be fully valid configs
|
|
170
|
+
const exampleEntries = [];
|
|
171
|
+
if (exampleConfigs?.example1?.configs)
|
|
172
|
+
exampleEntries.push(['exampleConfigs.example1', exampleConfigs.example1.configs]);
|
|
173
|
+
if (exampleConfigs?.example2?.configs)
|
|
174
|
+
exampleEntries.push(['exampleConfigs.example2', exampleConfigs.example2.configs]);
|
|
175
|
+
for (const [label, exampleConfigList] of exampleEntries) {
|
|
176
|
+
for (const [idx, exampleConfig] of exampleConfigList.entries()) {
|
|
177
|
+
const configLabel = `resource '${type}' ${label}[${idx}]`;
|
|
178
|
+
await this.validateSingleExampleConfig(plugin, configLabel, exampleConfig, errors);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// Validate defaultConfig — partial config, so only warn on failure
|
|
182
|
+
if (defaultConfig) {
|
|
183
|
+
try {
|
|
184
|
+
const validate = await plugin.validate({
|
|
185
|
+
configs: [{ core: { type }, parameters: defaultConfig }]
|
|
186
|
+
});
|
|
187
|
+
const invalid = validate.resourceValidations.filter((v) => !v.isValid);
|
|
188
|
+
if (invalid.length > 0) {
|
|
189
|
+
console.warn(chalk.yellow(`Resource '${type}' defaultConfig failed validation (this may be expected for partial configs):\n${JSON.stringify(invalid, null, 2)}`));
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
console.warn(chalk.yellow(`Resource '${type}' defaultConfig could not be validated: ${error}`));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (errors.length > 0) {
|
|
198
|
+
const message = errors.length === 1
|
|
199
|
+
? errors[0]
|
|
200
|
+
: `Multiple example config validation failures:\n\n${errors.map((e, i) => `[${i + 1}] ${e}`).join('\n\n')}`;
|
|
201
|
+
throw new Error(message);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
static async validateSingleExampleConfig(plugin, label, exampleConfig, errors) {
|
|
205
|
+
try {
|
|
206
|
+
const { coreParameters, parameters } = splitUserConfig(exampleConfig);
|
|
207
|
+
const validate = await plugin.validate({
|
|
208
|
+
configs: [{ core: coreParameters, parameters }]
|
|
209
|
+
});
|
|
210
|
+
const invalid = validate.resourceValidations.filter((v) => !v.isValid);
|
|
211
|
+
if (invalid.length > 0) {
|
|
212
|
+
errors.push(`${label} failed validation:\nConfig: ${JSON.stringify(exampleConfig, null, 2)}\nErrors: ${JSON.stringify(invalid, null, 2)}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
errors.push(`${label} could not be validated:\nConfig: ${JSON.stringify(exampleConfig, null, 2)}\nError: ${error}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
static async planConfigs(plugin, configs) {
|
|
220
|
+
const plans = [];
|
|
221
|
+
for (const config of configs) {
|
|
222
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
223
|
+
plans.push(await plugin.plan({
|
|
224
|
+
core: coreParameters,
|
|
225
|
+
desired: parameters,
|
|
226
|
+
isStateful: false,
|
|
227
|
+
state: undefined,
|
|
228
|
+
}));
|
|
229
|
+
}
|
|
230
|
+
return plans;
|
|
231
|
+
}
|
|
232
|
+
static async applyPlans(plugin, plans) {
|
|
233
|
+
for (const plan of plans) {
|
|
234
|
+
await plugin.apply({ planId: plan.planId });
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
static async runImportPhase(pluginPath, configs, validateImport) {
|
|
238
|
+
const importPlugin = new PluginProcess(pluginPath);
|
|
239
|
+
try {
|
|
240
|
+
await importPlugin.initialize();
|
|
241
|
+
console.info(chalk.cyan('Testing import...'));
|
|
242
|
+
const importResults = [];
|
|
243
|
+
for (const config of configs) {
|
|
244
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
245
|
+
importResults.push(await importPlugin.import({ core: coreParameters, parameters }));
|
|
246
|
+
}
|
|
247
|
+
if (validateImport) {
|
|
248
|
+
await validateImport(importResults.map((r) => r.result[0]));
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
finally {
|
|
252
|
+
importPlugin.kill();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
static async runModifyPhase(pluginPath, testModify) {
|
|
256
|
+
const modifyPlugin = new PluginProcess(pluginPath);
|
|
257
|
+
try {
|
|
258
|
+
await modifyPlugin.initialize();
|
|
259
|
+
console.info(chalk.cyan('Testing modify...'));
|
|
260
|
+
const modifyPlans = [];
|
|
261
|
+
for (const config of testModify.modifiedConfigs) {
|
|
262
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
263
|
+
modifyPlans.push(await modifyPlugin.plan({
|
|
264
|
+
core: coreParameters,
|
|
265
|
+
desired: parameters,
|
|
266
|
+
isStateful: false,
|
|
267
|
+
state: undefined,
|
|
268
|
+
}));
|
|
269
|
+
}
|
|
270
|
+
if (modifyPlans.some((p) => p.operation !== ResourceOperation.MODIFY)) {
|
|
271
|
+
throw new Error(`Error while testing modify. Non-modify results were found in the plan:
|
|
272
|
+
${JSON.stringify(modifyPlans, null, 2)}`);
|
|
273
|
+
}
|
|
274
|
+
await this.applyPlans(modifyPlugin, modifyPlans);
|
|
275
|
+
if (testModify.validateModify) {
|
|
276
|
+
await testModify.validateModify(modifyPlans);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
finally {
|
|
280
|
+
modifyPlugin.kill();
|
|
281
|
+
}
|
|
282
|
+
}
|
|
195
283
|
static addNamesToConfigs(configs) {
|
|
196
284
|
const configsWithNames = new Array();
|
|
197
285
|
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,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,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;aACpD,IAAI,CAAC,IAAI,CAAC,CAAA;QACb,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,2BAA2B,GAAG,OAAO,CAAC,CAAC,CAAC;QAGhE,MAAM,EACJ,aAAa,GAAG,KAAK,GAC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T,YAAY,CAAC,IAAI,EAAE,CAAC;QACtB,CAAC;IACH,CAAC;IAEO,MAAM,CAAC,iBAAiB,CAAC,OAAyB;QACxD,MAAM,gBAAgB,GAAG,IAAI,KAAK,EAAkB,CAAC;QAErD,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QACpD,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YAC3B,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YAC/D,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/B,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;oBACjC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,QAAQ,EAAE,CAAA;gBACnC,CAAC,CAAC,CAAC;YACL,CAAC;YAED,gBAAgB,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,CAAC;QAC5C,CAAC;QAED,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF"}
|
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-beta4",
|
|
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",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"prepublishOnly": "tsc"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@codifycli/schemas": "1.
|
|
30
|
+
"@codifycli/schemas": "1.1.0-beta3",
|
|
31
31
|
"ajv": "^8.18.0",
|
|
32
32
|
"ajv-formats": "^3.0.1",
|
|
33
33
|
"lodash.matches": "^4.6.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"strip-ansi": "^7.1.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@codifycli/plugin-core": "1.
|
|
42
|
+
"@codifycli/plugin-core": "1.1.0-beta10",
|
|
43
43
|
"@oclif/prettier-config": "^0.2.1",
|
|
44
44
|
"@types/debug": "^4.1.12",
|
|
45
45
|
"@types/node": "^22",
|
package/src/plugin-process.ts
CHANGED
|
@@ -2,6 +2,8 @@ import {
|
|
|
2
2
|
ApplyRequestData,
|
|
3
3
|
CommandRequestData,
|
|
4
4
|
CommandRequestDataSchema,
|
|
5
|
+
GetResourceInfoRequestData,
|
|
6
|
+
GetResourceInfoResponseData,
|
|
5
7
|
ImportRequestData,
|
|
6
8
|
ImportResponseData,
|
|
7
9
|
InitializeResponseData,
|
|
@@ -101,6 +103,14 @@ export class PluginProcess {
|
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
105
|
|
|
106
|
+
async getResourceInfo(data: GetResourceInfoRequestData): Promise<GetResourceInfoResponseData> {
|
|
107
|
+
return TestUtils.sendMessageAndAwaitResponse(this.childProcess, {
|
|
108
|
+
cmd: 'getResourceInfo',
|
|
109
|
+
data,
|
|
110
|
+
requestId: nanoid(6),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
104
114
|
kill() {
|
|
105
115
|
this.childProcess.kill();
|
|
106
116
|
}
|
package/src/plugin-tester.ts
CHANGED
|
@@ -10,84 +10,57 @@ 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
|
-
try {
|
|
43
|
-
console.info(chalk.cyan('Testing initialization...'))
|
|
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
49
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
50
|
+
try {
|
|
51
|
+
await this.initializeAndValidate(plugin, configs);
|
|
52
|
+
|
|
53
|
+
await this.validateExampleAndDefaultConfigs(plugin, configs);
|
|
67
54
|
|
|
68
55
|
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
|
-
}
|
|
56
|
+
const plans = await this.planConfigs(plugin, configs);
|
|
80
57
|
|
|
81
58
|
if (options?.validatePlan) {
|
|
82
59
|
await options.validatePlan(plans);
|
|
83
60
|
}
|
|
84
61
|
|
|
85
62
|
console.info(chalk.cyan('Testing apply...'))
|
|
86
|
-
|
|
87
|
-
await plugin.apply({
|
|
88
|
-
planId: plan.planId
|
|
89
|
-
});
|
|
90
|
-
}
|
|
63
|
+
await this.applyPlans(plugin, plans);
|
|
91
64
|
|
|
92
65
|
if (options?.validateApply) {
|
|
93
66
|
await options.validateApply(plans);
|
|
@@ -97,63 +70,11 @@ export class PluginTester {
|
|
|
97
70
|
}
|
|
98
71
|
|
|
99
72
|
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
|
-
}
|
|
73
|
+
await this.runImportPhase(pluginPath, configs, options?.validateImport);
|
|
119
74
|
}
|
|
120
75
|
|
|
121
76
|
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
|
-
}
|
|
77
|
+
await this.runModifyPhase(pluginPath, options.testModify);
|
|
157
78
|
}
|
|
158
79
|
|
|
159
80
|
if (!skipUninstall) {
|
|
@@ -172,50 +93,13 @@ ${JSON.stringify(modifyPlans, null, 2)}`)
|
|
|
172
93
|
const plugin = new PluginProcess(pluginPath);
|
|
173
94
|
|
|
174
95
|
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
|
-
}
|
|
96
|
+
await this.initializeAndValidate(plugin, configs);
|
|
199
97
|
|
|
200
98
|
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
|
-
}
|
|
99
|
+
const plans = await this.planConfigs(plugin, configs);
|
|
212
100
|
|
|
213
101
|
console.info(chalk.cyan('Testing apply...'))
|
|
214
|
-
|
|
215
|
-
await plugin.apply({
|
|
216
|
-
planId: plan.planId
|
|
217
|
-
});
|
|
218
|
-
}
|
|
102
|
+
await this.applyPlans(plugin, plans);
|
|
219
103
|
} finally {
|
|
220
104
|
plugin.kill();
|
|
221
105
|
}
|
|
@@ -260,6 +144,238 @@ ${JSON.stringify(modifyPlans, null, 2)}`)
|
|
|
260
144
|
}
|
|
261
145
|
}
|
|
262
146
|
|
|
147
|
+
private static async ensurePrerequisites(pluginPath: string, prerequisites: ResourceConfig[]): Promise<void> {
|
|
148
|
+
prerequisites = prerequisites.filter((c) => !c.os || c.os.includes(getPlatformOs()));
|
|
149
|
+
if (prerequisites.length === 0) return;
|
|
150
|
+
|
|
151
|
+
const ids = prerequisites.map((c) => `${c.type}${c.name ? `.${c.name}` : ''}`).join(', ');
|
|
152
|
+
console.info(chalk.cyan(`Checking prerequisites [ ${ids} ]...`));
|
|
153
|
+
|
|
154
|
+
const plugin = new PluginProcess(pluginPath);
|
|
155
|
+
try {
|
|
156
|
+
const initializeResult = await plugin.initialize();
|
|
157
|
+
|
|
158
|
+
const unsupportedConfigs = prerequisites.filter((c) =>
|
|
159
|
+
!initializeResult.resourceDefinitions.some((rd) => rd.type === c.type)
|
|
160
|
+
)
|
|
161
|
+
if (unsupportedConfigs.length > 0) {
|
|
162
|
+
throw new Error(`The plugin does not support the following prerequisite configs:\n ${JSON.stringify(unsupportedConfigs, null, 2)}`)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const validate = await plugin.validate({
|
|
166
|
+
configs: prerequisites.map((c) => {
|
|
167
|
+
const { coreParameters, parameters } = splitUserConfig(c)
|
|
168
|
+
return { core: coreParameters, parameters };
|
|
169
|
+
})
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid)
|
|
173
|
+
if (invalidConfigs.length > 0) {
|
|
174
|
+
console.error(chalk.red(`Prerequisites validation failed:\n ${JSON.stringify(invalidConfigs, null, 2)}`));
|
|
175
|
+
throw new Error(`The following prerequisite configs did not validate:\n ${JSON.stringify(invalidConfigs, null, 2)}`)
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
for (const config of prerequisites) {
|
|
179
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
180
|
+
const plan = await plugin.plan({
|
|
181
|
+
core: coreParameters,
|
|
182
|
+
desired: parameters,
|
|
183
|
+
isStateful: false,
|
|
184
|
+
state: undefined,
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
const label = `${config.type}${config.name ? `.${config.name}` : ''}`;
|
|
188
|
+
if (plan.operation === ResourceOperation.NOOP) {
|
|
189
|
+
console.info(chalk.cyan(`Prerequisite already satisfied: ${label}`));
|
|
190
|
+
} else {
|
|
191
|
+
await plugin.apply({ planId: plan.planId });
|
|
192
|
+
console.info(chalk.cyan(`Prerequisite installed: ${label}`));
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
} finally {
|
|
196
|
+
plugin.kill();
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
private static async initializeAndValidate(plugin: PluginProcess, configs: ResourceConfig[]): Promise<void> {
|
|
201
|
+
console.info(chalk.cyan('Testing initialization...'))
|
|
202
|
+
const initializeResult = await plugin.initialize();
|
|
203
|
+
|
|
204
|
+
const unsupportedConfigs = configs.filter((c) =>
|
|
205
|
+
!initializeResult.resourceDefinitions.some((rd) => rd.type === c.type)
|
|
206
|
+
)
|
|
207
|
+
if (unsupportedConfigs.length > 0) {
|
|
208
|
+
throw new Error(`The plugin does not support the following configs supplied:\n ${JSON.stringify(unsupportedConfigs, null, 2)}\n Initialize result: ${JSON.stringify(initializeResult)}`)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
console.info(chalk.cyan('Testing validate...'))
|
|
212
|
+
const validate = await plugin.validate({
|
|
213
|
+
configs: configs.map((c) => {
|
|
214
|
+
const { coreParameters, parameters } = splitUserConfig(c)
|
|
215
|
+
return { core: coreParameters, parameters };
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
const invalidConfigs = validate.resourceValidations.filter((v) => !v.isValid)
|
|
220
|
+
if (invalidConfigs.length > 0) {
|
|
221
|
+
const invalidWithConfigs = invalidConfigs.map((v) => ({
|
|
222
|
+
config: configs.find((c) => c.type === v.resourceType && (!v.resourceName || c.name === v.resourceName)),
|
|
223
|
+
validation: v,
|
|
224
|
+
}));
|
|
225
|
+
throw new Error(`The following configs did not validate:\n ${JSON.stringify(invalidWithConfigs, null, 2)}`)
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
private static async validateExampleAndDefaultConfigs(
|
|
230
|
+
plugin: PluginProcess,
|
|
231
|
+
configs: ResourceConfig[],
|
|
232
|
+
): Promise<void> {
|
|
233
|
+
console.info(chalk.cyan('Validating examples and default config...'))
|
|
234
|
+
const uniqueTypes = [...new Set(configs.map((c) => c.type))];
|
|
235
|
+
|
|
236
|
+
const errors: string[] = [];
|
|
237
|
+
|
|
238
|
+
for (const type of uniqueTypes) {
|
|
239
|
+
const { defaultConfig, exampleConfigs } = await plugin.getResourceInfo({ type });
|
|
240
|
+
|
|
241
|
+
// Validate exampleConfigs — these should be fully valid configs
|
|
242
|
+
const exampleEntries: Array<[string, Array<Record<string, unknown>>]> = [];
|
|
243
|
+
if (exampleConfigs?.example1?.configs) exampleEntries.push(['exampleConfigs.example1', exampleConfigs.example1.configs as Array<Record<string, unknown>>]);
|
|
244
|
+
if (exampleConfigs?.example2?.configs) exampleEntries.push(['exampleConfigs.example2', exampleConfigs.example2.configs as Array<Record<string, unknown>>]);
|
|
245
|
+
|
|
246
|
+
for (const [label, exampleConfigList] of exampleEntries) {
|
|
247
|
+
for (const [idx, exampleConfig] of exampleConfigList.entries()) {
|
|
248
|
+
const configLabel = `resource '${type}' ${label}[${idx}]`;
|
|
249
|
+
await this.validateSingleExampleConfig(plugin, configLabel, exampleConfig, errors);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Validate defaultConfig — partial config, so only warn on failure
|
|
254
|
+
if (defaultConfig) {
|
|
255
|
+
try {
|
|
256
|
+
const validate = await plugin.validate({
|
|
257
|
+
configs: [{ core: { type }, parameters: defaultConfig }]
|
|
258
|
+
});
|
|
259
|
+
const invalid = validate.resourceValidations.filter((v) => !v.isValid);
|
|
260
|
+
if (invalid.length > 0) {
|
|
261
|
+
console.warn(chalk.yellow(`Resource '${type}' defaultConfig failed validation (this may be expected for partial configs):\n${JSON.stringify(invalid, null, 2)}`));
|
|
262
|
+
}
|
|
263
|
+
} catch (error) {
|
|
264
|
+
console.warn(chalk.yellow(`Resource '${type}' defaultConfig could not be validated: ${error}`));
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
if (errors.length > 0) {
|
|
270
|
+
const message = errors.length === 1
|
|
271
|
+
? errors[0]
|
|
272
|
+
: `Multiple example config validation failures:\n\n${errors.map((e, i) => `[${i + 1}] ${e}`).join('\n\n')}`;
|
|
273
|
+
throw new Error(message);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
private static async validateSingleExampleConfig(
|
|
278
|
+
plugin: PluginProcess,
|
|
279
|
+
label: string,
|
|
280
|
+
exampleConfig: Record<string, unknown>,
|
|
281
|
+
errors: string[],
|
|
282
|
+
): Promise<void> {
|
|
283
|
+
try {
|
|
284
|
+
const { coreParameters, parameters } = splitUserConfig(exampleConfig as ResourceConfig);
|
|
285
|
+
const validate = await plugin.validate({
|
|
286
|
+
configs: [{ core: coreParameters, parameters }]
|
|
287
|
+
});
|
|
288
|
+
const invalid = validate.resourceValidations.filter((v) => !v.isValid);
|
|
289
|
+
if (invalid.length > 0) {
|
|
290
|
+
errors.push(`${label} failed validation:\nConfig: ${JSON.stringify(exampleConfig, null, 2)}\nErrors: ${JSON.stringify(invalid, null, 2)}`);
|
|
291
|
+
}
|
|
292
|
+
} catch (error) {
|
|
293
|
+
errors.push(`${label} could not be validated:\nConfig: ${JSON.stringify(exampleConfig, null, 2)}\nError: ${error}`);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
private static async planConfigs(plugin: PluginProcess, configs: ResourceConfig[]): Promise<PlanResponseData[]> {
|
|
298
|
+
const plans = [];
|
|
299
|
+
for (const config of configs) {
|
|
300
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
301
|
+
plans.push(await plugin.plan({
|
|
302
|
+
core: coreParameters,
|
|
303
|
+
desired: parameters,
|
|
304
|
+
isStateful: false,
|
|
305
|
+
state: undefined,
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
return plans;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
private static async applyPlans(plugin: PluginProcess, plans: PlanResponseData[]): Promise<void> {
|
|
313
|
+
for (const plan of plans) {
|
|
314
|
+
await plugin.apply({ planId: plan.planId });
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
private static async runImportPhase(
|
|
319
|
+
pluginPath: string,
|
|
320
|
+
configs: ResourceConfig[],
|
|
321
|
+
validateImport?: (importResults: (ImportResponseData['result'][0])[]) => Promise<void> | void,
|
|
322
|
+
): Promise<void> {
|
|
323
|
+
const importPlugin = new PluginProcess(pluginPath);
|
|
324
|
+
try {
|
|
325
|
+
await importPlugin.initialize();
|
|
326
|
+
console.info(chalk.cyan('Testing import...'))
|
|
327
|
+
|
|
328
|
+
const importResults = [];
|
|
329
|
+
for (const config of configs) {
|
|
330
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
331
|
+
importResults.push(await importPlugin.import({ core: coreParameters, parameters }));
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (validateImport) {
|
|
335
|
+
await validateImport(importResults.map((r) => r.result[0]));
|
|
336
|
+
}
|
|
337
|
+
} finally {
|
|
338
|
+
importPlugin.kill();
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
private static async runModifyPhase(
|
|
343
|
+
pluginPath: string,
|
|
344
|
+
testModify: { modifiedConfigs: ResourceConfig[], validateModify?: (plans: PlanResponseData[]) => Promise<void> | void },
|
|
345
|
+
): Promise<void> {
|
|
346
|
+
const modifyPlugin = new PluginProcess(pluginPath);
|
|
347
|
+
|
|
348
|
+
try {
|
|
349
|
+
await modifyPlugin.initialize();
|
|
350
|
+
console.info(chalk.cyan('Testing modify...'))
|
|
351
|
+
|
|
352
|
+
const modifyPlans = [];
|
|
353
|
+
for (const config of testModify.modifiedConfigs) {
|
|
354
|
+
const { coreParameters, parameters } = splitUserConfig(config);
|
|
355
|
+
|
|
356
|
+
modifyPlans.push(await modifyPlugin.plan({
|
|
357
|
+
core: coreParameters,
|
|
358
|
+
desired: parameters,
|
|
359
|
+
isStateful: false,
|
|
360
|
+
state: undefined,
|
|
361
|
+
}));
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
if (modifyPlans.some((p) => p.operation !== ResourceOperation.MODIFY)) {
|
|
365
|
+
throw new Error(`Error while testing modify. Non-modify results were found in the plan:
|
|
366
|
+
${JSON.stringify(modifyPlans, null, 2)}`)
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
await this.applyPlans(modifyPlugin, modifyPlans);
|
|
370
|
+
|
|
371
|
+
if (testModify.validateModify) {
|
|
372
|
+
await testModify.validateModify(modifyPlans);
|
|
373
|
+
}
|
|
374
|
+
} finally {
|
|
375
|
+
modifyPlugin.kill();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
263
379
|
private static addNamesToConfigs(configs: ResourceConfig[]): ResourceConfig[] {
|
|
264
380
|
const configsWithNames = new Array<ResourceConfig>();
|
|
265
381
|
|
package/test/test-plugin.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CreatePlan,
|
|
3
|
-
DestroyPlan,
|
|
3
|
+
DestroyPlan, ExampleConfig,
|
|
4
4
|
ModifyPlan,
|
|
5
5
|
ParameterChange,
|
|
6
6
|
Plugin,
|
|
@@ -22,6 +22,25 @@ export interface TestConfig2 extends StringIndexedObject {
|
|
|
22
22
|
propB: string[];
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
const defaultConfig: Partial<TestConfig> = {
|
|
26
|
+
propA: ''
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const example1: ExampleConfig = {
|
|
30
|
+
configs: [
|
|
31
|
+
{ type: 'test', propA: 'abc', propB: 6, propC: 'def' }
|
|
32
|
+
],
|
|
33
|
+
title: 'Example 1'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const example2: ExampleConfig = {
|
|
37
|
+
configs: [
|
|
38
|
+
{ type: 'test', propA: 'abc', propB: 6, propC: 'def', propD: 'asda' },
|
|
39
|
+
{ type: 'test2', propA: 'ghi', propB: ['a', 'b', 'c'] }
|
|
40
|
+
],
|
|
41
|
+
title: 'Example 2',
|
|
42
|
+
description: 'ABCDEF'
|
|
43
|
+
}
|
|
25
44
|
|
|
26
45
|
export class TestResource extends Resource<TestConfig> {
|
|
27
46
|
getSettings(): ResourceSettings<TestConfig> {
|
|
@@ -29,6 +48,11 @@ export class TestResource extends Resource<TestConfig> {
|
|
|
29
48
|
id: 'test',
|
|
30
49
|
operatingSystems: [OS.Linux, OS.Darwin],
|
|
31
50
|
allowMultiple: true,
|
|
51
|
+
defaultConfig,
|
|
52
|
+
exampleConfigs: {
|
|
53
|
+
example1,
|
|
54
|
+
example2
|
|
55
|
+
}
|
|
32
56
|
};
|
|
33
57
|
}
|
|
34
58
|
|
|
@@ -58,6 +82,10 @@ export class TestResource2 extends Resource<TestConfig2> {
|
|
|
58
82
|
operatingSystems: [OS.Linux, OS.Darwin],
|
|
59
83
|
parameterSettings: {
|
|
60
84
|
propB: { type: 'array' }
|
|
85
|
+
},
|
|
86
|
+
exampleConfigs: {
|
|
87
|
+
example1,
|
|
88
|
+
example2
|
|
61
89
|
}
|
|
62
90
|
};
|
|
63
91
|
}
|
|
@@ -82,6 +110,7 @@ export class TestResource2 extends Resource<TestConfig2> {
|
|
|
82
110
|
|
|
83
111
|
export class TestUninstallResource extends Resource<TestConfig> {
|
|
84
112
|
first = true;
|
|
113
|
+
|
|
85
114
|
getSettings(): ResourceSettings<TestConfig> {
|
|
86
115
|
return {
|
|
87
116
|
id: 'test-uninstall',
|
|
@@ -134,9 +163,11 @@ export class TestModifyResource extends Resource<TestConfig> {
|
|
|
134
163
|
return super.modify(pc, plan);
|
|
135
164
|
}
|
|
136
165
|
|
|
137
|
-
async create(plan: CreatePlan<TestConfig>): Promise<void> {
|
|
166
|
+
async create(plan: CreatePlan<TestConfig>): Promise<void> {
|
|
167
|
+
}
|
|
138
168
|
|
|
139
|
-
async destroy(plan: DestroyPlan<TestConfig>): Promise<void> {
|
|
169
|
+
async destroy(plan: DestroyPlan<TestConfig>): Promise<void> {
|
|
170
|
+
}
|
|
140
171
|
}
|
|
141
172
|
|
|
142
173
|
export class TestDestroyResource extends Resource<TestConfig> {
|
|
@@ -188,9 +219,11 @@ export class WindowsOnlyResource extends Resource<TestConfig> {
|
|
|
188
219
|
return super.modify(pc, plan);
|
|
189
220
|
}
|
|
190
221
|
|
|
191
|
-
async create(plan: CreatePlan<TestConfig>): Promise<void> {
|
|
222
|
+
async create(plan: CreatePlan<TestConfig>): Promise<void> {
|
|
223
|
+
}
|
|
192
224
|
|
|
193
|
-
async destroy(plan: DestroyPlan<TestConfig>): Promise<void> {
|
|
225
|
+
async destroy(plan: DestroyPlan<TestConfig>): Promise<void> {
|
|
226
|
+
}
|
|
194
227
|
}
|
|
195
228
|
|
|
196
229
|
export class TestDestroyResource2 extends TestDestroyResource {
|