Skip to content

Commit

Permalink
pluginHealthCheck, PMF_ROOT comment, flattenCommandTreeWithAliaises
Browse files Browse the repository at this point in the history
Signed-off-by: Amber Torrise <at895452@broadcom.net>
  • Loading branch information
Amber Torrise committed Nov 9, 2023
1 parent a624c1a commit b52c7d2
Show file tree
Hide file tree
Showing 38 changed files with 4 additions and 3,100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"commandModuleGlobs": [
"**/*.definition!(.d).*s"
],
"pluginHealthCheck": "./lib/HealthCheck.handler",
"rootCommandDescription": "CA Endevor SCM plug-in for listing Endevor environment information, working with elements and packages located in specified Endevor instance.",
"envVariablePrefix": "ENDEVOR",
"defaultHome": "C:\\Users\\ej608771/.endevor",
Expand Down Expand Up @@ -309,7 +308,6 @@
"commandModuleGlobs": [
"**/cli/*/*.definition!(.d).*s"
],
"pluginHealthCheck": "C:\\Users\\ej608771\\.zowe\\plugins\\installed\\node_modules\\@broadcom\\jclcheck-for-zowe-cli\\lib/healthCheck.handler",
"pluginSummary": "JCLCheck plugin",
"pluginAliases": [
"jck"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,88 +247,6 @@ describe("Validate plugin", () => {
expect(result.status).toEqual(1);
});

// TODO: remove this test in V3, when pluginHealthCheck is removed
it("missing pluginHealthCheck property", () => {
const testPlugin = "missing_pluginHealthCheck";
const fullPluginPath = join(testPluginDir, "error_plugins", testPlugin);

let cmd = `plugins install ${fullPluginPath}`;
let result = T.executeTestCLICommand(cliBin, this, cmd.split(" "));
expect(result.stdout).toContain(`Installed plugin name = '${testPlugin}'`);

cmd = `plugins validate ${testPlugin}`;
result = T.executeTestCLICommand(cliBin, this, cmd.split(" "));
result.stderr = removeNewline(result.stderr);
expect(result.stdout).toContain(testPlugin);
expect(result.stdout).toContain("This plugin was successfully validated. Enjoy the plugin.");
expect(result.stdout).not.toContain("Warning");
expect(result.stdout).not.toContain("The plugin's configuration does not contain an 'imperative.pluginHealthCheck' property.");
expect(result.stderr).not.toContain("Problems detected during plugin validation.");
expect(result.status).toEqual(0);
});

// TODO: remove this test in V3, when pluginHealthCheck is removed
it("missing pluginHealthCheck property - warning", () => {
const testPlugin = "missing_pluginHealthCheck";
const fullPluginPath = join(testPluginDir, "error_plugins", testPlugin);

let cmd = `plugins install ${fullPluginPath}`;
let result = T.executeTestCLICommand(cliBin, this, cmd.split(" "));
expect(result.stdout).toContain(`Installed plugin name = '${testPlugin}'`);

cmd = `plugins validate ${testPlugin} --fail-on-warning`;
result = T.executeTestCLICommand(cliBin, this, cmd.split(" "));
result.stderr = removeNewline(result.stderr);
expect(result.stdout).toContain(testPlugin);
expect(result.stdout).toContain("This plugin was successfully validated. Enjoy the plugin.");
expect(result.stdout).not.toContain("Warning");
expect(result.stdout).not.toContain("The plugin's configuration does not contain an 'imperative.pluginHealthCheck' property.");
expect(result.stderr).not.toContain("Problems detected during plugin validation.");
expect(result.status).toEqual(0);
});

// TODO: remove this test in V3, when pluginHealthCheck is removed
it("missing pluginHealthCheck handler", () => {
const testPlugin = "missing_healthcheck_handler";
const fullPluginPath = join(testPluginDir, "error_plugins", testPlugin);

let cmd = `plugins install ${fullPluginPath}`;
let result = T.executeTestCLICommand(cliBin, this, cmd.split(" "));
expect(result.stdout).toContain(`Installed plugin name = '${testPlugin}'`);

cmd = `plugins validate ${testPlugin} --no-fail-on-error`;
result = T.executeTestCLICommand(cliBin, this, cmd.split(" "));
result.stderr = removeNewline(result.stderr);
expect(result.stdout).toContain(testPlugin);
expect(result.stdout).toContain("This plugin was successfully validated. Enjoy the plugin.");
expect(result.stdout).not.toContain("Error");
expect(result.stdout).not.toContain(`The program for the 'imperative.pluginHealthCheck' property does not exist:`);
expect(result.stdout).not.toContain("This plugin has configuration errors. No component of the plugin will be available");
expect(result.stderr).not.toContain("Problems detected during plugin validation.");
expect(result.status).toEqual(0);
});

// TODO: remove this test in V3, when pluginHealthCheck is removed
it("missing pluginHealthCheck handler - error", () => {
const testPlugin = "missing_healthcheck_handler";
const fullPluginPath = join(testPluginDir, "error_plugins", testPlugin);

let cmd = `plugins install ${fullPluginPath}`;
let result = T.executeTestCLICommand(cliBin, this, cmd.split(" "));
expect(result.stdout).toContain(`Installed plugin name = '${testPlugin}'`);

cmd = `plugins validate ${testPlugin}`;
result = T.executeTestCLICommand(cliBin, this, cmd.split(" "));
result.stderr = removeNewline(result.stderr);
expect(result.stdout).toContain(testPlugin);
expect(result.stdout).toContain("This plugin was successfully validated. Enjoy the plugin.");
expect(result.stdout).not.toContain("Error");
expect(result.stdout).not.toContain(`The program for the 'imperative.pluginHealthCheck' property does not exist:`);
expect(result.stdout).not.toContain("This plugin has configuration errors. No component of the plugin will be available");
expect(result.stderr).not.toContain("Problems detected during plugin validation.");
expect(result.status).toEqual(0);
});

it("missing peerDependencies properties", () => {
const testPlugin = "missing_dependencies";
const fullPluginPath = join(testPluginDir, "error_plugins", testPlugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "chained-handler-plugin",
"rootCommandDescription": "imperative working test plugin",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler",
"pluginAliases": [
"chp",
"chainedhandlerp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "definition_bad_chained_handler",
"rootCommandDescription": "definition bad chained handler",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "definition_empty_array",
"rootCommandDescription": "definition empty array",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": []
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "definition_empty_chained_handler",
"rootCommandDescription": "definition empty chained handler",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "definition_missing_chained_handler",
"rootCommandDescription": "definition missing chained handler",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "definition_missing_description",
"rootCommandDescription": "definition missing description",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "definition_missing_handler",
"rootCommandDescription": "definition missing handler",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "definition_missing_name",
"rootCommandDescription": "definition missing name",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"description": "dummy foo command",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "definition_missing_type",
"rootCommandDescription": "definition missing type",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "definition_type_group_without_children",
"rootCommandDescription": "definition type group without children",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "plugins",
"rootCommandDescription": "duplicated base cli command",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "normal-plugin",
"rootCommandDescription": "duplicated installed plugin command",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "incompatible_imperative_version",
"rootCommandDescription": "imperative working test plugin",
"pluginBaseCliVersion": "^2.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "missing_command_handler",
"rootCommandDescription": "imperative working test plugin",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
"imperative": {
"name": "missing_definitions",
"rootCommandDescription": "missing definitions",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler"
"pluginBaseCliVersion": "^1.0.0"
},
"peerDependencies": {
"@zowe/imperative": "1.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "missing_dependencies",
"rootCommandDescription": "imperative working test plugin",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "missing_healthcheck_handler",
"rootCommandDescription": "imperative working test plugin",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./non_existing_path",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"imperative": {
"name": "missing_pluginBaseCliVersion",
"rootCommandDescription": "imperative working test plugin",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"imperative": {
"name": "missing_rootCommandDescription",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"imperative": {
"rootCommandDescription": "missing name plugin",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./dummy.handler",
"definitions": [
{
"name": "foo",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "normal-plugin",
"rootCommandDescription": "imperative working test plugin",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler",
"pluginAliases": [
"np",
"normalp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "normal-plugin-2",
"rootCommandDescription": "imperative working test plugin 2",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler",
"definitions": [
{
"name": "foo",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "normal-plugin-misc",
"rootCommandDescription": "imperative working test plugin",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler",
"pluginAliases": [
"misc"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "override-plugin",
"rootCommandDescription": "imperative override plugin rootCommandDescription",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler",
"overrides": {
"CredentialManager": "./sample-plugin/overrides/CredentialManager.override"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"name": "space-in-path-plugin",
"rootCommandDescription": "imperative working test plugin",
"pluginBaseCliVersion": "^1.0.0",
"pluginHealthCheck": "./lib/sample-plugin/healthCheck.handler",
"pluginAliases": [
"np",
"normalp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe("Command Utils", () => {
});

it("We should be able to flatten a nested command tree with aliases for display and searching purposes", () => {
const flatten: ICommandTreeEntry[] = CommandUtils.flattenCommandTreeWithAliases(COMPLEX_COMMAND_WITH_ALIASES);
const flatten: ICommandTreeEntry[] = CommandUtils.flattenCommandTree(COMPLEX_COMMAND_WITH_ALIASES);
TestLogger.info("Flattened Command Tree:\n" + inspect(flatten));
expect(flatten).toMatchSnapshot();
});
Expand Down
Loading

0 comments on commit b52c7d2

Please sign in to comment.