From 4498c07a36cfd335bd8839b1faddbdd161d77781 Mon Sep 17 00:00:00 2001 From: Gene Johnston Date: Wed, 8 Nov 2023 16:05:23 -0500 Subject: [PATCH 01/10] Remove conditional logic for V3 error message formatting Signed-off-by: Gene Johnston --- .../cli.zos-jobs.cancel.job.system.test.ts | 6 -- .../cli.zos-jobs.delete.job.system.test.ts | 6 -- ...li.zos-jobs.download.output.system.test.ts | 6 -- ...s.list.spool-files-by-jobid.system.test.ts | 6 -- ...jobs.view.all-spool-content.system.test.ts | 6 -- ...bs.view.job-status-by-jobid.system.test.ts | 6 -- ...-jobs.view.spool-file-by-id.system.test.ts | 12 --- packages/core/src/rest/ZosmfRestClient.ts | 91 ++++++------------- .../src/cmd/src/CommandProcessor.ts | 54 ++++------- .../src/rest/src/client/AbstractRestClient.ts | 56 +++--------- .../src/utilities/src/NextVerFeatures.ts | 7 +- packages/zosjobs/src/GetJobs.ts | 38 ++------ 12 files changed, 75 insertions(+), 219 deletions(-) diff --git a/packages/cli/__tests__/zosjobs/__system__/cancel/cli.zos-jobs.cancel.job.system.test.ts b/packages/cli/__tests__/zosjobs/__system__/cancel/cli.zos-jobs.cancel.job.system.test.ts index c2366ea4f9..f83b35c13a 100644 --- a/packages/cli/__tests__/zosjobs/__system__/cancel/cli.zos-jobs.cancel.job.system.test.ts +++ b/packages/cli/__tests__/zosjobs/__system__/cancel/cli.zos-jobs.cancel.job.system.test.ts @@ -44,14 +44,8 @@ describe("zos-jobs cancel job command", () => { const response = runCliScript(__dirname + "/__scripts__/job/not_found.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); expect(response.stdout.toString()).toBe(""); - // TODO:V3_ERR_FORMAT - In V3 remove the following lines - expect(response.stderr.toString()).toContain("Command Error:"); - expect(response.stderr.toString()).toContain("Obtaining job info for a single job id JOB00000 on"); - expect(response.stderr.toString()).toContain("failed: Job not found"); - /* TODO:V3_ERR_FORMAT - Use the following lines instead expect(response.stderr.toString()).toContain("Cannot obtain job info for job id = JOB00000"); expect(response.stderr.toString()).toContain("Zero jobs were returned"); - */ }); it("should surface an error from z/OSMF if the jobid was already canceled", () => { diff --git a/packages/cli/__tests__/zosjobs/__system__/delete/cli.zos-jobs.delete.job.system.test.ts b/packages/cli/__tests__/zosjobs/__system__/delete/cli.zos-jobs.delete.job.system.test.ts index c70924a92c..9d8d74af0d 100644 --- a/packages/cli/__tests__/zosjobs/__system__/delete/cli.zos-jobs.delete.job.system.test.ts +++ b/packages/cli/__tests__/zosjobs/__system__/delete/cli.zos-jobs.delete.job.system.test.ts @@ -33,14 +33,8 @@ describe("zos-jobs delete job command", () => { const response = runCliScript(__dirname + "/__scripts__/job/not_found.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); expect(response.stdout.toString()).toBe(""); - // TODO:V3_ERR_FORMAT - In V3 remove the following lines - expect(response.stderr.toString()).toContain("Command Error:"); - expect(response.stderr.toString()).toContain("Obtaining job info for a single job id JOB00000 on"); - expect(response.stderr.toString()).toContain("failed: Job not found"); - /* TODO:V3_ERR_FORMAT - Use the following lines instead expect(response.stderr.toString()).toContain("Cannot obtain job info for job id = JOB00000"); expect(response.stderr.toString()).toContain("Zero jobs were returned"); - */ }); }); diff --git a/packages/cli/__tests__/zosjobs/__system__/download/cli.zos-jobs.download.output.system.test.ts b/packages/cli/__tests__/zosjobs/__system__/download/cli.zos-jobs.download.output.system.test.ts index 97672996db..f553570fc9 100644 --- a/packages/cli/__tests__/zosjobs/__system__/download/cli.zos-jobs.download.output.system.test.ts +++ b/packages/cli/__tests__/zosjobs/__system__/download/cli.zos-jobs.download.output.system.test.ts @@ -33,14 +33,8 @@ describe("zos-jobs download output command", () => { const response = runCliScript(__dirname + "/__scripts__/download-output/not_found.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); expect(response.stdout.toString()).toBe(""); - // TODO:V3_ERR_FORMAT - In V3 remove the following lines - expect(response.stderr.toString()).toContain("Command Error:"); - expect(response.stderr.toString()).toContain("Obtaining job info for a single job id JOB00000 on"); - expect(response.stderr.toString()).toContain("failed: Job not found"); - /* TODO:V3_ERR_FORMAT - Use the following lines instead expect(response.stderr.toString()).toContain("Cannot obtain job info for job id = JOB00000"); expect(response.stderr.toString()).toContain("Zero jobs were returned"); - */ }); }); diff --git a/packages/cli/__tests__/zosjobs/__system__/list/cli.zos-jobs.list.spool-files-by-jobid.system.test.ts b/packages/cli/__tests__/zosjobs/__system__/list/cli.zos-jobs.list.spool-files-by-jobid.system.test.ts index a65285f780..cb45e1ca28 100644 --- a/packages/cli/__tests__/zosjobs/__system__/list/cli.zos-jobs.list.spool-files-by-jobid.system.test.ts +++ b/packages/cli/__tests__/zosjobs/__system__/list/cli.zos-jobs.list.spool-files-by-jobid.system.test.ts @@ -61,14 +61,8 @@ describe("zos-jobs list spool-files-by-jobid command", () => { it("should present an error message if the JOBID is not found", () => { const response = runCliScript(__dirname + "/__scripts__/spool-files-by-jobid/not_found.sh", TEST_ENVIRONMENT); expect(response.stdout.toString()).toBe(""); - // TODO:V3_ERR_FORMAT - In V3 remove the following lines - expect(response.stderr.toString()).toContain("Command Error:"); - expect(response.stderr.toString()).toContain("Obtaining job info for a single job id j0"); - expect(response.stderr.toString()).toContain("failed: Job not found"); - /* TODO:V3_ERR_FORMAT - Use the following lines instead expect(response.stderr.toString()).toContain("Cannot obtain job info for job id = j0"); expect(response.stderr.toString()).toContain("Zero jobs were returned"); - */ expect(response.status).toBe(1); }); diff --git a/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.all-spool-content.system.test.ts b/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.all-spool-content.system.test.ts index 934a6265f4..ebd08c8d5d 100644 --- a/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.all-spool-content.system.test.ts +++ b/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.all-spool-content.system.test.ts @@ -106,14 +106,8 @@ describe("zos-jobs view all-spool-content command", () => { TEST_ENVIRONMENT); expect(response.stdout.toString()).toBe(""); expect(response.status).toBe(1); - // TODO:V3_ERR_FORMAT - In V3 remove the following lines - expect(response.stderr.toString()).toContain("Command Error:"); - expect(response.stderr.toString()).toContain("Obtaining job info for a single job id JOB00000 on"); - expect(response.stderr.toString()).toContain("failed: Job not found"); - /* TODO:V3_ERR_FORMAT - Use the following lines instead expect(response.stderr.toString()).toContain("Cannot obtain job info for job id = JOB00000"); expect(response.stderr.toString()).toContain("Zero jobs were returned"); - */ }); }); }); diff --git a/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.job-status-by-jobid.system.test.ts b/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.job-status-by-jobid.system.test.ts index b9078a46e9..4c614e5f83 100644 --- a/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.job-status-by-jobid.system.test.ts +++ b/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.job-status-by-jobid.system.test.ts @@ -135,14 +135,8 @@ describe("zos-jobs view job-status-by-jobid command", () => { TEST_ENVIRONMENT); expect(response.stdout.toString()).toBe(""); expect(response.status).toBe(1); - // TODO:V3_ERR_FORMAT - In V3 remove the following lines - expect(response.stderr.toString()).toContain("Command Error:"); - expect(response.stderr.toString()).toContain("Obtaining job info for a single job id J0 on"); - expect(response.stderr.toString()).toContain("failed: Job not found"); - /* TODO:V3_ERR_FORMAT - Use the following lines instead expect(response.stderr.toString()).toContain("Cannot obtain job info for job id = J0"); expect(response.stderr.toString()).toContain("Zero jobs were returned"); - */ }); }); }); diff --git a/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.spool-file-by-id.system.test.ts b/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.spool-file-by-id.system.test.ts index 14d5c6cd64..b50c4bec4b 100644 --- a/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.spool-file-by-id.system.test.ts +++ b/packages/cli/__tests__/zosjobs/__system__/view/cli.zos-jobs.view.spool-file-by-id.system.test.ts @@ -127,14 +127,8 @@ describe("zos-jobs view spool-file-by-id command", () => { TEST_ENVIRONMENT); expect(response.stdout.toString()).toBe(""); expect(response.status).toBe(1); - // TODO:V3_ERR_FORMAT - In V3 remove the following lines - expect(response.stderr.toString()).toContain("Command Error:"); - expect(response.stderr.toString()).toContain("Obtaining job info for a single job id J0 on"); - expect(response.stderr.toString()).toContain("failed: Job not found"); - /* TODO:V3_ERR_FORMAT - Use the following lines instead expect(response.stderr.toString()).toContain("Cannot obtain job info for job id = J0"); expect(response.stderr.toString()).toContain("Zero jobs were returned"); - */ }); it("should surface an error if the spool file ID does not exist", () => { @@ -144,13 +138,7 @@ describe("zos-jobs view spool-file-by-id command", () => { expect(response.status).toBe(1); expect(response.stderr.toString()).toContain("does not contain spool file id 9999"); expect(response.stderr.toString()).toMatch(/Request: +GET/); - // TODO:V3_ERR_FORMAT - In V3 remove the following lines - expect(response.stderr.toString()).toContain("Command Error:"); - expect(response.stderr.toString()).toContain("z/OSMF REST API Error:"); - expect(response.stderr.toString()).toContain("Error Details:"); - /* TODO:V3_ERR_FORMAT - Use the following lines instead expect(response.stderr.toString()).toContain("HTTP(S) error 400 = Bad Request"); - */ }); }); }); diff --git a/packages/core/src/rest/ZosmfRestClient.ts b/packages/core/src/rest/ZosmfRestClient.ts index 0f64ffad7c..03dc9c84b5 100644 --- a/packages/core/src/rest/ZosmfRestClient.ts +++ b/packages/core/src/rest/ZosmfRestClient.ts @@ -54,11 +54,6 @@ export class ZosmfRestClient extends RestClient { * @memberof ZosmfRestClient */ protected processError(original: IImperativeError): IImperativeError { - // TODO:V3_ERR_FORMAT - Remove block in V3 - if (!NextVerFeatures.useV3ErrFormat()) { - original.msg = "z/OSMF REST API Error:\n" + original.msg; - } - let causeErrorsJson; let causeErrorsString = ""; if (original.causeErrors) { @@ -86,76 +81,42 @@ export class ZosmfRestClient extends RestClient { } const origMsgFor401 = original.msg; - // TODO:V3_ERR_FORMAT - Don't test for env variable in V3 - if (NextVerFeatures.useV3ErrFormat()) { - // extract properties from causeErrors and place them into 'msg' as user-focused messages - if (causeErrorsJson?.details?.length > 0) { - for (const detail of causeErrorsJson.details) { - original.msg += "\n" + detail; - } + // extract properties from causeErrors and place them into 'msg' as user-focused messages + if (causeErrorsJson?.details?.length > 0) { + for (const detail of causeErrorsJson.details) { + original.msg += "\n" + detail; } - if (causeErrorsJson?.messages?.length > 0) { - for (const message of causeErrorsJson.messages) { - original.msg += "\n" + message.messageContent; - } + } + if (causeErrorsJson?.messages?.length > 0) { + for (const message of causeErrorsJson.messages) { + original.msg += "\n" + message.messageContent; } - } else { // TODO:V3_ERR_FORMAT - Remove in V3 - original.msg += "\n" + causeErrorsString; // add the data string which is the original error } // add further clarification on authentication errors if (this.response && this.response.statusCode === RestConstants.HTTP_STATUS_401) { - // TODO:V3_ERR_FORMAT - Don't test for env variable in V3 - if (NextVerFeatures.useV3ErrFormat()) { - if (!original.causeErrors || Object.keys(original.causeErrors ).length === 0) { - /* We have no causeErrors, so place the original msg we got for a 401 - * into the 'response from service' part of our error. - */ - original.causeErrors = `{"Error": "${origMsgFor401}"}`; - } - original.msg += "\nThis operation requires authentication."; + if (!original.causeErrors || Object.keys(original.causeErrors ).length === 0) { + /* We have no causeErrors, so place the original msg we got for a 401 + * into the 'response from service' part of our error. + */ + original.causeErrors = `{"Error": "${origMsgFor401}"}`; + } + original.msg += "\nThis operation requires authentication."; - if (this.session.ISession.type === SessConstants.AUTH_TYPE_BASIC) { - original.msg += "\nUsername or password are not valid or expired."; - } else if (this.session.ISession.type === SessConstants.AUTH_TYPE_TOKEN) { - if (this.session.ISession.tokenType === SessConstants.TOKEN_TYPE_APIML && !this.session.ISession.basePath) { - original.msg += `\nToken type "${SessConstants.TOKEN_TYPE_APIML}" requires base path to be defined.\n` + - "You must either connect with username and password or provide a base path."; - } else { - original.msg += "\nToken is not valid or expired.\n" + - "To obtain a new valid token, use the following command: `zowe config secure`\n" + - "For CLI usage, see `zowe config secure --help`"; - } - // TODO: Add PFX support in the future - } else if (this.session.ISession.type === SessConstants.AUTH_TYPE_CERT_PEM) { - original.msg += "\nCertificate is not valid or expired."; - } - } else { // TODO:V3_ERR_FORMAT - Remove in V3 - original.msg = "This operation requires authentication.\n\n" + original.msg + - "\nHost: " + this.session.ISession.hostname + - "\nPort: " + this.session.ISession.port + - "\nBase Path: " + this.session.ISession.basePath + - "\nResource: " + this.mResource + - "\nRequest: " + this.mRequest + - "\nHeaders: " + JSON.stringify(this.mReqHeaders) + - "\nPayload: " + this.mRequest + - "\n" - ; - if (this.session.ISession.type === SessConstants.AUTH_TYPE_BASIC) { - original.additionalDetails = "Username or password are not valid or expired.\n\n"; - } else if (this.session.ISession.type === SessConstants.AUTH_TYPE_TOKEN && this.session.ISession.tokenValue != null) { - if (this.session.ISession.tokenType === SessConstants.TOKEN_TYPE_APIML && !this.session.ISession.basePath) { - original.additionalDetails = `Token type "${SessConstants.TOKEN_TYPE_APIML}" requires base path to be defined.\n\n` + - "You must either connect with username and password or provide a base path."; - } else { - original.additionalDetails = "Token is not valid or expired.\n" + + if (this.session.ISession.type === SessConstants.AUTH_TYPE_BASIC) { + original.msg += "\nUsername or password are not valid or expired."; + } else if (this.session.ISession.type === SessConstants.AUTH_TYPE_TOKEN) { + if (this.session.ISession.tokenType === SessConstants.TOKEN_TYPE_APIML && !this.session.ISession.basePath) { + original.msg += `\nToken type "${SessConstants.TOKEN_TYPE_APIML}" requires base path to be defined.\n` + + "You must either connect with username and password or provide a base path."; + } else { + original.msg += "\nToken is not valid or expired.\n" + "To obtain a new valid token, use the following command: `zowe config secure`\n" + "For CLI usage, see `zowe config secure --help`"; - } - // TODO: Add PFX support in the future - } else if (this.session.ISession.type === SessConstants.AUTH_TYPE_CERT_PEM) { - original.additionalDetails = "Certificate is not valid or expired.\n\n"; } + // TODO: Add PFX support in the future + } else if (this.session.ISession.type === SessConstants.AUTH_TYPE_CERT_PEM) { + original.msg += "\nCertificate is not valid or expired."; } } diff --git a/packages/imperative/src/cmd/src/CommandProcessor.ts b/packages/imperative/src/cmd/src/CommandProcessor.ts index 65e64ba3ab..872b711e05 100644 --- a/packages/imperative/src/cmd/src/CommandProcessor.ts +++ b/packages/imperative/src/cmd/src/CommandProcessor.ts @@ -1210,37 +1210,28 @@ export class CommandProcessor { response.setError(handlerErr.details); // display primary user message - // TODO:V3_ERR_FORMAT - Don't test for env variable in V3 - if (NextVerFeatures.useV3ErrFormat()) { - response.console.error(TextUtils.chalk.red( - "Unable to perform this operation due to the following problem." - )); - // Remove http status in 'message', since the same information was placed in additionalDetails. - response.console.error(TextUtils.chalk.red( - handlerErr.message.replace(/Rest API failure with HTTP\(S\) status \d\d\d\n/, "") - )); - } else { // TODO:V3_ERR_FORMAT - Remove in V3 - response.console.errorHeader("Command Error"); - response.console.error(Buffer.from(handlerErr.message + "\n")); - } + response.console.error(TextUtils.chalk.red( + "Unable to perform this operation due to the following problem." + )); + // Remove http status in 'message', since the same information was placed in additionalDetails. + response.console.error(TextUtils.chalk.red( + handlerErr.message.replace(/Rest API failure with HTTP\(S\) status \d\d\d\n/, "") + )); // display server response - // TODO:V3_ERR_FORMAT - Don't test for env variable in V3 - if (NextVerFeatures.useV3ErrFormat()) { - const responseTitle = "Response From Service"; - if (handlerErr.causeErrors) { - try { - const causeErrorsJson = JSON.parse(handlerErr.causeErrors); + const responseTitle = "Response From Service"; + if (handlerErr.causeErrors) { + try { + const causeErrorsJson = JSON.parse(handlerErr.causeErrors); + response.console.error("\n" + TextUtils.chalk.bold.yellow(responseTitle)); + response.console.error(TextUtils.prettyJson(causeErrorsJson, undefined, false, "")); + } catch (parseErr) { + // causeErrors was not JSON. + const causeErrString: string = handlerErr.causeErrors.toString(); + if (causeErrString.length > 0) { + // output the text value of causeErrors response.console.error("\n" + TextUtils.chalk.bold.yellow(responseTitle)); - response.console.error(TextUtils.prettyJson(causeErrorsJson, undefined, false, "")); - } catch (parseErr) { - // causeErrors was not JSON. - const causeErrString: string = handlerErr.causeErrors.toString(); - if (causeErrString.length > 0) { - // output the text value of causeErrors - response.console.error("\n" + TextUtils.chalk.bold.yellow(responseTitle)); - response.console.error(causeErrString); - } + response.console.error(causeErrString); } } } @@ -1248,12 +1239,7 @@ export class CommandProcessor { // display diagnostic information const diagInfo: string = (handlerErr as ImperativeError).details.additionalDetails; if (diagInfo?.length > 0) { - // TODO:V3_ERR_FORMAT - Don't test for env variable in V3 - if (NextVerFeatures.useV3ErrFormat()) { - response.console.error(TextUtils.chalk.bold.yellow("\nDiagnostic Information")); - } else { // TODO:V3_ERR_FORMAT - Remove in V3 - response.console.errorHeader("Error Details"); - } + response.console.error(TextUtils.chalk.bold.yellow("\nDiagnostic Information")); response.console.error(diagInfo); } diff --git a/packages/imperative/src/rest/src/client/AbstractRestClient.ts b/packages/imperative/src/rest/src/client/AbstractRestClient.ts index 6f407904a0..3bfdf140cf 100644 --- a/packages/imperative/src/rest/src/client/AbstractRestClient.ts +++ b/packages/imperative/src/rest/src/client/AbstractRestClient.ts @@ -308,16 +308,8 @@ export abstract class AbstractRestClient { * Invoke any onError method whenever an error occurs on writing */ clientRequest.on("error", (errorResponse: any) => { - let errMsg: string; - // TODO:V3_ERR_FORMAT - Don't test for env variable in V3 - if (NextVerFeatures.useV3ErrFormat()) { - errMsg = "Failed to send an HTTP request."; - } else { // TODO:V3_ERR_FORMAT - Remove in V3 - errMsg = "http(s) request error event called"; - } - reject(this.populateError({ - msg: errMsg, + msg: "Failed to send an HTTP request.", causeErrors: errorResponse, source: "client" })); @@ -756,41 +748,21 @@ export abstract class AbstractRestClient { `HTTP(S) client encountered an error. Request could not be initiated to host.\n` + `Review connection details (host, port) and ensure correctness.`; } else { - // TODO:V3_ERR_FORMAT - Don't test for env variable in V3 - if (NextVerFeatures.useV3ErrFormat()) { - detailMessage = - `Received HTTP(S) error ${finalError.httpStatus} = ${http.STATUS_CODES[finalError.httpStatus]}.`; - } else { // TODO:V3_ERR_FORMAT - Remove in V3 - detailMessage = - `HTTP(S) error status "${finalError.httpStatus}" received.\n` + - `Review request details (resource, base path, credentials, payload) and ensure correctness.`; - } + detailMessage = + `Received HTTP(S) error ${finalError.httpStatus} = ${http.STATUS_CODES[finalError.httpStatus]}.`; } - // TODO:V3_ERR_FORMAT - Don't test for env variable in V3 - if (NextVerFeatures.useV3ErrFormat()) { - detailMessage += "\n" + - "\nProtocol: " + finalError.protocol + - "\nHost: " + finalError.host + - "\nPort: " + finalError.port + - "\nBase Path: " + finalError.basePath + - "\nResource: " + finalError.resource + - "\nRequest: " + finalError.request + - "\nHeaders: " + headerDetails + - "\nPayload: " + payloadDetails + - "\nAuth type: " + this.mSession.ISession.type + - "\nAllow Unauth Cert: " + !this.mSession.ISession.rejectUnauthorized; - } else { // TODO:V3_ERR_FORMAT - Remove in V3 - detailMessage += "\n" + - "\nProtocol: " + finalError.protocol + - "\nHost: " + finalError.host + - "\nPort: " + finalError.port + - "\nBase Path: " + finalError.basePath + - "\nResource: " + finalError.resource + - "\nRequest: " + finalError.request + - "\nHeaders: " + headerDetails + - "\nPayload: " + payloadDetails; - } + detailMessage += "\n" + + "\nProtocol: " + finalError.protocol + + "\nHost: " + finalError.host + + "\nPort: " + finalError.port + + "\nBase Path: " + finalError.basePath + + "\nResource: " + finalError.resource + + "\nRequest: " + finalError.request + + "\nHeaders: " + headerDetails + + "\nPayload: " + payloadDetails + + "\nAuth type: " + this.mSession.ISession.type + + "\nAllow Unauth Cert: " + !this.mSession.ISession.rejectUnauthorized; finalError.additionalDetails = detailMessage; // Allow implementation to modify the error as necessary diff --git a/packages/imperative/src/utilities/src/NextVerFeatures.ts b/packages/imperative/src/utilities/src/NextVerFeatures.ts index d5e28e6f0d..2c169a78a3 100644 --- a/packages/imperative/src/utilities/src/NextVerFeatures.ts +++ b/packages/imperative/src/utilities/src/NextVerFeatures.ts @@ -19,13 +19,15 @@ export class NextVerFeatures { private static ENV_VAR_PREFIX = "ZOWE"; /** + * This feature has already been incorporated into Zowe. We left this function + * in the source as a model for enabling a similar preview feature in the future. + * * Identify if we should use the V3 error message format. * That choice is determined by the value of the ZOWE_V3_ERR_FORMAT environment variable. * - * TODO:V3_ERR_FORMAT - Remove in V3 - * * @returns {boolean} True -> Use the V3 format. */ + /* public static useV3ErrFormat(): boolean { // our default is false let v3ErrFmtBoolVal: boolean = false; @@ -38,4 +40,5 @@ export class NextVerFeatures { } return v3ErrFmtBoolVal; } + */ } diff --git a/packages/zosjobs/src/GetJobs.ts b/packages/zosjobs/src/GetJobs.ts index 5c626a1c6e..2f2975e301 100644 --- a/packages/zosjobs/src/GetJobs.ts +++ b/packages/zosjobs/src/GetJobs.ts @@ -109,10 +109,6 @@ export class GetJobs { ImperativeExpect.toNotBeNullOrUndefined(session, "Required session must be defined"); const jobs = await GetJobs.getJobsCommon(session, { jobid, owner: "*" }); - // TODO:V3_ERR_FORMAT - Remove in V3 - const errorMessagePrefix: string = "Obtaining job info for a single job id " + jobid + " on " + - session.ISession.hostname + ":" + session.ISession.port + " failed: "; - const userMsg: string = "Cannot obtain job info for job id = " + jobid; const diagInfo: string = "Protocol: " + session.ISession.protocol + @@ -124,34 +120,20 @@ export class GetJobs { // fail if no jobs if (jobs.length === 0) { - // TODO:V3_ERR_FORMAT - Don't test for env variable in V3 - if (NextVerFeatures.useV3ErrFormat()) { - throw new ImperativeError({ - msg: userMsg, - causeErrors: "Zero jobs were returned.", - additionalDetails: diagInfo - }); - } else { // TODO:V3_ERR_FORMAT - Remove in V3 - throw new ImperativeError({ - msg: errorMessagePrefix + "Job not found" - }); - } + throw new ImperativeError({ + msg: userMsg, + causeErrors: "Zero jobs were returned.", + additionalDetails: diagInfo + }); } // fail if unexpected number of jobs (job id should be unique) if (jobs.length > 1) { - // TODO:V3_ERR_FORMAT - Don't test for env variable in V3 - if (NextVerFeatures.useV3ErrFormat()) { - throw new ImperativeError({ - msg: userMsg, - causeErrors: jobs.length + " jobs were returned. Only expected 1.", - additionalDetails: diagInfo - }); - } else { // TODO:V3_ERR_FORMAT - Remove in V3 - throw new ImperativeError({ - msg: errorMessagePrefix + "Expected 1 job returned but received " + jobs.length - }); - } + throw new ImperativeError({ + msg: userMsg, + causeErrors: jobs.length + " jobs were returned. Only expected 1.", + additionalDetails: diagInfo + }); } // return the single job From b372741ac1891e0ca752bc27f3b92f933c981370 Mon Sep 17 00:00:00 2001 From: Gene Johnston Date: Thu, 9 Nov 2023 12:29:02 -0500 Subject: [PATCH 02/10] Remove remaining references to NextVerFeatures and useV3ErrFormat Signed-off-by: Gene Johnston --- .../auth/__unit__/Login.apiml.unit.test.ts | 13 +-- .../auth/__unit__/Logout.apiml.unit.test.ts | 9 +- .../Login.apiml.unit.test.ts.snap | 17 --- .../__unit__/ZosmfRestClient.unit.test.ts | 84 +------------- packages/core/src/rest/ZosmfRestClient.ts | 10 +- .../__tests__/CommandProcessor.unit.test.ts | 108 +----------------- .../src/cmd/src/CommandProcessor.ts | 2 +- .../cmd/import/import.handler.unit.test.ts | 7 -- .../client/AbstractRestClient.unit.test.ts | 64 +---------- .../__tests__/client/RestClient.unit.test.ts | 7 +- .../src/rest/src/client/AbstractRestClient.ts | 2 +- .../__tests__/NextVerFeatures.unit.test.ts | 50 -------- .../methods/upload/Upload.unit.test.ts | 9 +- .../__tests__/__unit__/GetJobs.unit.test.ts | 37 +----- .../__snapshots__/GetJobs.unit.test.ts.snap | 4 - packages/zosjobs/src/GetJobs.ts | 2 +- 16 files changed, 24 insertions(+), 401 deletions(-) delete mode 100644 packages/core/__tests__/auth/__unit__/__snapshots__/Login.apiml.unit.test.ts.snap delete mode 100644 packages/imperative/src/utilities/__tests__/NextVerFeatures.unit.test.ts diff --git a/packages/core/__tests__/auth/__unit__/Login.apiml.unit.test.ts b/packages/core/__tests__/auth/__unit__/Login.apiml.unit.test.ts index f353251229..7cecf898cf 100644 --- a/packages/core/__tests__/auth/__unit__/Login.apiml.unit.test.ts +++ b/packages/core/__tests__/auth/__unit__/Login.apiml.unit.test.ts @@ -11,7 +11,7 @@ import { Login } from "../../../src/auth/Login"; import { ZosmfRestClient } from "../../../src/rest/ZosmfRestClient"; -import { ImperativeError, NextVerFeatures, RestConstants } from "@zowe/imperative"; +import { ImperativeError, RestConstants } from "@zowe/imperative"; const goodResponse: any = { statusCode: RestConstants.HTTP_STATUS_204 @@ -32,13 +32,6 @@ const fakeSession: any = { describe("Auth Login APIML unit tests", () => { - beforeEach(() => { - /* This avoids having to mock ImperativeConfig.envVariablePrefix. - * Unless the choice below is overridden, tests will use our legacy format for errors. - */ - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false); - }); - describe("Positive tests", () => { it("should allow users to call apimlLogin with correct parameters", async () => { ZosmfRestClient.prototype.request = jest.fn(); @@ -65,7 +58,9 @@ describe("Auth Login APIML unit tests", () => { } expect(caughtError).toBeDefined(); expect(caughtError instanceof ImperativeError).toEqual(true); - expect(caughtError.mDetails).toMatchSnapshot(); + const errDetailString = caughtError.mDetails.toString(); + expect(errDetailString).toContain("Error: REST API Failure with HTTP(S) status 401"); + expect(errDetailString).toContain("This operation requires authentication"); }); }); diff --git a/packages/core/__tests__/auth/__unit__/Logout.apiml.unit.test.ts b/packages/core/__tests__/auth/__unit__/Logout.apiml.unit.test.ts index 82589feb72..92ffbffad6 100644 --- a/packages/core/__tests__/auth/__unit__/Logout.apiml.unit.test.ts +++ b/packages/core/__tests__/auth/__unit__/Logout.apiml.unit.test.ts @@ -11,7 +11,7 @@ import { Logout } from "../../../src/auth/Logout"; import { ZosmfRestClient } from "../../../src/rest/ZosmfRestClient"; -import { ImperativeError, NextVerFeatures, RestConstants } from "@zowe/imperative"; +import { ImperativeError, RestConstants } from "@zowe/imperative"; const goodResponse: any = { statusCode: RestConstants.HTTP_STATUS_204 @@ -49,13 +49,6 @@ const fakeSession: any = { describe("Auth Logout APIML unit tests", () => { - beforeEach(() => { - /* This avoids having to mock ImperativeConfig.envVariablePrefix. - * Unless overridden, tests will use our legacy format for errors. - */ - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false); - }); - describe("Positive tests", () => { it("should allow users to call apimlLogout with correct parameters", async () => { ZosmfRestClient.prototype.request = jest.fn(); diff --git a/packages/core/__tests__/auth/__unit__/__snapshots__/Login.apiml.unit.test.ts.snap b/packages/core/__tests__/auth/__unit__/__snapshots__/Login.apiml.unit.test.ts.snap deleted file mode 100644 index d576559c55..0000000000 --- a/packages/core/__tests__/auth/__unit__/__snapshots__/Login.apiml.unit.test.ts.snap +++ /dev/null @@ -1,17 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Auth Login APIML unit tests Error handling tests - HTTP 401 should be able to raise an error with HTTP 401 1`] = ` -[Error: This operation requires authentication. - -z/OSMF REST API Error: -REST API Failure with HTTP(S) status 401 - -Host: undefined -Port: undefined -Base Path: undefined -Resource: undefined -Request: undefined -Headers: undefined -Payload: undefined -] -`; diff --git a/packages/core/__tests__/rest/__unit__/ZosmfRestClient.unit.test.ts b/packages/core/__tests__/rest/__unit__/ZosmfRestClient.unit.test.ts index e566b660d0..2089326747 100644 --- a/packages/core/__tests__/rest/__unit__/ZosmfRestClient.unit.test.ts +++ b/packages/core/__tests__/rest/__unit__/ZosmfRestClient.unit.test.ts @@ -11,17 +11,10 @@ import { ZosmfHeaders } from "../../../src/rest/ZosmfHeaders"; import { ZosmfRestClient } from "../../../src/rest/ZosmfRestClient"; -import { IImperativeError, NextVerFeatures, RestConstants, SessConstants, Session } from "@zowe/imperative"; +import { IImperativeError, RestConstants, SessConstants, Session } from "@zowe/imperative"; describe("ZosmfRestClient tests", () => { - beforeEach(() => { - /* This avoids having to mock ImperativeConfig.envVariablePrefix. - * Unless the choice below is overridden, tests will use our legacy format for errors. - */ - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false); - }); - it("should append the csrf header to all requests", () => { const zosmfRestClient = new ZosmfRestClient(new Session({ hostname: "dummy" })); expect((zosmfRestClient as any).appendHeaders([])).toMatchObject([ @@ -41,29 +34,14 @@ describe("ZosmfRestClient tests", () => { }) }; const processedError = ((zosmfRestClient as any).processError(error)); - expect(processedError.msg).toContain(shouldNotDeleteMessage); + expect(processedError.causeErrors).not.toContain(shouldDeleteMessage); + expect(processedError.causeErrors).toContain(shouldNotDeleteMessage); expect(processedError.msg.indexOf()).toEqual(-1); }); describe("Authentication errors", () => { - it("should handle error for basic auth", () => { - const zosmfRestClient = new ZosmfRestClient(new Session({ - hostname: "dummy", - type: SessConstants.AUTH_TYPE_BASIC, - user: "fakeUser", - password: "fakePass" - })); - (zosmfRestClient as any).mResponse = { - statusCode: RestConstants.HTTP_STATUS_401 - }; - const error: IImperativeError = { msg: "hello" }; - const processedError = ((zosmfRestClient as any).processError(error)); - expect(processedError.msg).toContain("This operation requires authentication."); - expect(processedError.additionalDetails).toContain("Username or password are not valid or expired."); - }); - it("should handle basic auth error with empty string causeErrors using V3_ERR_FORMAT", () => { - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(true); + it("should handle basic auth error with empty string causeErrors", () => { const zosmfRestClient = new ZosmfRestClient(new Session({ hostname: "dummy", type: SessConstants.AUTH_TYPE_BASIC, @@ -93,8 +71,7 @@ describe("ZosmfRestClient tests", () => { expect(processedError.additionalDetails).toContain("Allow Unauth Cert: true"); }); - it("should handle basic auth error with JSON causeErrors using V3_ERR_FORMAT", () => { - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(true); + it("should handle basic auth error with JSON causeErrors", () => { const zosmfRestClient = new ZosmfRestClient(new Session({ hostname: "dummy", type: SessConstants.AUTH_TYPE_BASIC, @@ -129,23 +106,6 @@ describe("ZosmfRestClient tests", () => { }); it("should handle error for token auth", () => { - const zosmfRestClient = new ZosmfRestClient(new Session({ - hostname: "dummy", - type: SessConstants.AUTH_TYPE_TOKEN, - tokenType: SessConstants.TOKEN_TYPE_JWT, - tokenValue: "fakeToken" - })); - (zosmfRestClient as any).mResponse = { - statusCode: RestConstants.HTTP_STATUS_401 - }; - const error: IImperativeError = { msg: "hello" }; - const processedError = ((zosmfRestClient as any).processError(error)); - expect(processedError.msg).toContain("This operation requires authentication."); - expect(processedError.additionalDetails).toContain("Token is not valid or expired."); - }); - - it("should handle error for token auth using V3_ERR_FORMAT", () => { - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(true); const zosmfRestClient = new ZosmfRestClient(new Session({ hostname: "dummy", type: SessConstants.AUTH_TYPE_TOKEN, @@ -167,23 +127,6 @@ describe("ZosmfRestClient tests", () => { }); it("should handle error for APIML token auth and missing base path", () => { - const zosmfRestClient = new ZosmfRestClient(new Session({ - hostname: "dummy", - type: SessConstants.AUTH_TYPE_TOKEN, - tokenType: SessConstants.TOKEN_TYPE_APIML, - tokenValue: "fakeToken" - })); - (zosmfRestClient as any).mResponse = { - statusCode: RestConstants.HTTP_STATUS_401 - }; - const error: IImperativeError = { msg: "hello" }; - const processedError = ((zosmfRestClient as any).processError(error)); - expect(processedError.msg).toContain("This operation requires authentication."); - expect(processedError.additionalDetails).not.toContain("Token is not valid or expired."); - }); - - it("should handle error for APIML token auth and missing base path using V3_ERR_FORMAT", () => { - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(true); const zosmfRestClient = new ZosmfRestClient(new Session({ hostname: "dummy", type: SessConstants.AUTH_TYPE_TOKEN, @@ -204,23 +147,6 @@ describe("ZosmfRestClient tests", () => { }); it("should handle error for cert auth", () => { - const zosmfRestClient = new ZosmfRestClient(new Session({ - hostname: "dummy", - type: SessConstants.AUTH_TYPE_CERT_PEM, - cert: "fakeCert", - certKey: "fakeKey" - })); - (zosmfRestClient as any).mResponse = { - statusCode: RestConstants.HTTP_STATUS_401 - }; - const error: IImperativeError = { msg: "hello" }; - const processedError = ((zosmfRestClient as any).processError(error)); - expect(processedError.msg).toContain("This operation requires authentication."); - expect(processedError.additionalDetails).toContain("Certificate is not valid or expired."); - }); - - it("should handle error for cert auth using V3_ERR_FORMAT", () => { - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(true); const zosmfRestClient = new ZosmfRestClient(new Session({ hostname: "dummy", type: SessConstants.AUTH_TYPE_CERT_PEM, diff --git a/packages/core/src/rest/ZosmfRestClient.ts b/packages/core/src/rest/ZosmfRestClient.ts index 03dc9c84b5..b358aed26e 100644 --- a/packages/core/src/rest/ZosmfRestClient.ts +++ b/packages/core/src/rest/ZosmfRestClient.ts @@ -10,7 +10,7 @@ */ import { - IImperativeError, Logger, NextVerFeatures, RestClient, TextUtils, + IImperativeError, Logger, RestClient, RestConstants, SessConstants } from "@zowe/imperative"; import { ZosmfHeaders } from "./ZosmfHeaders"; @@ -70,10 +70,8 @@ export class ZosmfRestClient extends RestClient { " Here is the full error before deleting the stack:\n%s", JSON.stringify(causeErrorsJson)); this.log.error("The stack has been deleted from the error before displaying the error to the user"); delete causeErrorsJson.stack; // remove the stack field + original.causeErrors = JSON.stringify(causeErrorsJson, null); } - - // if we didn't get an error, make the parsed causeErrorsString part of the error - causeErrorsString = TextUtils.prettyJson(causeErrorsJson, undefined, false); } } catch (e) { // if there's an error, the causeErrors text is not JSON @@ -97,8 +95,8 @@ export class ZosmfRestClient extends RestClient { if (this.response && this.response.statusCode === RestConstants.HTTP_STATUS_401) { if (!original.causeErrors || Object.keys(original.causeErrors ).length === 0) { /* We have no causeErrors, so place the original msg we got for a 401 - * into the 'response from service' part of our error. - */ + * into the 'response from service' part of our error. + */ original.causeErrors = `{"Error": "${origMsgFor401}"}`; } original.msg += "\nThis operation requires authentication."; diff --git a/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts b/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts index 4266a72a78..b5b3e44b10 100644 --- a/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts +++ b/packages/imperative/src/cmd/__tests__/CommandProcessor.unit.test.ts @@ -24,7 +24,7 @@ import { CliUtils } from "../../utilities/src/CliUtils"; import { WebHelpManager } from "../src/help/WebHelpManager"; import { ImperativeConfig } from "../../utilities/src/ImperativeConfig"; import { setupConfigToLoad } from "../../../__tests__/src/TestUtil"; -import { EnvFileUtils, NextVerFeatures } from "../../utilities"; +import { EnvFileUtils } from "../../utilities"; import { join } from "path"; jest.mock("../src/syntax/SyntaxValidator"); @@ -1186,56 +1186,7 @@ describe("Command Processor", () => { expect(commandResponse.error?.additionalDetails).toEqual("More details!"); }); - it("should handle an imperative error thrown from the handler", async () => { - // Allocate the command processor - const processor: CommandProcessor = new CommandProcessor({ - envVariablePrefix: ENV_VAR_PREFIX, - fullDefinition: SAMPLE_COMPLEX_COMMAND, - definition: SAMPLE_COMMAND_REAL_HANDLER, - helpGenerator: FAKE_HELP_GENERATOR, - profileManagerFactory: FAKE_PROFILE_MANAGER_FACTORY, - rootCommandName: SAMPLE_ROOT_COMMAND, - commandLine: "", - promptPhrase: "dummydummy" - }); - - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - - const parms: any = { - arguments: { - _: ["check", "for", "banana"], - $0: "", - valid: true, - throwImperative: true - }, - responseFormat: "json", - silent: true - }; - const commandResponse: ICommandResponse = await processor.invoke(parms); - expect(commandResponse).toBeDefined(); - const stderrText = (commandResponse.stderr as Buffer).toString(); - expect(stderrText).toContain("Handler threw an imperative error!"); - expect(stderrText).toContain("More details!"); - expect(commandResponse.message).toEqual("Handler threw an imperative error!"); - expect(commandResponse.error?.msg).toEqual("Handler threw an imperative error!"); - expect(commandResponse.error?.additionalDetails).toEqual("More details!"); - }); - - it("should handle an imperative error with JSON causeErrors using v3-format message", async () => { - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(true); - + it("should handle an imperative error with JSON causeErrors", async () => { // Allocate the command processor const processor: CommandProcessor = new CommandProcessor({ envVariablePrefix: ENV_VAR_PREFIX, @@ -1286,9 +1237,7 @@ describe("Command Processor", () => { expect(commandResponse.error?.additionalDetails).toEqual("More details!"); }); - it("should handle an imperative error with string causeErrors using v3-format message", async () => { - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(true); - + it("should handle an imperative error with string causeErrors", async () => { // Allocate the command processor const processor: CommandProcessor = new CommandProcessor({ envVariablePrefix: ENV_VAR_PREFIX, @@ -1442,57 +1391,6 @@ describe("Command Processor", () => { expect(commandResponse.error?.additionalDetails).not.toBeDefined(); }); - it("should handle a handler-error with a v3-format message", async () => { - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(true); - - // Allocate the command processor - const processor: CommandProcessor = new CommandProcessor({ - envVariablePrefix: ENV_VAR_PREFIX, - fullDefinition: SAMPLE_COMPLEX_COMMAND, - definition: SAMPLE_COMMAND_REAL_HANDLER, - helpGenerator: FAKE_HELP_GENERATOR, - profileManagerFactory: FAKE_PROFILE_MANAGER_FACTORY, - rootCommandName: SAMPLE_ROOT_COMMAND, - commandLine: "", - promptPhrase: "dummydummy" - }); - - // Mock read stdin - (SharedOptions.readStdinIfRequested as any) = jest.fn((args, response, type) => { - // Nothing to do - }); - - // Mock the profile loader - (CommandProfileLoader.loader as any) = jest.fn((args) => { - return { - loadProfiles: (profArgs: any) => { - // Nothing to do - } - }; - }); - - const parms: any = { - arguments: { - _: ["check", "for", "banana"], - $0: "", - valid: true, - rejectWithMessage: true - }, - responseFormat: "json", - silent: true - }; - const commandResponse: ICommandResponse = await processor.invoke(parms); - expect(commandResponse).toBeDefined(); - const stderrText = (commandResponse.stderr as Buffer).toString(); - expect(stderrText).toContain("Command Error:"); - expect(stderrText).toContain("Rejected with a message"); - expect(commandResponse.success).toEqual(false); - expect(commandResponse.exitCode).toEqual(1); - expect(commandResponse.message).toEqual("Rejected with a message"); - expect(commandResponse.error?.msg).toEqual("Rejected with a message"); - expect(commandResponse.error?.additionalDetails).not.toBeDefined(); - }); - it("should handle the handler rejecting with no messages", async () => { // Allocate the command processor const processor: CommandProcessor = new CommandProcessor({ diff --git a/packages/imperative/src/cmd/src/CommandProcessor.ts b/packages/imperative/src/cmd/src/CommandProcessor.ts index 872b711e05..d409951b4b 100644 --- a/packages/imperative/src/cmd/src/CommandProcessor.ts +++ b/packages/imperative/src/cmd/src/CommandProcessor.ts @@ -30,7 +30,7 @@ import { IInvokeCommandParms } from "./doc/parms/IInvokeCommandParms"; import { ICommandProcessorParms } from "./doc/processor/ICommandProcessorParms"; import { ImperativeExpect } from "../../expect"; import { inspect } from "util"; -import { EnvFileUtils, ImperativeConfig, NextVerFeatures, TextUtils } from "../../utilities"; +import { EnvFileUtils, ImperativeConfig, TextUtils } from "../../utilities"; import * as nodePath from "path"; import * as os from "os"; import * as stream from "stream"; diff --git a/packages/imperative/src/imperative/__tests__/config/cmd/import/import.handler.unit.test.ts b/packages/imperative/src/imperative/__tests__/config/cmd/import/import.handler.unit.test.ts index 96b0e17491..671bab25e8 100644 --- a/packages/imperative/src/imperative/__tests__/config/cmd/import/import.handler.unit.test.ts +++ b/packages/imperative/src/imperative/__tests__/config/cmd/import/import.handler.unit.test.ts @@ -21,7 +21,6 @@ import { ISession, RestClient } from "../../../../../rest"; import { ImperativeConfig } from "../../../../.."; import { expectedConfigObject, expectedSchemaObject } from "../../../../../../__tests__/__integration__/imperative/__tests__/__integration__/cli/config/__resources__/expectedObjects"; -import { NextVerFeatures } from "../../../../../utilities"; jest.mock("fs"); @@ -60,12 +59,6 @@ const getIHandlerParametersObject = (): IHandlerParameters => { }; describe("Configuration Import command handler", () => { - beforeEach(() => { - /* This avoids having to mock ImperativeConfig.envVariablePrefix. - * Unless overridden, tests will use our legacy format for errors. - */ - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false); - }); describe("handler", () => { const readFileSyncSpy = jest.spyOn(fs, "readFileSync"); diff --git a/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts b/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts index 7b0f03c16c..c97fad3d7d 100644 --- a/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts +++ b/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts @@ -14,7 +14,7 @@ import * as http from "http"; import { Session } from "../../src/session/Session"; import { RestClient } from "../../src/client/RestClient"; import { Headers } from "../../src/client/Headers"; -import { NextVerFeatures, ProcessUtils } from "../../../utilities"; +import { ProcessUtils } from "../../../utilities"; import { MockHttpRequestResponse } from "./__model__/MockHttpRequestResponse"; import { EventEmitter } from "events"; import { ImperativeError } from "../../../error"; @@ -35,13 +35,6 @@ import { IO } from "../../../io"; describe("AbstractRestClient tests", () => { - beforeEach(() => { - /* This avoids having to mock ImperativeConfig.envVariablePrefix. - * Unless overridden, tests will use our legacy format for errors. - */ - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false); - }); - it("should not append any headers to a request by default", () => { const client = new RestClient(new Session({hostname: "test"})); expect((client as any).appendHeaders(["Test"])).toMatchSnapshot(); @@ -118,61 +111,6 @@ describe("AbstractRestClient tests", () => { }); it("should error with request rejection when status code is not in 200 range", async () => { - - interface IResponseload { - newData: string; - } - - const emitter = new MockHttpRequestResponse(); - const requestFnc = jest.fn((options, callback) => { - ProcessUtils.nextTick(async () => { - - const newEmit = new MockHttpRequestResponse(); - newEmit.statusCode = "400"; - callback(newEmit); - - await ProcessUtils.nextTick(() => { - newEmit.emit("data", Buffer.from("{\"newData\":", "utf8")); - }); - - // missing closing bracket - await ProcessUtils.nextTick(() => { - newEmit.emit("data", Buffer.from("\"response data\"}", "utf8")); - }); - - await ProcessUtils.nextTick(() => { - newEmit.emit("end"); - }); - }); - return emitter; - }); - - (https.request as any) = requestFnc; - const headers: any = [{"My-Header": "value is here"}]; - const payload: any = {"my payload object": "hello"}; - let error; - try { - await RestClient.putExpectJSON(new Session({hostname: "test"}), "/resource", headers, payload); - } catch (thrownError) { - error = thrownError; - } - expect(error instanceof ImperativeError).toBe(true); - expect(error.message).toBe("Rest API failure with HTTP(S) status 400"); - expect(error.errorCode).toBe("400"); - expect(error.causeErrors).toBe("{\"newData\":\"response data\"}"); - for (const header of headers) { - // make sure the error contains the headers that were appended to the request - for (const key of Object.keys(header)) { - expect(error.additionalDetails).toContain(key); - expect(error.additionalDetails).toContain(header[key]); - } - } - expect(error.additionalDetails).toContain("HTTP(S) error status \"400\" received."); - }); - - it("should give a v3-format error when status code is not in 200 range", async () => { - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(true); - interface IResponseload { newData: string; } diff --git a/packages/imperative/src/rest/__tests__/client/RestClient.unit.test.ts b/packages/imperative/src/rest/__tests__/client/RestClient.unit.test.ts index e322b51fb5..251b959a85 100644 --- a/packages/imperative/src/rest/__tests__/client/RestClient.unit.test.ts +++ b/packages/imperative/src/rest/__tests__/client/RestClient.unit.test.ts @@ -14,7 +14,7 @@ import * as path from "path"; import * as https from "https"; import { Session } from "../../src/session/Session"; import { EventEmitter } from "events"; -import { NextVerFeatures, ProcessUtils } from "../../../utilities"; +import { ProcessUtils } from "../../../utilities"; import { MockHttpRequestResponse } from "./__model__/MockHttpRequestResponse"; import { CustomRestClient } from "./__model__/CustomRestClient"; import { CustomRestClientWithProcessError, EXPECTED_REST_ERROR } from "./__model__/CustomRestClientWithProcessError"; @@ -32,11 +32,6 @@ import { CLIENT_PROPERTY } from "../../src/client/types/AbstractRestClientProper describe("RestClient tests", () => { beforeEach(() => { jest.clearAllMocks(); - - /* This avoids having to mock ImperativeConfig.envVariablePrefix. - * Unless overridden, tests will use our legacy format for errors. - */ - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false); }); it("should add our custom header", async () => { diff --git a/packages/imperative/src/rest/src/client/AbstractRestClient.ts b/packages/imperative/src/rest/src/client/AbstractRestClient.ts index 3bfdf140cf..db962b2ed0 100644 --- a/packages/imperative/src/rest/src/client/AbstractRestClient.ts +++ b/packages/imperative/src/rest/src/client/AbstractRestClient.ts @@ -29,7 +29,7 @@ import { RestClientError } from "./RestClientError"; import { Readable, Writable } from "stream"; import { IO } from "../../../io"; import { ITaskWithStatus, TaskProgress, TaskStage } from "../../../operations"; -import { NextVerFeatures, TextUtils } from "../../../utilities"; +import { TextUtils } from "../../../utilities"; import { IRestOptions } from "./doc/IRestOptions"; import * as SessConstants from "../session/SessConstants"; import { CompressionUtils } from "./CompressionUtils"; diff --git a/packages/imperative/src/utilities/__tests__/NextVerFeatures.unit.test.ts b/packages/imperative/src/utilities/__tests__/NextVerFeatures.unit.test.ts deleted file mode 100644 index 9406008fdd..0000000000 --- a/packages/imperative/src/utilities/__tests__/NextVerFeatures.unit.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -import { ImperativeConfig } from "../src/ImperativeConfig"; -import { NextVerFeatures } from "../src/NextVerFeatures"; - -describe("NextVerFeatures", () => { - const impCfg: ImperativeConfig = ImperativeConfig.instance; - - beforeAll(() => { - // impCfg.getCliCmdName is a getter of a property, so mock the property - Object.defineProperty(impCfg, "envVariablePrefix", { - configurable: true, - get: jest.fn(() => { - return "ZOWE"; - }) - }); - }); - - describe("useV3ErrFormat", () => { - - it("should return false when environment variable is not set", () => { - delete process.env.ZOWE_V3_ERR_FORMAT; - expect(NextVerFeatures.useV3ErrFormat()).toBe(false); - }); - - it("should return true when environment variable is set to lowercase true", () => { - process.env.ZOWE_V3_ERR_FORMAT = "true"; - expect(NextVerFeatures.useV3ErrFormat()).toBe(true); - }); - - it("should return true when environment variable is set to uppercase TRUE", () => { - process.env.ZOWE_V3_ERR_FORMAT = "TRUE"; - expect(NextVerFeatures.useV3ErrFormat()).toBe(true); - }); - - it("should return false when environment variable is set to a non-true value", () => { - process.env.ZOWE_V3_ERR_FORMAT = "someGoofyValue"; - expect(NextVerFeatures.useV3ErrFormat()).toBe(false); - }); - }); -}); diff --git a/packages/zosfiles/__tests__/__unit__/methods/upload/Upload.unit.test.ts b/packages/zosfiles/__tests__/__unit__/methods/upload/Upload.unit.test.ts index 58019246af..d8ce8b49a0 100644 --- a/packages/zosfiles/__tests__/__unit__/methods/upload/Upload.unit.test.ts +++ b/packages/zosfiles/__tests__/__unit__/methods/upload/Upload.unit.test.ts @@ -14,7 +14,7 @@ jest.mock("fs"); import * as path from "path"; import * as fs from "fs"; -import { ImperativeError, IO, NextVerFeatures, Session, IHeaderContent } from "@zowe/imperative"; +import { ImperativeError, IO, Session, IHeaderContent } from "@zowe/imperative"; import { ZosmfHeaders, ZosmfRestClient } from "@zowe/core-for-zowe-sdk"; import { IZosFilesResponse } from "../../../../src/doc/IZosFilesResponse"; import { ZosFilesConstants } from "../../../../src/constants/ZosFiles.constants"; @@ -46,13 +46,6 @@ describe("z/OS Files - Upload", () => { let response: IZosFilesResponse; let error: any; - beforeEach(() => { - /* This avoids having to mock ImperativeConfig.envVariablePrefix. - * Unless the choice below is overridden, tests will use our legacy format for errors. - */ - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false); - }); - describe("fileToDataset", () => { const dataSetSpy = jest.spyOn(Upload as any, "pathToDataSet"); const lstatSpy = jest.spyOn(fs, "lstat"); diff --git a/packages/zosjobs/__tests__/__unit__/GetJobs.unit.test.ts b/packages/zosjobs/__tests__/__unit__/GetJobs.unit.test.ts index 9eafefaef3..2ebf1b5837 100644 --- a/packages/zosjobs/__tests__/__unit__/GetJobs.unit.test.ts +++ b/packages/zosjobs/__tests__/__unit__/GetJobs.unit.test.ts @@ -10,7 +10,7 @@ */ import { ZosmfRestClient } from "@zowe/core-for-zowe-sdk"; -import { AbstractSession, ImperativeError, NextVerFeatures, ProcessUtils, Session } from "@zowe/imperative"; +import { AbstractSession, ImperativeError, ProcessUtils, Session } from "@zowe/imperative"; import { GetJobs } from "../../src"; import { GetJobsData } from "../__resources__/api/GetJobsData"; @@ -61,13 +61,6 @@ function mockGetJobsServerError(errorCode: string, causeErrors: string) { describe("GetJobs tests", () => { - beforeEach(() => { - /* This avoids having to mock ImperativeConfig.envVariablePrefix. - * Unless overridden, tests will use our legacy format for errors. - */ - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(false); - }); - describe("getStatus APIs", () => { it("should reject the promise when the server gets an error http code", async () => { @@ -211,20 +204,6 @@ describe("GetJobs tests", () => { }); it("should throw an error if more than one job is returned for a job id", async () => { - (ZosmfRestClient.getExpectJSON as any) = mockGetJobsJSONData([GetJobsData.SAMPLE_COMPLETE_JOB, GetJobsData.SAMPLE_ACTIVE_JOB]); - let err: Error | ImperativeError; - try { - await GetJobs.getJob(pretendSession, GetJobsData.SAMPLE_COMPLETE_JOB.jobid); - } catch (e) { - err = e; - } - expect(err).toBeDefined(); - expect(err instanceof ImperativeError).toEqual(true); - expect(err.message).toMatchSnapshot(); - }); - - it("should throw an error if more than one job is returned for a job id using V3_ERR_FORMAT", async () => { - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(true); (ZosmfRestClient.getExpectJSON as any) = mockGetJobsJSONData([GetJobsData.SAMPLE_COMPLETE_JOB, GetJobsData.SAMPLE_ACTIVE_JOB]); let err: Error | ImperativeError; try { @@ -242,20 +221,6 @@ describe("GetJobs tests", () => { }); it("should throw an error if zero jobs are returned when getting jobs by ID", async () => { - (ZosmfRestClient.getExpectJSON as any) = mockGetJobsJSONData([]); - let err: Error | ImperativeError; - try { - await GetJobs.getJob(pretendSession, GetJobsData.SAMPLE_COMPLETE_JOB.jobid); - } catch (e) { - err = e; - } - expect(err).toBeDefined(); - expect(err instanceof ImperativeError).toEqual(true); - expect(err.message).toMatchSnapshot(); - }); - - it("should throw an error if zero jobs are returned when getting jobs by ID using V3_ERR_FORMAT", async () => { - jest.spyOn(NextVerFeatures, "useV3ErrFormat").mockReturnValue(true); (ZosmfRestClient.getExpectJSON as any) = mockGetJobsJSONData([]); let err: Error | ImperativeError; try { diff --git a/packages/zosjobs/__tests__/__unit__/__snapshots__/GetJobs.unit.test.ts.snap b/packages/zosjobs/__tests__/__unit__/__snapshots__/GetJobs.unit.test.ts.snap index 64bee63eac..1e4c910b24 100644 --- a/packages/zosjobs/__tests__/__unit__/__snapshots__/GetJobs.unit.test.ts.snap +++ b/packages/zosjobs/__tests__/__unit__/__snapshots__/GetJobs.unit.test.ts.snap @@ -441,10 +441,6 @@ exports[`GetJobs tests getJobs APIs should require prefix for getJobsByOwnerAndP exports[`GetJobs tests getJobs APIs should require prefix for getJobsByPrefix 1`] = `"Expect Error: Required parameter 'prefix' must not be blank"`; -exports[`GetJobs tests getJobs APIs should throw an error if more than one job is returned for a job id 1`] = `"Obtaining job info for a single job id TSUxxx on Test:443 failed: Expected 1 job returned but received 2"`; - -exports[`GetJobs tests getJobs APIs should throw an error if zero jobs are returned when getting jobs by ID 1`] = `"Obtaining job info for a single job id TSUxxx on Test:443 failed: Job not found"`; - exports[`GetJobs tests getJobsByParameters should get jobs even when no params are passed in 1`] = ` Array [ Object { diff --git a/packages/zosjobs/src/GetJobs.ts b/packages/zosjobs/src/GetJobs.ts index 2f2975e301..82430748e8 100644 --- a/packages/zosjobs/src/GetJobs.ts +++ b/packages/zosjobs/src/GetJobs.ts @@ -9,7 +9,7 @@ * */ -import { AbstractSession, Headers, ImperativeError, ImperativeExpect, Logger, NextVerFeatures, RestClient } from "@zowe/imperative"; +import { AbstractSession, Headers, ImperativeError, ImperativeExpect, Logger, RestClient } from "@zowe/imperative"; import { JobsConstants } from "./JobsConstants"; import { ZosmfRestClient } from "@zowe/core-for-zowe-sdk"; import { ICommonJobParms, IGetJobsParms, IJob, IJobFile } from "./"; From 3cebcc6550b22defb1bb2e728880726217f500a0 Mon Sep 17 00:00:00 2001 From: Gene Johnston Date: Thu, 9 Nov 2023 12:52:13 -0500 Subject: [PATCH 03/10] Update snapshot for v3 error format Signed-off-by: Gene Johnston --- .../client/__snapshots__/AbstractRestClient.unit.test.ts.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/imperative/src/rest/__tests__/client/__snapshots__/AbstractRestClient.unit.test.ts.snap b/packages/imperative/src/rest/__tests__/client/__snapshots__/AbstractRestClient.unit.test.ts.snap index 99e9fe281e..99a9a8a8e5 100644 --- a/packages/imperative/src/rest/__tests__/client/__snapshots__/AbstractRestClient.unit.test.ts.snap +++ b/packages/imperative/src/rest/__tests__/client/__snapshots__/AbstractRestClient.unit.test.ts.snap @@ -38,7 +38,7 @@ Object { } `; -exports[`AbstractRestClient tests should give an error message when error event is called 1`] = `"http(s) request error event called"`; +exports[`AbstractRestClient tests should give an error message when error event is called 1`] = `"Failed to send an HTTP request."`; exports[`AbstractRestClient tests should give an error when no resource URI is provided 1`] = `"Expect Error: Required parameter 'resource' must not be blank"`; From bb2b79fea1a2a81840e25ed2704252662dbefdef Mon Sep 17 00:00:00 2001 From: Gene Johnston Date: Thu, 9 Nov 2023 14:54:49 -0500 Subject: [PATCH 04/10] Remove scripts related to now-defunct perf-timing Signed-off-by: Gene Johnston --- scripts/performanceAnalysis.js | 85 ---------------------- scripts/performanceTest.js | 128 --------------------------------- 2 files changed, 213 deletions(-) delete mode 100644 scripts/performanceAnalysis.js delete mode 100644 scripts/performanceTest.js diff --git a/scripts/performanceAnalysis.js b/scripts/performanceAnalysis.js deleted file mode 100644 index 875a7b1e82..0000000000 --- a/scripts/performanceAnalysis.js +++ /dev/null @@ -1,85 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -/** - * Read in a directory containing json files of runs of scripts/performanceTest.js - * from different systems, and analyze the results, providing a summary - */ - -const fs = require("fs"); -const {TextUtils} = require("@brightside/imperative"); -const {resolve} = require("path"); -const jsonFilesDirectory = resolve(process.argv[2]); -if (jsonFilesDirectory == null) { - console.error("You must specify a directory containing performance test JSON files as the " + - "first positional argument to this script."); - process.exit(1); -} - -console.log("Analyzing performance test results in the directory '%s'", jsonFilesDirectory); -const filesInDir = fs.readdirSync(jsonFilesDirectory); -const jsonFiles = []; -for (const file of filesInDir) { - if (file.indexOf(".json") >= 0) { - jsonFiles.push(file); - } -} - -const finalResults = {}; - -for (const file of jsonFiles) { - const jsonResult = require(resolve(jsonFilesDirectory + "/" + file)); - for (const result of jsonResult.results) { - if (finalResults[result.label] == null) { - // if this is the first time we've seen this label, initialize the result for the task - finalResults[result.label] = { - longest: -1, - shortest: 99999999999999999999999999999, - numResults: 0, - total: 0, - average: 0 - }; - } - - finalResults[result.label].total += result.elapsedTime; - finalResults[result.label].numResults++; - if (finalResults[result.label].longest < result.elapsedTime) { - finalResults[result.label].longest = result.elapsedTime; - } - if (finalResults[result.label].shortest > result.elapsedTime) { - finalResults[result.label].shortest = result.elapsedTime; - } - } -} - -for (const label of Object.keys(finalResults)) { - finalResults[label].average = (finalResults[label].total / finalResults[label].numResults).toFixed(2); -} - -/** - * Get a report of the results - * - * First, add human-readable keys to the result object - */ -const stringifiedResults = Object.keys(finalResults).map(function (label) { - const result = finalResults[label]; - const newResult = {}; - newResult.Task = label; - newResult["Shortest time (ms)"] = result.shortest; - newResult["Average time (ms)"] = result.average; - newResult["Longest time (ms)"] = result.longest; - newResult["Number of tests"] = result.numResults; - delete newResult.elapsedTime; - return newResult; -}); - -const resultTable = TextUtils.getTable(stringifiedResults, "blue", undefined, undefined, true); -console.log("\n" + resultTable); diff --git a/scripts/performanceTest.js b/scripts/performanceTest.js deleted file mode 100644 index 6925036439..0000000000 --- a/scripts/performanceTest.js +++ /dev/null @@ -1,128 +0,0 @@ -/* -* This program and the accompanying materials are made available under the terms of the -* Eclipse Public License v2.0 which accompanies this distribution, and is available at -* https://www.eclipse.org/legal/epl-v20.html -* -* SPDX-License-Identifier: EPL-2.0 -* -* Copyright Contributors to the Zowe Project. -* -*/ - -const childProcess = require("child_process"); -const moment = require("moment"); -const os = require("os"); -const {IO, TextUtils} = require("@brightside/imperative"); -const fs = require("fs"); -const {resolve, join} = require("path"); - -const tempHomeDir = resolve(__dirname + "/../__tests__/__results__/performance"); -const resultFile = tempHomeDir + "/results.txt"; -IO.createDirsSyncFromFilePath(resultFile); -const resultJSONFile = join(tempHomeDir, `results_${moment().format('x')}.json`); -const packageName = "@brightside/core"; -const binName = "bright"; - -const header = `Performance Tests\nCurrent time ${moment()}\nPlatform '${os.platform()}'. Architecture '${os.arch()}'\n` + - `Total Memory: ${os.totalmem()}. Free memory ${os.freemem()}\n` + - `Number of CPUs ${os.cpus().length}.\n` + - `User name: ${os.userInfo().username}\n`; -console.log(header); -IO.writeFile(resultFile, header); - -const results = []; - -/** - * Set the current home directory - */ -const env = JSON.parse(JSON.stringify(process.env)); // copy the current environmental variables -env.ZOWE_CLI_HOME = tempHomeDir; -deleteHomeDirectory(); -uninstallBrightside(); - -/** - * Execute our list of performance test tasks here - */ -results.push(execTimed(`npm install -g ${packageName}@next`, "Install @next version of Brightside")); -results.push(execTimed(`${binName} --help`, `Issue ${binName} --help (no plugins) `)); -results.push(execTimed(`${binName} profiles list zosmf --rfj`, "List zosmf profiles (no plugins) ")); -results.push(execTimed(`${binName} plugins install @brightside/filemasterplus`, "Install filemaster plugin ")); -results.push(execTimed(`${binName} --help`, `Issue ${binName} --help (1 plugin) `)); -results.push(execTimed(`${binName} plugins install @brightside/endevor`, "Install endevor plugin (with filemaster installed) ")); -results.push(execTimed(`${binName} --help`, `Issue ${binName} --help (2 plugins) `)); -results.push(execTimed(`${binName} profiles list zosmf --rfj`, "List zosmf profiles (2 plugins) ")); - -/** - * Get a report of the results - * - * First, add human-readable keys to the result object - */ -const stringifiedResults = results.map(function (result) { - const newResult = JSON.parse(JSON.stringify(result)); // copy the result before modifying - if (newResult.Passed != null) { - newResult.Passed = newResult.Passed ? TextUtils.chalk.green(":)") : TextUtils.chalk.red("X"); - } - newResult["Elapsed Time (ms)"] = newResult.elapsedTime; - newResult.Task = newResult.label; - delete newResult.label; - delete newResult.elapsedTime; - return newResult; -}); -const resultTable = TextUtils.getTable(stringifiedResults, "blue", undefined, undefined, true); -console.log("\n" + resultTable); -IO.writeFile(resultFile, resultTable); -IO.writeFile(resultJSONFile, JSON.stringify({header, results}, null, 2)); - -/** - * Execute a command synchronously and time how long it takes to execute - * @param command - the command to execute - * @param label - label for the action you are performing with this command - * @param expectedTime - the amount of time in milliseconds you expect this command to take - */ -function execTimed(command, label, expectedTime) { - console.log("Running '%s'\n", command); - const beforeTimeStamp = moment(); - const outputFileName = join(tempHomeDir, "output/" + label + ".txt"); - IO.createDirsSyncFromFilePath(outputFileName); - const outputFileStream = fs.openSync(outputFileName, "w+"); - - childProcess.execSync(command, {env, stdio: ["inherit", outputFileStream, outputFileStream]}); - const afterTimeStamp = moment(); - const elapsedTime = afterTimeStamp.diff(beforeTimeStamp); - let timeGreaterThanExpected = undefined; - const result = {label, elapsedTime}; - if (expectedTime != null) { - timeGreaterThanExpected = elapsedTime > expectedTime; - if (timeGreaterThanExpected) { - result.Passed = false; - } else if (timeGreaterThanExpected === false) { - // don't set timeGreaterThanExpected if there's no expected time - result.Passed = true; - } - } - - return result; -} - -/** - * Delete the temporary brightside home directory - */ -function deleteHomeDirectory() { - console.log("Deleting %s...", tempHomeDir); - try { - require("rimraf").sync(tempHomeDir); - } catch (rimrafError) { - throw new Error("Failed to delete " + tempHomeDir + ". Rimraf error:" + rimrafError); - } -} - -function uninstallBrightside() { - console.log("Uninstalling %s before global install\n", packageName); - const outputFileName = join(tempHomeDir, "output/uninstall.txt"); - IO.createDirsSyncFromFilePath(outputFileName); - const outputFileStream = fs.openSync(outputFileName, "w+"); - childProcess.execSync(`npm uninstall -g ${packageName}`, { - env, - stdio: ["inherit", outputFileStream, outputFileStream] - }); -} From e57c83b65ee4791b541cb5cb7592bab47ddec313 Mon Sep 17 00:00:00 2001 From: Gene Johnston Date: Thu, 9 Nov 2023 15:41:06 -0500 Subject: [PATCH 05/10] Remove reference to bright and brightside Signed-off-by: Gene Johnston --- .../logging/LoggingCredentials.system.test.ts | 4 ++-- npm-shrinkwrap.json | 1 - ...test.ts => ZoweHelpTests.integration.test.ts} | 0 ...ap => ZoweHelpTests.integration.test.ts.snap} | 0 packages/cli/package.json | 1 - packages/cli/scripts/validatePlugins.js | 4 ++-- packages/core/src/rest/ZosmfRestClient.ts | 2 +- .../imperative/src/cmd/src/CommandProcessor.ts | 4 ++-- .../src/cmd/src/doc/ICommandDefinition.ts | 2 +- .../src/cmd/src/doc/handler/ICommandHandler.ts | 4 ++-- .../src/cmd/src/syntax/SyntaxValidator.ts | 6 +++--- .../src/cmd/src/utils/SharedOptions.ts | 2 +- .../src/cmd/src/yargs/AbstractCommandYargs.ts | 16 ++++++++-------- .../imperative/src/cmd/src/yargs/CommandYargs.ts | 14 +++++++------- .../imperative/src/cmd/src/yargs/YargsDefiner.ts | 2 +- .../src/cmd/src/yargs/doc/IYargsResponse.ts | 2 +- .../handlers/ListProfilesHandler.unit.test.ts | 2 +- .../src/plugins/PluginManagementFacility.ts | 2 +- .../profiles/builders/ProfilesCommandBuilder.ts | 2 +- .../profiles/handlers/ValidateProfileHandler.ts | 2 +- packages/imperative/src/logger/src/Logger.ts | 2 +- .../src/validation/api/ProfileValidator.ts | 4 ++-- .../__system__/SubmitJobs.system.test.ts | 2 +- packages/zosjobs/src/CancelJobs.ts | 2 +- packages/zosjobs/src/DeleteJobs.ts | 2 +- packages/zosjobs/src/DownloadJobs.ts | 2 +- packages/zosjobs/src/MonitorJobs.ts | 2 +- packages/zosjobs/src/SubmitJobs.ts | 2 +- packages/zosmf/src/ZosmfSession.ts | 2 +- packages/zosuss/src/SshSession.ts | 2 +- 30 files changed, 46 insertions(+), 48 deletions(-) rename packages/cli/__tests__/help/__integration__/{BrightHelpTests.integration.test.ts => ZoweHelpTests.integration.test.ts} (100%) rename packages/cli/__tests__/help/__integration__/__snapshots__/{BrightHelpTests.integration.test.ts.snap => ZoweHelpTests.integration.test.ts.snap} (100%) diff --git a/__tests__/__system__/cli/logging/LoggingCredentials.system.test.ts b/__tests__/__system__/cli/logging/LoggingCredentials.system.test.ts index 48c38cff51..a9ad2c6d4f 100644 --- a/__tests__/__system__/cli/logging/LoggingCredentials.system.test.ts +++ b/__tests__/__system__/cli/logging/LoggingCredentials.system.test.ts @@ -53,7 +53,7 @@ describe("Zowe CLI Logging", () => { expect(imperativeLogContents.indexOf(zosmfPassword)).not.toBeGreaterThanOrEqual(0); expect(imperativeLogContents.indexOf(encodedAuth)).not.toBeGreaterThanOrEqual(0); - // ensure that the password and encoded auth does not appear in the brightside log + // ensure that the password and encoded auth does not appear in the Zowe log expect(zoweLogContents.indexOf(zosmfPassword)).not.toBeGreaterThanOrEqual(0); expect(zoweLogContents.indexOf(encodedAuth)).not.toBeGreaterThanOrEqual(0); }); @@ -83,7 +83,7 @@ describe("Zowe CLI Logging", () => { expect(imperativeLogContents.indexOf(zosmfPassword)).not.toBeGreaterThanOrEqual(0); expect(imperativeLogContents.indexOf(encodedAuth)).not.toBeGreaterThanOrEqual(0); - // ensure that the password and encoded auth does not appear in the brightside log + // ensure that the password and encoded auth does not appear in the Zowe log expect(zoweLogContents.indexOf(zosmfPassword)).not.toBeGreaterThanOrEqual(0); expect(zoweLogContents.indexOf(encodedAuth)).not.toBeGreaterThanOrEqual(0); }); diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index db323efbc9..ec588d52ef 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -26279,7 +26279,6 @@ "tar": "6.1.14" }, "bin": { - "bright": "lib/main.js", "zowe": "lib/main.js" }, "devDependencies": { diff --git a/packages/cli/__tests__/help/__integration__/BrightHelpTests.integration.test.ts b/packages/cli/__tests__/help/__integration__/ZoweHelpTests.integration.test.ts similarity index 100% rename from packages/cli/__tests__/help/__integration__/BrightHelpTests.integration.test.ts rename to packages/cli/__tests__/help/__integration__/ZoweHelpTests.integration.test.ts diff --git a/packages/cli/__tests__/help/__integration__/__snapshots__/BrightHelpTests.integration.test.ts.snap b/packages/cli/__tests__/help/__integration__/__snapshots__/ZoweHelpTests.integration.test.ts.snap similarity index 100% rename from packages/cli/__tests__/help/__integration__/__snapshots__/BrightHelpTests.integration.test.ts.snap rename to packages/cli/__tests__/help/__integration__/__snapshots__/ZoweHelpTests.integration.test.ts.snap diff --git a/packages/cli/package.json b/packages/cli/package.json index 1464c7dd6b..ec6e3e4165 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -13,7 +13,6 @@ "url": "https://github.com/zowe/zowe-cli.git" }, "bin": { - "bright": "./lib/main.js", "zowe": "./lib/main.js" }, "keywords": [ diff --git a/packages/cli/scripts/validatePlugins.js b/packages/cli/scripts/validatePlugins.js index 4fe0a6046c..f0751fe475 100644 --- a/packages/cli/scripts/validatePlugins.js +++ b/packages/cli/scripts/validatePlugins.js @@ -10,8 +10,8 @@ */ /* Validate any existing plugins. We do this when the user has re-installed - * brightside. It is a safety net to validate whether any existing plugins - * are incompatible with newly installed brightside/imperative. + * Zowe. It is a safety net to validate whether any existing plugins + * are incompatible with newly installed Zowe. * * This script is run in our package.json:scripts:postinstall as: * node ./scripts/validatePlugins.js diff --git a/packages/core/src/rest/ZosmfRestClient.ts b/packages/core/src/rest/ZosmfRestClient.ts index b358aed26e..aa5d8ae2e5 100644 --- a/packages/core/src/rest/ZosmfRestClient.ts +++ b/packages/core/src/rest/ZosmfRestClient.ts @@ -25,7 +25,7 @@ import { ZosmfHeaders } from "./ZosmfHeaders"; export class ZosmfRestClient extends RestClient { /** - * Use the Brightside logger instead of the imperative logger + * Use the Zowe logger instead of the imperative logger * @type {Logger} */ public get log(): Logger { diff --git a/packages/imperative/src/cmd/src/CommandProcessor.ts b/packages/imperative/src/cmd/src/CommandProcessor.ts index d409951b4b..9a0166f37e 100644 --- a/packages/imperative/src/cmd/src/CommandProcessor.ts +++ b/packages/imperative/src/cmd/src/CommandProcessor.ts @@ -295,7 +295,7 @@ export class CommandProcessor { /** * Obtain a copy of the command definition - * @return {ICommandDefinition}: The Bright Commands definition document. + * @return {ICommandDefinition}: The Zowe Commands definition document. */ get definition(): ICommandDefinition { return JSON.parse(JSON.stringify(this.mDefinition)); @@ -303,7 +303,7 @@ export class CommandProcessor { /** * Obtain a copy of the command definition - * @return {ICommandDefinition}: The Bright Commands definition document. + * @return {ICommandDefinition}: The Zowe Commands definition document. */ get fullDefinition(): ICommandDefinition { return JSON.parse(JSON.stringify(this.mFullDefinition)); diff --git a/packages/imperative/src/cmd/src/doc/ICommandDefinition.ts b/packages/imperative/src/cmd/src/doc/ICommandDefinition.ts index 3343e1cb74..3d8294934d 100644 --- a/packages/imperative/src/cmd/src/doc/ICommandDefinition.ts +++ b/packages/imperative/src/cmd/src/doc/ICommandDefinition.ts @@ -119,7 +119,7 @@ export interface ICommandDefinition { chainedHandlers?: IChainedHandlerEntry[]; /** * The Children for this command - used when the type is provider or group. Use the children to build complex - * nested syntaxes - however bright modules must follow the prescribed command syntax structure for Brightside. + * nested syntaxes - however Zowe modules must follow the prescribed command syntax structure for Zowe. * @type {ICommandDefinition[]} * @memberof ICommandDefinition */ diff --git a/packages/imperative/src/cmd/src/doc/handler/ICommandHandler.ts b/packages/imperative/src/cmd/src/doc/handler/ICommandHandler.ts index 00c6b16599..c7bc1c7573 100644 --- a/packages/imperative/src/cmd/src/doc/handler/ICommandHandler.ts +++ b/packages/imperative/src/cmd/src/doc/handler/ICommandHandler.ts @@ -10,10 +10,10 @@ */ /** - * Brightside command handlers must implement this interface. + * Zowe command handlers must implement this interface. * * !!!Note: Handlers must "export" the module name via "module.exports=" for the handler to be - * instantiated correctly by the bright command processor. + * instantiated correctly by the Zowe command processor. */ import { IHandlerParameters } from "./IHandlerParameters"; diff --git a/packages/imperative/src/cmd/src/syntax/SyntaxValidator.ts b/packages/imperative/src/cmd/src/syntax/SyntaxValidator.ts index 69ecfc83ac..56c1c8db3f 100644 --- a/packages/imperative/src/cmd/src/syntax/SyntaxValidator.ts +++ b/packages/imperative/src/cmd/src/syntax/SyntaxValidator.ts @@ -122,7 +122,7 @@ export class SyntaxValidator { /** * Prevent empty string options, regardless of if they are - * required or not e.g. --bright-zosmf-profile (without a value) + * required or not e.g. --zosmf-profile (without a value) */ if (!isNullOrUndefined(this.mCommandDefinition.options)) { for (const option of this.mCommandDefinition.options) { @@ -1033,8 +1033,8 @@ export class SyntaxValidator { } /** - * Append the validator error to the resposne object. - * @param {CommandResponse} responseObject: The Brightside response object + * Append the validator error to the response object. + * @param {CommandResponse} responseObject: The Zowe response object * @param {ICommandValidatorError} error: The error to append. */ private appendValidatorError(responseObject: CommandResponse, error: ICommandValidatorError) { diff --git a/packages/imperative/src/cmd/src/utils/SharedOptions.ts b/packages/imperative/src/cmd/src/utils/SharedOptions.ts index 8ef5b81ff5..0ac8ca54ca 100644 --- a/packages/imperative/src/cmd/src/utils/SharedOptions.ts +++ b/packages/imperative/src/cmd/src/utils/SharedOptions.ts @@ -18,7 +18,7 @@ import { CommandResponse } from "../response/CommandResponse"; import { Logger } from "../../../logger"; /** - * Options which can be reused between different Brightside commands + * Options which can be reused between different Zowe commands */ export class SharedOptions { /** diff --git a/packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts b/packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts index 18cf7ab4d6..60c19b7059 100644 --- a/packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts +++ b/packages/imperative/src/cmd/src/yargs/AbstractCommandYargs.ts @@ -33,7 +33,7 @@ import { ImperativeConfig } from "../../../utilities/src/ImperativeConfig"; export type YargsCommandCompleted = (args: Arguments, response: IYargsResponse) => void; /** - * Abstract Yargs Bright Command - Contains base methods for defining commands and groups + * Abstract Yargs Zowe Command - Contains base methods for defining commands and groups */ export abstract class AbstractCommandYargs { /** @@ -226,7 +226,7 @@ export abstract class AbstractCommandYargs { } /** - * Construct the Bright command definition "tree" - the full definition document including all parents. + * Construct the Zowe command definition "tree" - the full definition document including all parents. * @return {ICommandDefinition}: The command definition "tree". */ public constructDefinitionTree(): ICommandDefinition { @@ -241,14 +241,14 @@ export abstract class AbstractCommandYargs { public abstract defineCommandToYargs(commandExecuted: YargsCommandCompleted): void; /** - * Build The Bright Yargs response for the callback. Includes the Bright command response and status info. + * Build The Zowe Yargs response for the callback. Includes the Zowe command response and status info. * @param {boolean} successful: True if the command succeeded * @param {string} responseMessage: Response message for display purposes. * @param {ImperativeYargsCommandAction} action * @param {ICommandResponse[]} responses * @return {IYargsResponse} */ - protected getBrightYargsResponse(successful: boolean, responseMessage: string, + protected getZoweYargsResponse(successful: boolean, responseMessage: string, action: ImperativeYargsCommandAction, responses?: ICommandResponse[]): IYargsResponse { let exitCode: number; @@ -309,7 +309,7 @@ export abstract class AbstractCommandYargs { stream: ImperativeConfig.instance.daemonContext?.stream })); } catch (helpErr) { - const errorResponse: IYargsResponse = this.getBrightYargsResponse(false, + const errorResponse: IYargsResponse = this.getZoweYargsResponse(false, `The help for ${this.definition.name} was invoked and failed.`, "help invoked"); errorResponse.causeErrors = helpErr; @@ -318,7 +318,7 @@ export abstract class AbstractCommandYargs { } if (!invoked) { - commandExecuted(args, this.getBrightYargsResponse(true, + commandExecuted(args, this.getZoweYargsResponse(true, `The help for ${this.definition.name} was invoked.`, "help invoked", [response])); } @@ -423,7 +423,7 @@ export abstract class AbstractCommandYargs { }) ); } catch (helpErr) { - const errorResponse: IYargsResponse = this.getBrightYargsResponse(false, + const errorResponse: IYargsResponse = this.getZoweYargsResponse(false, `The web help for ${this.definition.name} was invoked and failed.`, "help invoked"); errorResponse.causeErrors = helpErr; @@ -432,7 +432,7 @@ export abstract class AbstractCommandYargs { } if (!invoked) { - commandExecuted(args, this.getBrightYargsResponse(true, + commandExecuted(args, this.getZoweYargsResponse(true, `The web help for ${this.definition.name} was invoked.`, "help invoked", [response])); } diff --git a/packages/imperative/src/cmd/src/yargs/CommandYargs.ts b/packages/imperative/src/cmd/src/yargs/CommandYargs.ts index 0ce2044268..e2481afdda 100644 --- a/packages/imperative/src/cmd/src/yargs/CommandYargs.ts +++ b/packages/imperative/src/cmd/src/yargs/CommandYargs.ts @@ -29,11 +29,11 @@ export class CommandYargs extends AbstractCommandYargs { /** * Define the options to Yargs. * @param {yargs.Argv} yargsInstance: The instance of yargs to define the options. - * @param {ICommandOptionDefinition[]} brightOptions: The option definition document array. + * @param {ICommandOptionDefinition[]} zoweOptions: The option definition document array. */ - public static defineOptionsToYargs(yargsInstance: Argv, brightOptions: ICommandOptionDefinition[]): void { - if (!isNullOrUndefined(brightOptions)) { - for (const option of brightOptions) { + public static defineOptionsToYargs(yargsInstance: Argv, zoweOptions: ICommandOptionDefinition[]): void { + if (!isNullOrUndefined(zoweOptions)) { + for (const option of zoweOptions) { const definition: Options = { alias: option.aliases, description: option.description @@ -137,13 +137,13 @@ export class CommandYargs extends AbstractCommandYargs { */ this.invokeHandlers(handlerDefinition, 0, argsForHandler, responses) .then((successResponses) => { - commandExecuted(argsForHandler, this.getBrightYargsResponse(true, + commandExecuted(argsForHandler, this.getZoweYargsResponse(true, `${successResponses.length} command handlers invoked.`, "command handler invoked", successResponses)); }) .catch((errorResponses) => { - const response: IYargsResponse = this.getBrightYargsResponse(false, + const response: IYargsResponse = this.getZoweYargsResponse(false, `Error in command ${this.definition.name}`, "command handler invoked", errorResponses); this.log.error(`Error in command ${this.definition.name}`); @@ -155,7 +155,7 @@ export class CommandYargs extends AbstractCommandYargs { * No handlers were present - Respond with an error - this condition should not occur if the * definition was validated against the schema. */ - const response: IYargsResponse = this.getBrightYargsResponse(false, + const response: IYargsResponse = this.getZoweYargsResponse(false, `No handlers provided for ${this.definition.name}`, "command handler invoked"); commandExecuted(argsForHandler, response); diff --git a/packages/imperative/src/cmd/src/yargs/YargsDefiner.ts b/packages/imperative/src/cmd/src/yargs/YargsDefiner.ts index f161e638d8..ae850eee1a 100644 --- a/packages/imperative/src/cmd/src/yargs/YargsDefiner.ts +++ b/packages/imperative/src/cmd/src/yargs/YargsDefiner.ts @@ -47,7 +47,7 @@ export class YargsDefiner { * Build the definer - maintains the Yargs instance for all future definitions. * @param {yargs.Argv} yargsInstance: The Yargs instance used to define the commands. * @param primaryHighlightColor - main color to highlight help text headings and other text with - * @param rootCommandName - the display name of the root command (e.g. "bright" or "sample-cli") + * @param rootCommandName - the display name of the root command (e.g. "zowe" or "sample-cli") * @param envVariablePrefix - the environment variable prefix * @param profileManagerFactory - profile manager factory that can be used to instantiate new profile managers * @param helpGeneratorFactory - help generator factory that can be used to instantiate new help generators diff --git a/packages/imperative/src/cmd/src/yargs/doc/IYargsResponse.ts b/packages/imperative/src/cmd/src/yargs/doc/IYargsResponse.ts index f9e027376f..6d3337007f 100644 --- a/packages/imperative/src/cmd/src/yargs/doc/IYargsResponse.ts +++ b/packages/imperative/src/cmd/src/yargs/doc/IYargsResponse.ts @@ -16,7 +16,7 @@ import { ICommandResponse } from "../../../src/doc/response/response/ICommandRes export type ImperativeYargsCommandAction = "syntax validation" | "command handler invoked" | "help invoked"; /** - * The Yargs response is provided on the callback for a command definition defined through the Brightside + * The Yargs response is provided on the callback for a command definition defined through the Zowe * Yargs definer - when an execution of that command is complete - this response will be given to the callback. */ export interface IYargsResponse { diff --git a/packages/imperative/src/imperative/__tests__/profiles/handlers/ListProfilesHandler.unit.test.ts b/packages/imperative/src/imperative/__tests__/profiles/handlers/ListProfilesHandler.unit.test.ts index aafda9c915..e5fcc985b1 100644 --- a/packages/imperative/src/imperative/__tests__/profiles/handlers/ListProfilesHandler.unit.test.ts +++ b/packages/imperative/src/imperative/__tests__/profiles/handlers/ListProfilesHandler.unit.test.ts @@ -81,7 +81,7 @@ const MockedImperativeAPIError = { // "Mocked" version of the handler parameters const HANDLER_PARAMETERS: any = { arguments: { - $0: "bright", + $0: "zowe", _: ["zos-jobs", "submit", "data-set"], }, response: { diff --git a/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts b/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts index dda75c20d4..f7c5ff9675 100644 --- a/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts +++ b/packages/imperative/src/imperative/src/plugins/PluginManagementFacility.ts @@ -121,7 +121,7 @@ export class PluginManagementFacility { private pluginIssues = PluginIssues.instance; /** - * A set of bright dependencies used by plugins. Each item in the + * A set of Zowe dependencies used by plugins. Each item in the * set contains the dependency's property name, and the the version * of that dependency. * diff --git a/packages/imperative/src/imperative/src/profiles/builders/ProfilesCommandBuilder.ts b/packages/imperative/src/imperative/src/profiles/builders/ProfilesCommandBuilder.ts index afe358d5e3..997a11ad80 100644 --- a/packages/imperative/src/imperative/src/profiles/builders/ProfilesCommandBuilder.ts +++ b/packages/imperative/src/imperative/src/profiles/builders/ProfilesCommandBuilder.ts @@ -70,7 +70,7 @@ export abstract class ProfilesCommandBuilder implements AbstractCommandBuilder { protected abstract buildProfileSegmentFromSchema(): ICommandDefinition ; /** - * Construct the operands from the Bright Profile Schema. + * Construct the operands from the Zowe Profile Schema. * @param {any} properties: The properties set to iterate over looking for operands to add * @param {ICommandOptionDefinition[]} options: The final option definitions to add. * @return {ICommandOptionDefinition[]}: The set of returned option definitions diff --git a/packages/imperative/src/imperative/src/profiles/handlers/ValidateProfileHandler.ts b/packages/imperative/src/imperative/src/profiles/handlers/ValidateProfileHandler.ts index 656000fdba..f435403304 100644 --- a/packages/imperative/src/imperative/src/profiles/handlers/ValidateProfileHandler.ts +++ b/packages/imperative/src/imperative/src/profiles/handlers/ValidateProfileHandler.ts @@ -69,7 +69,7 @@ export default class ValidateProfileHandler implements ICommandHandler { plan = new (plan as any)(); } catch (e) { const planLoadErr: IImperativeError = { - msg: "An error was encountered trying to load the plan to validate the Brightside profile.", + msg: "An error was encountered trying to load the plan to validate the Zowe profile.", additionalDetails: e.message, causeErrors: e }; diff --git a/packages/imperative/src/logger/src/Logger.ts b/packages/imperative/src/logger/src/Logger.ts index ce34216391..85e8d6a380 100644 --- a/packages/imperative/src/logger/src/Logger.ts +++ b/packages/imperative/src/logger/src/Logger.ts @@ -354,7 +354,7 @@ export class Logger { const frame: StackTrace.StackFrame[] = StackTrace.parse(new Error()); let callerStackIndex = 1; while (!frame[callerStackIndex].getFileName() || (frame[callerStackIndex].getFileName().indexOf(path.basename(__filename)) >= 0)) { - // go up the stack until we're outside of the BrightsideLogger file + // go up the stack until we're outside of the Zowe Logger file callerStackIndex += 1; } const filename = path.basename(frame[callerStackIndex].getFileName()); diff --git a/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts b/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts index 9ef758026b..fdec3318ef 100644 --- a/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts +++ b/packages/imperative/src/profiles/src/validation/api/ProfileValidator.ts @@ -26,7 +26,7 @@ import { IProfile } from "../../doc/definition/IProfile"; import { CliUtils } from "../../../../utilities/src/CliUtils"; /** - * API for going through the full validation test for a Brightside CLI profile + * API for going through the full validation test for a Zowe CLI profile * and producing validation report */ export class ProfileValidator { @@ -316,7 +316,7 @@ export class ProfileValidator { /** * Get a printed/tabular version of your validation plan, - * so that the user can see what steps the Brightside CLI will take to validate their profile + * so that the user can see what steps the Zowe CLI will take to validate their profile * @param {IProfileValidationPlan} plan - the plan for profile validation * @param profile - the profile that would be validated - used only in this case to show a summary of the profile's contents * @param primaryHighlightColor - primary highlight color for use with chalk diff --git a/packages/zosjobs/__tests__/__system__/SubmitJobs.system.test.ts b/packages/zosjobs/__tests__/__system__/SubmitJobs.system.test.ts index 43f1dc49ae..415705ee9a 100644 --- a/packages/zosjobs/__tests__/__system__/SubmitJobs.system.test.ts +++ b/packages/zosjobs/__tests__/__system__/SubmitJobs.system.test.ts @@ -56,7 +56,7 @@ describe("Submit Jobs - System Tests", () => { jobUSSFile = testEnvironment.systemTestProperties.zosjobs.iefbr14USSFile; const maxJobNamePrefixLength = 5; iefbr14JCL = "//" + systemProps.zosmf.user.toUpperCase().substring(0, maxJobNamePrefixLength) + "J JOB " + account + - ",'Brightside Test',MSGLEVEL=(1,1),MSGCLASS=4,CLASS=C\n" + + ",'Zowe Test',MSGLEVEL=(1,1),MSGCLASS=4,CLASS=C\n" + "//EXEC PGM=IEFBR14"; }); diff --git a/packages/zosjobs/src/CancelJobs.ts b/packages/zosjobs/src/CancelJobs.ts index c7b0dd7cb8..4836757bf4 100644 --- a/packages/zosjobs/src/CancelJobs.ts +++ b/packages/zosjobs/src/CancelJobs.ts @@ -93,7 +93,7 @@ export class CancelJobs { /** - * Getter for brightside logger + * Getter for Zowe logger * @returns {Logger} */ private static get log(): Logger { diff --git a/packages/zosjobs/src/DeleteJobs.ts b/packages/zosjobs/src/DeleteJobs.ts index fa9afbee52..f7bc8e562c 100644 --- a/packages/zosjobs/src/DeleteJobs.ts +++ b/packages/zosjobs/src/DeleteJobs.ts @@ -88,7 +88,7 @@ export class DeleteJobs { /** - * Getter for brightside logger + * Getter for Zowe logger * @returns {Logger} */ private static get log(): Logger { diff --git a/packages/zosjobs/src/DownloadJobs.ts b/packages/zosjobs/src/DownloadJobs.ts index b765521c8f..7721a620ea 100644 --- a/packages/zosjobs/src/DownloadJobs.ts +++ b/packages/zosjobs/src/DownloadJobs.ts @@ -187,7 +187,7 @@ export class DownloadJobs { } /** - * Getter for brightside logger + * Getter for Zowe logger * @returns {Logger} */ private static get log(): Logger { diff --git a/packages/zosjobs/src/MonitorJobs.ts b/packages/zosjobs/src/MonitorJobs.ts index 4781b43a66..5595dd0ba9 100644 --- a/packages/zosjobs/src/MonitorJobs.ts +++ b/packages/zosjobs/src/MonitorJobs.ts @@ -160,7 +160,7 @@ export class MonitorJobs { } /** - * Obtain an instance of the app logger (Brightside). + * Obtain an instance of the app logger (Zowe). * @private * @static * @type {Logger} diff --git a/packages/zosjobs/src/SubmitJobs.ts b/packages/zosjobs/src/SubmitJobs.ts index d6645078db..ffb92958e1 100644 --- a/packages/zosjobs/src/SubmitJobs.ts +++ b/packages/zosjobs/src/SubmitJobs.ts @@ -494,7 +494,7 @@ export class SubmitJobs { } /** - * Getter for brightside logger + * Getter for Zowe logger * @returns {Logger} */ private static get log(): Logger { diff --git a/packages/zosmf/src/ZosmfSession.ts b/packages/zosmf/src/ZosmfSession.ts index e072c77989..48299c154e 100644 --- a/packages/zosmf/src/ZosmfSession.ts +++ b/packages/zosmf/src/ZosmfSession.ts @@ -17,7 +17,7 @@ import { } from "@zowe/imperative"; /** - * Utility Methods for Brightside + * Utility Methods for Zowe * @export */ export class ZosmfSession { diff --git a/packages/zosuss/src/SshSession.ts b/packages/zosuss/src/SshSession.ts index 7393d1de97..f0bf66b6bf 100644 --- a/packages/zosuss/src/SshSession.ts +++ b/packages/zosuss/src/SshSession.ts @@ -18,7 +18,7 @@ import { ISshSession } from "./doc/ISshSession"; /** - * Utility Methods for Brightside + * Utility Methods for Zowe * @export */ export class SshSession { From 7d3435276b282066486001e8209745bac85ba757 Mon Sep 17 00:00:00 2001 From: Gene Johnston Date: Thu, 9 Nov 2023 17:10:11 -0500 Subject: [PATCH 06/10] Remove broken stupid snapshots round 1 Signed-off-by: Gene Johnston --- ...s.submit.data-set.integration.test.ts.snap | 12 ---------- ...s-jobs.submit.data-set.integration.test.ts | 6 ++++- ...submit.local-file.integration.test.ts.snap | 12 ---------- ...jobs.submit.local-file.integration.test.ts | 7 +++++- ...s.submit.uss-file.integration.test.ts.snap | 12 ---------- ...s-jobs.submit.uss-file.integration.test.ts | 7 +++++- ...b-status-by-jobid.integration.test.ts.snap | 12 ---------- ...ew.job-status-by-jobid.integration.test.ts | 7 +++++- ...oke.test-async-handler.integration.test.ts | 12 ++++++++-- ...est-async-handler.integration.test.ts.snap | 22 ------------------- .../cli/root/Cmd.cli.root.integration.test.ts | 8 +++++-- .../Cmd.cli.root.integration.test.ts.snap | 16 -------------- 12 files changed, 39 insertions(+), 94 deletions(-) diff --git a/packages/cli/__tests__/zosjobs/__integration__/submit/data-set/__snapshots__/cli.zos-jobs.submit.data-set.integration.test.ts.snap b/packages/cli/__tests__/zosjobs/__integration__/submit/data-set/__snapshots__/cli.zos-jobs.submit.data-set.integration.test.ts.snap index 906d9e831c..b050523724 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/submit/data-set/__snapshots__/cli.zos-jobs.submit.data-set.integration.test.ts.snap +++ b/packages/cli/__tests__/zosjobs/__integration__/submit/data-set/__snapshots__/cli.zos-jobs.submit.data-set.integration.test.ts.snap @@ -217,18 +217,6 @@ exports[`zos-jobs submit data-set command should display the help 1`] = ` }" `; -exports[`zos-jobs submit data-set command syntax errors should occur if an extra unknown option is specified 1`] = ` -"Command Error: -Unknown argument: blah -Command failed due to improper syntax -Command entered: \\"zos-jobs submit data-set DATA.SET blah\\" -Available commands are \\"data-set, local-file, stdin, uss-file\\". -Use \\"zowe zos-jobs submit --help\\" to view groups, commands, and options. -Error Details: -Unknown argument: blah -" -`; - exports[`zos-jobs submit data-set command syntax errors should occur if both --wait-for-active and --directory is specified 1`] = ` " Syntax Error: diff --git a/packages/cli/__tests__/zosjobs/__integration__/submit/data-set/cli.zos-jobs.submit.data-set.integration.test.ts b/packages/cli/__tests__/zosjobs/__integration__/submit/data-set/cli.zos-jobs.submit.data-set.integration.test.ts index 73675ad166..8eff72ee9e 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/submit/data-set/cli.zos-jobs.submit.data-set.integration.test.ts +++ b/packages/cli/__tests__/zosjobs/__integration__/submit/data-set/cli.zos-jobs.submit.data-set.integration.test.ts @@ -57,7 +57,11 @@ describe("zos-jobs submit data-set command", () => { const response = runCliScript(__dirname + "/__scripts__/submit_syntax_invalid_parm.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); expect(response.stdout.toString()).toBe(""); - expect(response.stderr.toString()).toMatchSnapshot(); + expect(response.stderr.toString()).toContain("Unknown argument: blah"); + expect(response.stderr.toString()).toContain("Command failed due to improper syntax"); + expect(response.stderr.toString()).toContain('Command entered: "zos-jobs submit data-set DATA.SET blah"'); + expect(response.stderr.toString()).toContain('Available commands are "data-set, local-file, stdin, uss-file".'); + expect(response.stderr.toString()).toContain('Use "zowe zos-jobs submit --help" to view groups, commands, and options.'); }); it("should occur if both --wait-for-active and --directory is specified", () => { diff --git a/packages/cli/__tests__/zosjobs/__integration__/submit/local-file/__snapshots__/cli.zos-jobs.submit.local-file.integration.test.ts.snap b/packages/cli/__tests__/zosjobs/__integration__/submit/local-file/__snapshots__/cli.zos-jobs.submit.local-file.integration.test.ts.snap index 1848e65466..7ac2b54bbc 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/submit/local-file/__snapshots__/cli.zos-jobs.submit.local-file.integration.test.ts.snap +++ b/packages/cli/__tests__/zosjobs/__integration__/submit/local-file/__snapshots__/cli.zos-jobs.submit.local-file.integration.test.ts.snap @@ -237,18 +237,6 @@ Use \\"zowe zos-jobs submit local-file --help\\" to view command description, us " `; -exports[`zos-jobs submit local-file command syntax errors should occur if an extra unknown option is specified 1`] = ` -"Command Error: -Unknown argument: blah -Command failed due to improper syntax -Command entered: \\"zos-jobs submit local-file ../../../../packages/cli/__tests__/zosjobs/__integration__/submit/local-file/testFileOfLocalJCL.txt blah\\" -Available commands are \\"data-set, local-file, stdin, uss-file\\". -Use \\"zowe zos-jobs submit --help\\" to view groups, commands, and options. -Error Details: -Unknown argument: blah -" -`; - exports[`zos-jobs submit local-file command syntax errors should occur if the local file name is missing 1`] = ` " Syntax Error: diff --git a/packages/cli/__tests__/zosjobs/__integration__/submit/local-file/cli.zos-jobs.submit.local-file.integration.test.ts b/packages/cli/__tests__/zosjobs/__integration__/submit/local-file/cli.zos-jobs.submit.local-file.integration.test.ts index b3c872f19e..1aecaf6e68 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/submit/local-file/cli.zos-jobs.submit.local-file.integration.test.ts +++ b/packages/cli/__tests__/zosjobs/__integration__/submit/local-file/cli.zos-jobs.submit.local-file.integration.test.ts @@ -58,7 +58,12 @@ describe("zos-jobs submit local-file command", () => { TEST_ENVIRONMENT, [relDirname + "/testFileOfLocalJCL.txt"]); expect(response.status).toBe(1); expect(response.stdout.toString()).toBe(""); - expect(response.stderr.toString()).toMatchSnapshot(); + expect(response.stderr.toString()).toContain("Unknown argument: blah"); + expect(response.stderr.toString()).toContain("Command failed due to improper syntax"); + expect(response.stderr.toString()).toContain('Command entered: "zos-jobs submit local-file ' + + '../../../../packages/cli/__tests__/zosjobs/__integration__/submit/local-file/testFileOfLocalJCL.txt blah"'); + expect(response.stderr.toString()).toContain('Available commands are "data-set, local-file, stdin, uss-file".'); + expect(response.stderr.toString()).toContain('Use "zowe zos-jobs submit --help" to view groups, commands, and options.'); }); it("should occur if --wfa and --directory are both specified", () => { diff --git a/packages/cli/__tests__/zosjobs/__integration__/submit/uss-file/__snapshots__/cli.zos-jobs.submit.uss-file.integration.test.ts.snap b/packages/cli/__tests__/zosjobs/__integration__/submit/uss-file/__snapshots__/cli.zos-jobs.submit.uss-file.integration.test.ts.snap index 7290ae8f08..e325ec6037 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/submit/uss-file/__snapshots__/cli.zos-jobs.submit.uss-file.integration.test.ts.snap +++ b/packages/cli/__tests__/zosjobs/__integration__/submit/uss-file/__snapshots__/cli.zos-jobs.submit.uss-file.integration.test.ts.snap @@ -209,18 +209,6 @@ exports[`zos-jobs submit uss-file command should display the help 1`] = ` }" `; -exports[`zos-jobs submit uss-file command syntax errors should occur if an extra unknown option is specified 1`] = ` -"Command Error: -Unknown argument: blah -Command failed due to improper syntax -Command entered: \\"zos-jobs submit uss-file /a/ibmuser/ussfile.txt blah\\" -Available commands are \\"data-set, local-file, stdin, uss-file\\". -Use \\"zowe zos-jobs submit --help\\" to view groups, commands, and options. -Error Details: -Unknown argument: blah -" -`; - exports[`zos-jobs submit uss-file command syntax errors should occur if both --wait-for-active and --directory is specified 1`] = ` " Syntax Error: diff --git a/packages/cli/__tests__/zosjobs/__integration__/submit/uss-file/cli.zos-jobs.submit.uss-file.integration.test.ts b/packages/cli/__tests__/zosjobs/__integration__/submit/uss-file/cli.zos-jobs.submit.uss-file.integration.test.ts index 65ef063339..d5475222fa 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/submit/uss-file/cli.zos-jobs.submit.uss-file.integration.test.ts +++ b/packages/cli/__tests__/zosjobs/__integration__/submit/uss-file/cli.zos-jobs.submit.uss-file.integration.test.ts @@ -57,7 +57,12 @@ describe("zos-jobs submit uss-file command", () => { const response = runCliScript(__dirname + "/__scripts__/submit_syntax_invalid_parm.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); expect(response.stdout.toString()).toBe(""); - expect(response.stderr.toString()).toMatchSnapshot(); + expect(response.stderr.toString()).toContain("Unknown argument: blah"); + expect(response.stderr.toString()).toContain("Command failed due to improper syntax"); + expect(response.stderr.toString()).toContain('Command entered: "zos-jobs submit uss-file ' + + '/a/ibmuser/ussfile.txt blah"'); + expect(response.stderr.toString()).toContain('Available commands are "data-set, local-file, stdin, uss-file".'); + expect(response.stderr.toString()).toContain('Use "zowe zos-jobs submit --help" to view groups, commands, and options.'); }); it("should occur if both --wait-for-active and --directory is specified", () => { diff --git a/packages/cli/__tests__/zosjobs/__integration__/view/__snapshots__/cli.zos-jobs.view.job-status-by-jobid.integration.test.ts.snap b/packages/cli/__tests__/zosjobs/__integration__/view/__snapshots__/cli.zos-jobs.view.job-status-by-jobid.integration.test.ts.snap index e6813a5b06..654cefe2b4 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/view/__snapshots__/cli.zos-jobs.view.job-status-by-jobid.integration.test.ts.snap +++ b/packages/cli/__tests__/zosjobs/__integration__/view/__snapshots__/cli.zos-jobs.view.job-status-by-jobid.integration.test.ts.snap @@ -176,18 +176,6 @@ exports[`zos-jobs view job-status-by-jobid command should display the help 1`] = }" `; -exports[`zos-jobs view job-status-by-jobid command syntax errors should occur if an extra unknown option is specified 1`] = ` -"Command Error: -Unknown argument: blah -Command failed due to improper syntax -Command entered: \\"zos-jobs view job-status-by-jobid JOB123 blah --host fakehost --user fakeuser --password fakepass\\" -Available commands are \\"all-spool-content, job-status-by-jobid, spool-file-by-id\\". -Use \\"zowe zos-jobs view --help\\" to view groups, commands, and options. -Error Details: -Unknown argument: blah -" -`; - exports[`zos-jobs view job-status-by-jobid command syntax errors should occur if the jobid is missing 1`] = ` " Syntax Error: diff --git a/packages/cli/__tests__/zosjobs/__integration__/view/cli.zos-jobs.view.job-status-by-jobid.integration.test.ts b/packages/cli/__tests__/zosjobs/__integration__/view/cli.zos-jobs.view.job-status-by-jobid.integration.test.ts index 055e08ebab..11bba6de2e 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/view/cli.zos-jobs.view.job-status-by-jobid.integration.test.ts +++ b/packages/cli/__tests__/zosjobs/__integration__/view/cli.zos-jobs.view.job-status-by-jobid.integration.test.ts @@ -51,7 +51,12 @@ describe("zos-jobs view job-status-by-jobid command", () => { TEST_ENVIRONMENT); expect(response.stdout.toString()).toBe(""); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); + expect(response.stderr.toString()).toContain('Unknown argument: blah'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Command entered: "zos-jobs view job-status-by-jobid JOB123 blah ' + + '--host fakehost --user fakeuser --password fakepass"'); + expect(response.stderr.toString()).toContain('Available commands are "all-spool-content, job-status-by-jobid, spool-file-by-id".'); + expect(response.stderr.toString()).toContain('Use "zowe zos-jobs view --help" to view groups, commands, and options.'); }); }); diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/Cmd.cli.invoke.test-async-handler.integration.test.ts b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/Cmd.cli.invoke.test-async-handler.integration.test.ts index 951dde75b5..8329e31724 100644 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/Cmd.cli.invoke.test-async-handler.integration.test.ts +++ b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/Cmd.cli.invoke.test-async-handler.integration.test.ts @@ -47,8 +47,16 @@ describe("cmd-cli invoke test-async-handler", () => { const response = runCliScript(__dirname + "/__scripts__/test-async-handler/invoke_test_async_handler_fail_ie.sh", TEST_ENVIRONMENT.workingDir); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); - expect(response.stdout.toString()).toMatchSnapshot(); + expect(response.stderr.toString()).toContain("Fail with Imperative Error"); + expect(response.stdout.toString()).toContain("===================FAIL WITH IMPERATIVE ERROR============================"); + expect(response.stdout.toString()).toContain("===================FAIL WITH IMPERATIVE ERROR RFJ========================"); + expect(response.stdout.toString()).toContain('"success": false'); + expect(response.stdout.toString()).toContain('"exitCode": 1'); + expect(response.stdout.toString()).toContain('"message": "Fail with Imperative Error"'); + expect(response.stdout.toString()).toContain('"stdout":'); + expect(response.stdout.toString()).toContain('"data":'); + expect(response.stdout.toString()).toContain('"error":'); + expect(response.stdout.toString()).toContain('"msg": "Fail with Imperative Error"'); }); it("should fail a handler if a generic error is thrown", async () => { diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/__snapshots__/Cmd.cli.invoke.test-async-handler.integration.test.ts.snap b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/__snapshots__/Cmd.cli.invoke.test-async-handler.integration.test.ts.snap index b9a9e3d049..923aafc44f 100644 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/__snapshots__/Cmd.cli.invoke.test-async-handler.integration.test.ts.snap +++ b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/__snapshots__/Cmd.cli.invoke.test-async-handler.integration.test.ts.snap @@ -90,25 +90,3 @@ exports[`cmd-cli invoke test-async-handler should display the help 1`] = ` \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n test-async-handler\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Test async handler command tests tests a fulfill/reject from an asynchronous\\\\n handler.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n cmd-cli invoke test-async-handler [options]\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --fail (boolean)\\\\n\\\\n Fail the handler with an 'Imperative Error'.\\\\n\\\\n --fail-with-error (boolean)\\\\n\\\\n Fail the handler with a generic 'Error'.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\" }" `; - -exports[`cmd-cli invoke test-async-handler should fail a handler if an imperative error is thrown 1`] = ` -"Command Error: -Fail with Imperative Error -" -`; - -exports[`cmd-cli invoke test-async-handler should fail a handler if an imperative error is thrown 2`] = ` -"===================FAIL WITH IMPERATIVE ERROR============================ -===================FAIL WITH IMPERATIVE ERROR RFJ======================== -{ - \\"success\\": false, - \\"exitCode\\": 1, - \\"message\\": \\"Fail with Imperative Error\\", - \\"stdout\\": \\"\\", - \\"stderr\\": \\"Command Error:\\\\nFail with Imperative Error\\\\n\\", - \\"data\\": {}, - \\"error\\": { - \\"msg\\": \\"Fail with Imperative Error\\" - } -}" -`; diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/Cmd.cli.root.integration.test.ts b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/Cmd.cli.root.integration.test.ts index 8f7c398c8e..fb0367fd4c 100644 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/Cmd.cli.root.integration.test.ts +++ b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/Cmd.cli.root.integration.test.ts @@ -42,8 +42,12 @@ describe("cmd-cli", () => { it("should flag an invalid group and give a close suggestion", async () => { const response = runCliScript(__dirname + "/__scripts__/invalid_command.sh", TEST_ENVIRONMENT.workingDir); expect(response.status).toBe(1); - expect(response.stdout.toString()).toMatchSnapshot(); - expect(response.stderr.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toContain('================ISSUING CMD WITH INVALID GROUP==============='); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Unknown group: NOT_REAL'); + expect(response.stderr.toString()).toContain('Did you mean: auth?'); + expect(response.stderr.toString()).toContain('Command entered: "NOT_REAL"'); + expect(response.stderr.toString()).toContain('Use "cmd-cli --help" to view groups, commands, and options.'); }); it("should flag an invalid command and list valid commands", async () => { diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap index 7287ebde76..cbfc7f11e8 100644 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap +++ b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/root/__snapshots__/Cmd.cli.root.integration.test.ts.snap @@ -130,22 +130,6 @@ exports[`cmd-cli should display the version 1`] = ` " `; -exports[`cmd-cli should flag an invalid group and give a close suggestion 1`] = ` -"================ISSUING CMD WITH INVALID GROUP=============== -" -`; - -exports[`cmd-cli should flag an invalid group and give a close suggestion 2`] = ` -"Command Error: -Command failed due to improper syntax -Unknown group: NOT_REAL -Did you mean: auth? - -Command entered: \\"NOT_REAL\\" -Use \\"cmd-cli --help\\" to view groups, commands, and options. -" -`; - exports[`cmd-cli should show a list of available commands 1`] = ` "================ISSUING HELP NO OPTIONS=============== cmd-cli auth login fruit From 66e6bd9be7ef5c79a3447c556114e379fea5329f Mon Sep 17 00:00:00 2001 From: Gene Johnston Date: Fri, 10 Nov 2023 14:18:08 -0500 Subject: [PATCH 07/10] Remove broken stupid snapshots round 2 Signed-off-by: Gene Johnston --- ...ovisioning.delete.integration.test.ts.snap | 30 --------------- ...li.provisioning.delete.integration.test.ts | 19 ++++++++-- ...sioning.provision.integration.test.ts.snap | 30 --------------- ...provisioning.provision.integration.test.ts | 19 ++++++++-- .../cli.zos-console.integration.test.ts.snap | 36 ------------------ .../root/cli.zos-console.integration.test.ts | 18 +++++++-- ...all-spool-content.integration.test.ts.snap | 8 +++- ...view.all-spool-content.integration.test.ts | 6 +++ .../cli.zos-tso.integration.test.ts.snap | 26 ------------- .../root/cli.zos-tso.integration.test.ts | 12 +++++- ...cli.zos-tso.start.integration.test.ts.snap | 38 ------------------- .../cli.zos-tso.start.integration.test.ts | 19 ++++++++-- .../stop/__scripts__/stop_invalid_option.sh | 2 +- .../cli.zos-tso.stop.integration.test.ts.snap | 36 ------------------ .../stop/cli.zos-tso.stop.integration.test.ts | 19 ++++++++-- ...zos-uss.issue.ssh.integration.test.ts.snap | 13 ------- .../cli.zos-uss.issue.ssh.integration.test.ts | 7 +++- ...i.invalid.profile-spec.integration.test.ts | 10 ++++- ...alid.profile-spec.integration.test.ts.snap | 11 ------ ...Cmd.cli.invoke.exit143.integration.test.ts | 3 +- ...li.invoke.exit143.integration.test.ts.snap | 7 ---- 21 files changed, 113 insertions(+), 256 deletions(-) delete mode 100644 packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.profile-spec.integration.test.ts.snap delete mode 100644 packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/__snapshots__/Cmd.cli.invoke.exit143.integration.test.ts.snap diff --git a/packages/cli/__tests__/provisioning/__integration__/delete/__snapshots__/cli.provisioning.delete.integration.test.ts.snap b/packages/cli/__tests__/provisioning/__integration__/delete/__snapshots__/cli.provisioning.delete.integration.test.ts.snap index 61ca7ab4ef..0f51b99108 100644 --- a/packages/cli/__tests__/provisioning/__integration__/delete/__snapshots__/cli.provisioning.delete.integration.test.ts.snap +++ b/packages/cli/__tests__/provisioning/__integration__/delete/__snapshots__/cli.provisioning.delete.integration.test.ts.snap @@ -47,33 +47,3 @@ exports[`provisioning delete should display the help 1`] = ` \\"data\\": \\"\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Deletes instance previously provisioned with z/OSMF cloud provisioning services.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe provisioning delete \\\\n\\\\n Where is one of the following:\\\\n\\\\n COMMANDS\\\\n --------\\\\n\\\\n instance | i Deletes instance.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --help-examples (boolean)\\\\n\\\\n Display examples for all the commands in a group\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\" }" `; - -exports[`provisioning delete should fail with invalid option 1`] = ` -"Command Error: -Unknown arguments: foo-bar, fooBar -Command failed due to improper syntax -Command entered: \\"provisioning delete instance --foo-bar\\" -Available commands are \\"instance\\". -Use \\"zowe provisioning delete --help\\" to view groups, commands, and options. -Error Details: -Unknown arguments: foo-bar, fooBar -" -`; - -exports[`provisioning delete should fail with invalid option 2`] = `""`; - -exports[`provisioning delete should fail with invalid parameter 1`] = ` -"Command Error: -Unknown argument: foobar -Command failed due to improper syntax -Did you mean: provisioning delete i? - -Command entered: \\"provisioning delete foobar\\" -Available commands are \\"instance\\". -Use \\"zowe provisioning delete --help\\" to view groups, commands, and options. -Error Details: -Unknown argument: foobar -" -`; - -exports[`provisioning delete should fail with invalid parameter 2`] = `""`; diff --git a/packages/cli/__tests__/provisioning/__integration__/delete/cli.provisioning.delete.integration.test.ts b/packages/cli/__tests__/provisioning/__integration__/delete/cli.provisioning.delete.integration.test.ts index bd99e53744..18987e8ef8 100644 --- a/packages/cli/__tests__/provisioning/__integration__/delete/cli.provisioning.delete.integration.test.ts +++ b/packages/cli/__tests__/provisioning/__integration__/delete/cli.provisioning.delete.integration.test.ts @@ -36,14 +36,25 @@ describe("provisioning delete", () => { it("should fail with invalid parameter", async () => { const response = runCliScript(__dirname + "/__scripts__/delete_invalid_parameter.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); - expect(response.stdout.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Unknown argument: foobar'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Did you mean: provisioning delete'); + expect(response.stderr.toString()).toContain('Command entered: "provisioning delete foobar"'); + expect(response.stderr.toString()).toContain('Available commands are "instance".'); + expect(response.stderr.toString()).toContain('Use "zowe provisioning delete --help" to view groups, commands, and options.'); + expect(response.stderr.toString()).toContain('Error: Unknown argument: foobar'); }); it("should fail with invalid option", async () => { const response = runCliScript(__dirname + "/__scripts__/delete_invalid_option.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); - expect(response.stdout.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Unknown arguments: foo-bar, fooBar'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Command entered: "provisioning delete instance --foo-bar"'); + expect(response.stderr.toString()).toContain('Available commands are "instance".'); + expect(response.stderr.toString()).toContain('Use "zowe provisioning delete --help" to view groups, commands, and options.'); + expect(response.stderr.toString()).toContain('Error: Unknown arguments: foo-bar, fooBar'); }); }); diff --git a/packages/cli/__tests__/provisioning/__integration__/provision/__snapshots__/cli.provisioning.provision.integration.test.ts.snap b/packages/cli/__tests__/provisioning/__integration__/provision/__snapshots__/cli.provisioning.provision.integration.test.ts.snap index b91aec755f..0fb1c7d4c2 100644 --- a/packages/cli/__tests__/provisioning/__integration__/provision/__snapshots__/cli.provisioning.provision.integration.test.ts.snap +++ b/packages/cli/__tests__/provisioning/__integration__/provision/__snapshots__/cli.provisioning.provision.integration.test.ts.snap @@ -47,33 +47,3 @@ exports[`provisioning provision should display the help 1`] = ` \\"data\\": \\"\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Using z/OSMF cloud provisioning services provision available templates.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe provisioning provision \\\\n\\\\n Where is one of the following:\\\\n\\\\n COMMANDS\\\\n --------\\\\n\\\\n template | tem Provision a published software service template.\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --help-examples (boolean)\\\\n\\\\n Display examples for all the commands in a group\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\" }" `; - -exports[`provisioning provision should fail with invalid option 1`] = ` -"Command Error: -Unknown arguments: foo-bar, fooBar -Command failed due to improper syntax -Command entered: \\"provisioning provision template --foo-bar\\" -Available commands are \\"template\\". -Use \\"zowe provisioning provision --help\\" to view groups, commands, and options. -Error Details: -Unknown arguments: foo-bar, fooBar -" -`; - -exports[`provisioning provision should fail with invalid option 2`] = `""`; - -exports[`provisioning provision should fail with invalid parameter 1`] = ` -"Command Error: -Unknown argument: foobar -Command failed due to improper syntax -Did you mean: provisioning provision tem? - -Command entered: \\"provisioning provision foobar\\" -Available commands are \\"template\\". -Use \\"zowe provisioning provision --help\\" to view groups, commands, and options. -Error Details: -Unknown argument: foobar -" -`; - -exports[`provisioning provision should fail with invalid parameter 2`] = `""`; diff --git a/packages/cli/__tests__/provisioning/__integration__/provision/cli.provisioning.provision.integration.test.ts b/packages/cli/__tests__/provisioning/__integration__/provision/cli.provisioning.provision.integration.test.ts index e44f76c8db..b2dab4ee8e 100644 --- a/packages/cli/__tests__/provisioning/__integration__/provision/cli.provisioning.provision.integration.test.ts +++ b/packages/cli/__tests__/provisioning/__integration__/provision/cli.provisioning.provision.integration.test.ts @@ -36,14 +36,25 @@ describe("provisioning provision", () => { it("should fail with invalid parameter", async () => { const response = runCliScript(__dirname + "/__scripts__/provision_invalid_parameter.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); - expect(response.stdout.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Unknown argument: foobar'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Did you mean: provisioning provision'); + expect(response.stderr.toString()).toContain('Command entered: "provisioning provision foobar"'); + expect(response.stderr.toString()).toContain('Available commands are "template".'); + expect(response.stderr.toString()).toContain('Use "zowe provisioning provision --help" to view groups, commands, and options.'); + expect(response.stderr.toString()).toContain('Error: Unknown argument: foobar'); }); it("should fail with invalid option", async () => { const response = runCliScript(__dirname + "/__scripts__/provision_invalid_option.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); - expect(response.stdout.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Unknown arguments: foo-bar, fooBar'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Command entered: "provisioning provision template --foo-bar"'); + expect(response.stderr.toString()).toContain('Available commands are "template".'); + expect(response.stderr.toString()).toContain('Use "zowe provisioning provision --help" to view groups, commands, and options.'); + expect(response.stderr.toString()).toContain('Error: Unknown arguments: foo-bar, fooBar'); }); }); diff --git a/packages/cli/__tests__/zosconsole/__integration__/root/__snapshots__/cli.zos-console.integration.test.ts.snap b/packages/cli/__tests__/zosconsole/__integration__/root/__snapshots__/cli.zos-console.integration.test.ts.snap index 2c863c668c..c8dd0ebac4 100644 --- a/packages/cli/__tests__/zosconsole/__integration__/root/__snapshots__/cli.zos-console.integration.test.ts.snap +++ b/packages/cli/__tests__/zosconsole/__integration__/root/__snapshots__/cli.zos-console.integration.test.ts.snap @@ -56,39 +56,3 @@ exports[`zos-console should display the help 1`] = ` \\"data\\": \\"\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Interact with z/OSMF console services. Issue z/OS console commands and collect\\\\n responses. z/OS console services establishes extended MCS (EMCS) consoles on\\\\n behalf of the user, which are used to issue the commands and collect responses.\\\\n\\\\n Important! Before you use commands in the zos-console command group, ensure that\\\\n you understand the implications of issuing z/OS console commands in your\\\\n environment.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-console \\\\n\\\\n Where is one of the following:\\\\n\\\\n GROUPS\\\\n ------\\\\n\\\\n collect Collect z/OS console command responses\\\\n issue Issue z/OS console commands \\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --help-examples (boolean)\\\\n\\\\n Display examples for all the commands in a group\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\" }" `; - -exports[`zos-console should fail with invalid option 1`] = ` -"Command Error: -Unknown arguments: foo-bar, fooBar -Command failed due to improper syntax -Did you mean: zos-console collect? - -Command entered: \\"zos-console --foo-bar\\" -Use \\"zowe zos-console --help\\" to view groups, commands, and options. -Error Details: -Unknown arguments: foo-bar, fooBar -" -`; - -exports[`zos-console should fail with invalid option 2`] = ` -"================Z/OS CONSOLE INVALID PARAMETERS=============== -" -`; - -exports[`zos-console should fail with invalid parameter 1`] = ` -"Command Error: -Unknown argument: foobar -Command failed due to improper syntax -Did you mean: zos-console collect? - -Command entered: \\"zos-console foobar\\" -Use \\"zowe zos-console --help\\" to view groups, commands, and options. -Error Details: -Unknown argument: foobar -" -`; - -exports[`zos-console should fail with invalid parameter 2`] = ` -"================Z/OS CONSOLE INVALID PARAMETERS=============== -" -`; diff --git a/packages/cli/__tests__/zosconsole/__integration__/root/cli.zos-console.integration.test.ts b/packages/cli/__tests__/zosconsole/__integration__/root/cli.zos-console.integration.test.ts index ca03128837..49d9f19470 100644 --- a/packages/cli/__tests__/zosconsole/__integration__/root/cli.zos-console.integration.test.ts +++ b/packages/cli/__tests__/zosconsole/__integration__/root/cli.zos-console.integration.test.ts @@ -36,14 +36,24 @@ describe("zos-console", () => { it("should fail with invalid parameter", async () => { const response = runCliScript(__dirname + "/__scripts__/invalid_parameter.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); - expect(response.stdout.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Unknown argument: foobar'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Did you mean: zos-console collect'); + expect(response.stderr.toString()).toContain('Command entered: "zos-console foobar"'); + expect(response.stderr.toString()).toContain('Use "zowe zos-console --help" to view groups, commands, and options.'); + expect(response.stderr.toString()).toContain('Error: Unknown argument: foobar'); }); it("should fail with invalid option", async () => { const response = runCliScript(__dirname + "/__scripts__/invalid_option.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); - expect(response.stdout.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Unknown arguments: foo-bar, fooBar'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Did you mean: zos-console collect'); + expect(response.stderr.toString()).toContain('Command entered: "zos-console --foo-bar"'); + expect(response.stderr.toString()).toContain('Use "zowe zos-console --help" to view groups, commands, and options.'); + expect(response.stderr.toString()).toContain('Error: Unknown arguments: foo-bar, fooBar'); }); }); diff --git a/packages/cli/__tests__/zosjobs/__integration__/view/__snapshots__/cli.zos-jobs.view.all-spool-content.integration.test.ts.snap b/packages/cli/__tests__/zosjobs/__integration__/view/__snapshots__/cli.zos-jobs.view.all-spool-content.integration.test.ts.snap index 8f95a1ba08..bb908bed0f 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/view/__snapshots__/cli.zos-jobs.view.all-spool-content.integration.test.ts.snap +++ b/packages/cli/__tests__/zosjobs/__integration__/view/__snapshots__/cli.zos-jobs.view.all-spool-content.integration.test.ts.snap @@ -135,13 +135,17 @@ exports[`zos-jobs view all-spool-content command should display the help 1`] = ` `; exports[`zos-jobs view all-spool-content command syntax errors should occur if an extra unknown option is specified 1`] = ` -"Command Error: +"Unable to perform this operation due to the following problem. Unknown argument: blah Command failed due to improper syntax Command entered: \\"zos-jobs view all-spool-content JOB123 blah --host fakehost --user fakeuser --password fakepass\\" Available commands are \\"all-spool-content, job-status-by-jobid, spool-file-by-id\\". Use \\"zowe zos-jobs view --help\\" to view groups, commands, and options. -Error Details: + +Response From Service +Error: Unknown argument: blah + +Diagnostic Information Unknown argument: blah " `; diff --git a/packages/cli/__tests__/zosjobs/__integration__/view/cli.zos-jobs.view.all-spool-content.integration.test.ts b/packages/cli/__tests__/zosjobs/__integration__/view/cli.zos-jobs.view.all-spool-content.integration.test.ts index 775ae98f48..cbc1e862f9 100644 --- a/packages/cli/__tests__/zosjobs/__integration__/view/cli.zos-jobs.view.all-spool-content.integration.test.ts +++ b/packages/cli/__tests__/zosjobs/__integration__/view/cli.zos-jobs.view.all-spool-content.integration.test.ts @@ -51,6 +51,12 @@ describe("zos-jobs view all-spool-content command", () => { TEST_ENVIRONMENT); expect(response.stdout.toString()).toBe(""); expect(response.status).toBe(1); + expect(response.stderr.toString()).toContain('Unknown argument: blah'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Command entered: "zos-jobs view all-spool-content JOB123 blah ' + + '--host fakehost --user fakeuser --password fakepass"'); + expect(response.stderr.toString()).toContain('Available commands are "all-spool-content, job-status-by-jobid, spool-file-by-id".'); + expect(response.stderr.toString()).toContain('Use "zowe zos-jobs view --help" to view groups, commands, and options.'); expect(response.stderr.toString()).toMatchSnapshot(); }); }); diff --git a/packages/cli/__tests__/zostso/__integration__/root/__snapshots__/cli.zos-tso.integration.test.ts.snap b/packages/cli/__tests__/zostso/__integration__/root/__snapshots__/cli.zos-tso.integration.test.ts.snap index 01f7cf6730..be8a0738b8 100644 --- a/packages/cli/__tests__/zostso/__integration__/root/__snapshots__/cli.zos-tso.integration.test.ts.snap +++ b/packages/cli/__tests__/zostso/__integration__/root/__snapshots__/cli.zos-tso.integration.test.ts.snap @@ -51,29 +51,3 @@ exports[`zos-tso should display the help 1`] = ` \\"data\\": \\"\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Issue TSO commands and interact with TSO address spaces.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-tso \\\\n\\\\n Where is one of the following:\\\\n\\\\n GROUPS\\\\n ------\\\\n\\\\n issue Issue TSO commands \\\\n ping Ping a TSO address space \\\\n send Send data to TSO \\\\n start | st Start TSO/E address space\\\\n stop | sp Stop TSO/E address space \\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --help-examples (boolean)\\\\n\\\\n Display examples for all the commands in a group\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\" }" `; - -exports[`zos-tso should fail with invalid option 1`] = ` -"Command Error: -Unknown arguments: not-valid-option, notValidOption -Command failed due to improper syntax -Did you mean: zos-tso start? - -Command entered: \\"zos-tso --not-valid-option\\" -Use \\"zowe zos-tso --help\\" to view groups, commands, and options. -Error Details: -Unknown arguments: not-valid-option, notValidOption -" -`; - -exports[`zos-tso should fail with invalid parameter 1`] = ` -"Command Error: -Unknown argument: examine -Command failed due to improper syntax -Did you mean: zos-tso ping? - -Command entered: \\"zos-tso examine\\" -Use \\"zowe zos-tso --help\\" to view groups, commands, and options. -Error Details: -Unknown argument: examine -" -`; diff --git a/packages/cli/__tests__/zostso/__integration__/root/cli.zos-tso.integration.test.ts b/packages/cli/__tests__/zostso/__integration__/root/cli.zos-tso.integration.test.ts index 0d96537777..75a1fb62dc 100644 --- a/packages/cli/__tests__/zostso/__integration__/root/cli.zos-tso.integration.test.ts +++ b/packages/cli/__tests__/zostso/__integration__/root/cli.zos-tso.integration.test.ts @@ -36,14 +36,22 @@ describe("zos-tso", () => { it("should fail with invalid parameter", async () => { const response = runCliScript(__dirname + "/__scripts__/invalid_command.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); expect(response.stdout.toString()).toBe(""); + expect(response.stderr.toString()).toContain('Unknown argument: examine'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Did you mean: zos-tso ping'); + expect(response.stderr.toString()).toContain('Command entered: "zos-tso examine"'); + expect(response.stderr.toString()).toContain('Use "zowe zos-tso --help" to view groups, commands, and options.'); }); it("should fail with invalid option", async () => { const response = runCliScript(__dirname + "/__scripts__/invalid_option.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); expect(response.stdout.toString()).toBe(""); + expect(response.stderr.toString()).toContain('Unknown arguments: not-valid-option, notValidOption'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Did you mean: zos-tso start'); + expect(response.stderr.toString()).toContain('Command entered: "zos-tso --not-valid-option"'); + expect(response.stderr.toString()).toContain('Use "zowe zos-tso --help" to view groups, commands, and options.'); }); }); diff --git a/packages/cli/__tests__/zostso/__integration__/start/__snapshots__/cli.zos-tso.start.integration.test.ts.snap b/packages/cli/__tests__/zostso/__integration__/start/__snapshots__/cli.zos-tso.start.integration.test.ts.snap index b2b7db97d1..97ae6639ae 100644 --- a/packages/cli/__tests__/zostso/__integration__/start/__snapshots__/cli.zos-tso.start.integration.test.ts.snap +++ b/packages/cli/__tests__/zostso/__integration__/start/__snapshots__/cli.zos-tso.start.integration.test.ts.snap @@ -49,41 +49,3 @@ exports[`zos-tso start should display the help 1`] = ` \\"data\\": \\"\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Start TSO/E address space.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-tso start \\\\n\\\\n Where is one of the following:\\\\n\\\\n COMMANDS\\\\n --------\\\\n\\\\n address-space | as Start a TSO address space, from which you will receive a\\\\n token (a.k.a 'servlet-key') for further address space \\\\n interaction (e.g. termination). \\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --help-examples (boolean)\\\\n\\\\n Display examples for all the commands in a group\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\" }" `; - -exports[`zos-tso start should fail with invalid option 1`] = ` -"Command Error: -Unknown arguments: foo-bar, fooBar -Command failed due to improper syntax -Did you mean: zos-tso start as? - -Command entered: \\"zos-tso start --foo-bar\\" -Available commands are \\"address-space\\". -Use \\"zowe zos-tso start --help\\" to view groups, commands, and options. -Error Details: -Unknown arguments: foo-bar, fooBar -" -`; - -exports[`zos-tso start should fail with invalid option 2`] = ` -"================Z/OS CONSOLE INVALID PARAMETERS=============== -" -`; - -exports[`zos-tso start should fail with invalid parameter 1`] = ` -"Command Error: -Unknown argument: foobar -Command failed due to improper syntax -Did you mean: zos-tso start as? - -Command entered: \\"zos-tso start foobar\\" -Available commands are \\"address-space\\". -Use \\"zowe zos-tso start --help\\" to view groups, commands, and options. -Error Details: -Unknown argument: foobar -" -`; - -exports[`zos-tso start should fail with invalid parameter 2`] = ` -"================Z/OS CONSOLE INVALID PARAMETERS=============== -" -`; diff --git a/packages/cli/__tests__/zostso/__integration__/start/cli.zos-tso.start.integration.test.ts b/packages/cli/__tests__/zostso/__integration__/start/cli.zos-tso.start.integration.test.ts index c543cecd59..7d81c90fb8 100644 --- a/packages/cli/__tests__/zostso/__integration__/start/cli.zos-tso.start.integration.test.ts +++ b/packages/cli/__tests__/zostso/__integration__/start/cli.zos-tso.start.integration.test.ts @@ -36,15 +36,26 @@ describe("zos-tso start", () => { it("should fail with invalid parameter", async () => { const response = runCliScript(__dirname + "/__scripts__/start_invalid_parameter.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); - expect(response.stdout.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Unknown argument: foobar'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Did you mean: zos-tso start'); + expect(response.stderr.toString()).toContain('Command entered: "zos-tso start foobar"'); + expect(response.stderr.toString()).toContain('Available commands are "address-space".'); + expect(response.stderr.toString()).toContain('Use "zowe zos-tso start --help" to view groups, commands, and options.'); + expect(response.stderr.toString()).toContain('Error: Unknown argument: foobar'); }); it("should fail with invalid option", async () => { const response = runCliScript(__dirname + "/__scripts__/start_invalid_option.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); - expect(response.stdout.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Unknown arguments: foo-bar, fooBar'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Command entered: "zos-tso start --foo-bar"'); + expect(response.stderr.toString()).toContain('Available commands are "address-space".'); + expect(response.stderr.toString()).toContain('Use "zowe zos-tso start --help" to view groups, commands, and options.'); + expect(response.stderr.toString()).toContain('Error: Unknown arguments: foo-bar, fooBar'); }); }); diff --git a/packages/cli/__tests__/zostso/__integration__/stop/__scripts__/stop_invalid_option.sh b/packages/cli/__tests__/zostso/__integration__/stop/__scripts__/stop_invalid_option.sh index 8c24271806..4ed8f8a1ff 100755 --- a/packages/cli/__tests__/zostso/__integration__/stop/__scripts__/stop_invalid_option.sh +++ b/packages/cli/__tests__/zostso/__integration__/stop/__scripts__/stop_invalid_option.sh @@ -2,5 +2,5 @@ set -e echo "================Z/OS CONSOLE INVALID PARAMETERS===============" -zowe zos-tso start as --foo-bar +zowe zos-tso stop as --foo-bar exit $? \ No newline at end of file diff --git a/packages/cli/__tests__/zostso/__integration__/stop/__snapshots__/cli.zos-tso.stop.integration.test.ts.snap b/packages/cli/__tests__/zostso/__integration__/stop/__snapshots__/cli.zos-tso.stop.integration.test.ts.snap index f5b69e2d3c..c22d7fea51 100644 --- a/packages/cli/__tests__/zostso/__integration__/stop/__snapshots__/cli.zos-tso.stop.integration.test.ts.snap +++ b/packages/cli/__tests__/zostso/__integration__/stop/__snapshots__/cli.zos-tso.stop.integration.test.ts.snap @@ -48,39 +48,3 @@ exports[`zos-tso stop should display the help 1`] = ` \\"data\\": \\"\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Stop TSO/E address space.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-tso stop \\\\n\\\\n Where is one of the following:\\\\n\\\\n COMMANDS\\\\n --------\\\\n\\\\n address-space | as Stop a TSO address space, from which you previously started\\\\n and received a token (a.k.a 'servlet-key'). \\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --help-examples (boolean)\\\\n\\\\n Display examples for all the commands in a group\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n\\" }" `; - -exports[`zos-tso stop should fail with invalid option 1`] = ` -"Command Error: -Unknown arguments: foo-bar, fooBar -Command failed due to improper syntax -Command entered: \\"zos-tso start as --foo-bar\\" -Available commands are \\"address-space\\". -Use \\"zowe zos-tso start --help\\" to view groups, commands, and options. -Error Details: -Unknown arguments: foo-bar, fooBar -" -`; - -exports[`zos-tso stop should fail with invalid option 2`] = ` -"================Z/OS CONSOLE INVALID PARAMETERS=============== -" -`; - -exports[`zos-tso stop should fail with invalid parameter 1`] = ` -"Command Error: -Unknown argument: foobar -Command failed due to improper syntax -Did you mean: zos-tso stop as? - -Command entered: \\"zos-tso stop foobar\\" -Available commands are \\"address-space\\". -Use \\"zowe zos-tso stop --help\\" to view groups, commands, and options. -Error Details: -Unknown argument: foobar -" -`; - -exports[`zos-tso stop should fail with invalid parameter 2`] = ` -"================Z/OS CONSOLE INVALID PARAMETERS=============== -" -`; diff --git a/packages/cli/__tests__/zostso/__integration__/stop/cli.zos-tso.stop.integration.test.ts b/packages/cli/__tests__/zostso/__integration__/stop/cli.zos-tso.stop.integration.test.ts index 1de660fbfb..94df0a3f6d 100644 --- a/packages/cli/__tests__/zostso/__integration__/stop/cli.zos-tso.stop.integration.test.ts +++ b/packages/cli/__tests__/zostso/__integration__/stop/cli.zos-tso.stop.integration.test.ts @@ -36,14 +36,25 @@ describe("zos-tso stop", () => { it("should fail with invalid parameter", async () => { const response = runCliScript(__dirname + "/__scripts__/stop_invalid_parameter.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); - expect(response.stdout.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Unknown argument: foobar'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Did you mean: zos-tso stop'); + expect(response.stderr.toString()).toContain('Command entered: "zos-tso stop foobar"'); + expect(response.stderr.toString()).toContain('Available commands are "address-space".'); + expect(response.stderr.toString()).toContain('Use "zowe zos-tso stop --help" to view groups, commands, and options.'); + expect(response.stderr.toString()).toContain('Error: Unknown argument: foobar'); }); it("should fail with invalid option", async () => { const response = runCliScript(__dirname + "/__scripts__/stop_invalid_option.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stderr.toString()).toMatchSnapshot(); - expect(response.stdout.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Unknown arguments: foo-bar, fooBar'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Command entered: "zos-tso stop as --foo-bar"'); + expect(response.stderr.toString()).toContain('Available commands are "address-space".'); + expect(response.stderr.toString()).toContain('Use "zowe zos-tso stop --help" to view groups, commands, and options.'); + expect(response.stderr.toString()).toContain('Error: Unknown arguments: foo-bar, fooBar'); }); }); diff --git a/packages/cli/__tests__/zosuss/__integration__/issue/__snapshots__/cli.zos-uss.issue.ssh.integration.test.ts.snap b/packages/cli/__tests__/zosuss/__integration__/issue/__snapshots__/cli.zos-uss.issue.ssh.integration.test.ts.snap index 3637294f8e..3b2ea7ef42 100644 --- a/packages/cli/__tests__/zosuss/__integration__/issue/__snapshots__/cli.zos-uss.issue.ssh.integration.test.ts.snap +++ b/packages/cli/__tests__/zosuss/__integration__/issue/__snapshots__/cli.zos-uss.issue.ssh.integration.test.ts.snap @@ -141,16 +141,3 @@ exports[`zos-uss issue ssh command should display the help 1`] = ` \\"data\\": \\"\\\\n COMMAND NAME\\\\n ------------\\\\n\\\\n command | cmd | ssh\\\\n\\\\n DESCRIPTION\\\\n -----------\\\\n\\\\n Issue a z/OS USS command\\\\n\\\\n Note: The common CLI 'Base Connection Options' of token-type and token-value are\\\\n not applicable to the ssh command, since the ssh service is not accessible\\\\n through APIML.\\\\n\\\\n USAGE\\\\n -----\\\\n\\\\n zowe zos-ssh issue command [options]\\\\n\\\\n POSITIONAL ARGUMENTS\\\\n --------------------\\\\n\\\\n command\\\\t\\\\t (string)\\\\n\\\\n z/OS USS command to issue\\\\n\\\\n OPTIONS\\\\n -------\\\\n\\\\n --cwd (string)\\\\n\\\\n Working directory in which to execute the command\\\\n\\\\n Z/OS SSH CONNECTION OPTIONS\\\\n ---------------------------\\\\n\\\\n --host | -H (string)\\\\n\\\\n The z/OS SSH server host name.\\\\n\\\\n --port | -P (number)\\\\n\\\\n The z/OS SSH server port.\\\\n\\\\n Default value: 22\\\\n\\\\n --user | -u (string)\\\\n\\\\n Mainframe user name, which can be the same as your TSO login.\\\\n\\\\n --password | --pass | --pw (string)\\\\n\\\\n Mainframe password, which can be the same as your TSO password.\\\\n\\\\n --privateKey | --key | --pk (string)\\\\n\\\\n Path to a file containing your private key, that must match a public key stored\\\\n in the server for authentication\\\\n\\\\n --keyPassphrase | --passphrase | --kp (string)\\\\n\\\\n Private key passphrase, which unlocks the private key.\\\\n\\\\n --handshakeTimeout | --timeout | --to (number)\\\\n\\\\n How long in milliseconds to wait for the SSH handshake to complete.\\\\n\\\\n PROFILE OPTIONS\\\\n ---------------\\\\n\\\\n --ssh-profile | --ssh-p (string)\\\\n\\\\n The name of a (ssh) profile to load for this command execution.\\\\n\\\\n --base-profile | --base-p (string)\\\\n\\\\n The name of a (base) profile to load for this command execution.\\\\n\\\\n BASE CONNECTION OPTIONS\\\\n -----------------------\\\\n\\\\n --reject-unauthorized | --ru (boolean)\\\\n\\\\n Reject self-signed certificates.\\\\n\\\\n Default value: true\\\\n\\\\n --token-type | --tt (string)\\\\n\\\\n The type of token to get and use for the API. Omit this option to use the\\\\n default token type, which is provided by 'zowe auth login'.\\\\n\\\\n --token-value | --tv (string)\\\\n\\\\n The value of the token to pass to the API.\\\\n\\\\n --cert-file (local file path)\\\\n\\\\n The file path to a certificate file to use for authentication\\\\n\\\\n --cert-key-file (local file path)\\\\n\\\\n The file path to a certificate key file to use for authentication\\\\n\\\\n GLOBAL OPTIONS\\\\n --------------\\\\n\\\\n --show-inputs-only (boolean)\\\\n\\\\n Show command inputs and do not run the command\\\\n\\\\n --response-format-json | --rfj (boolean)\\\\n\\\\n Produce JSON formatted data from a command\\\\n\\\\n --help | -h (boolean)\\\\n\\\\n Display help text\\\\n\\\\n --help-web | --hw (boolean)\\\\n\\\\n Display HTML help in browser\\\\n\\\\n EXAMPLES\\\\n --------\\\\n\\\\n - Issue a simple command, giving the working directory:\\\\n\\\\n $ zowe zos-ssh issue command \\\\\\"npm install express\\\\\\" --cwd /u/cicprov/mnt/CICPY01I/bundles/myapp \\\\n\\\\n\\" }" `; - -exports[`zos-uss issue ssh command should fail due to invalid ssh command 1`] = ` -"Command Error: -Unknown argument: ss -Command failed due to improper syntax -Did you mean: zos-uss issue ssh? - -Command entered: \\"zos-uss issue ss\\" -Use \\"zowe --help\\" to view groups, commands, and options. -Error Details: -Unknown argument: ss -" -`; diff --git a/packages/cli/__tests__/zosuss/__integration__/issue/cli.zos-uss.issue.ssh.integration.test.ts b/packages/cli/__tests__/zosuss/__integration__/issue/cli.zos-uss.issue.ssh.integration.test.ts index 2d2e4d340f..32a5978676 100644 --- a/packages/cli/__tests__/zosuss/__integration__/issue/cli.zos-uss.issue.ssh.integration.test.ts +++ b/packages/cli/__tests__/zosuss/__integration__/issue/cli.zos-uss.issue.ssh.integration.test.ts @@ -38,7 +38,12 @@ describe("zos-uss issue ssh command", () => { it("should fail due to invalid ssh command", async () => { const response = runCliScript(__dirname + "/__scripts__/issue_missing_ssh.sh", TEST_ENVIRONMENT); - expect(response.stderr.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Unknown argument: ss'); + expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); + expect(response.stderr.toString()).toContain('Did you mean: zos-uss issue ssh'); + expect(response.stderr.toString()).toContain('Command entered: "zos-uss issue ss"'); + expect(response.stderr.toString()).toContain('Use "zowe --help" to view groups, commands, and options.'); }); }); diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/Cmd.cli.invalid.profile-spec.integration.test.ts b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/Cmd.cli.invalid.profile-spec.integration.test.ts index 5da118c9ad..3483295980 100644 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/Cmd.cli.invalid.profile-spec.integration.test.ts +++ b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/Cmd.cli.invalid.profile-spec.integration.test.ts @@ -28,7 +28,13 @@ describe("cmd-cli invalid profile-spec", () => { it("should fail the command if the profile property is not supplied and the handler requests a profile", () => { const response = runCliScript(__dirname + "/__scripts__/profile-spec.sh", TEST_ENVIRONMENT.workingDir); expect(response.status).toBe(1); - expect(response.stdout.toString()).toBe(""); - expect(response.stderr.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(''); + expect(response.stderr.toString()).toContain('Internal Error: No profiles of type "blah" were loaded for this command.'); + expect(response.stderr.toString()).toContain('This error can occur for one of two reasons:'); + expect(response.stderr.toString()).toContain('- The "profile" property on the command definition document ' + + 'does NOT specify the requested profile type'); + expect(response.stderr.toString()).toContain('- The profile type is marked "optional", ' + + 'no profiles of type "blah" have been created, ' + + 'and the command handler requested a profile of type "blah" with "failNotFound=true"'); }); }); diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.profile-spec.integration.test.ts.snap b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.profile-spec.integration.test.ts.snap deleted file mode 100644 index a37ab9cb29..0000000000 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invalid/__snapshots__/Cmd.cli.invalid.profile-spec.integration.test.ts.snap +++ /dev/null @@ -1,11 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`cmd-cli invalid profile-spec should fail the command if the profile property is not supplied and the handler requests a profile 1`] = ` -"Command Error: -Internal Error: No profiles of type \\"blah\\" were loaded for this command. -Error Details: -This error can occur for one of two reasons: - - The \\"profile\\" property on the command definition document does NOT specify the requested profile type - - The profile type is marked \\"optional\\", no profiles of type \\"blah\\" have been created, and the command handler requested a profile of type \\"blah\\" with \\"failNotFound=true\\" -" -`; diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/Cmd.cli.invoke.exit143.integration.test.ts b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/Cmd.cli.invoke.exit143.integration.test.ts index 548d00c08d..f883d76897 100644 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/Cmd.cli.invoke.exit143.integration.test.ts +++ b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/Cmd.cli.invoke.exit143.integration.test.ts @@ -30,6 +30,7 @@ describe("cmd-cli invoke exit 143", () => { const response = runCliScript(__dirname + "/__scripts__/exit/exit_143.sh", TEST_ENVIRONMENT.workingDir); expect(response.status).toBe(ONE_FOUR_THREE); - expect(response.stderr.toString()).toMatchSnapshot(); + expect(response.stdout.toString()).toBe(""); + expect(response.stderr.toString()).toContain("Command failed with exit code 143"); }); }); diff --git a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/__snapshots__/Cmd.cli.invoke.exit143.integration.test.ts.snap b/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/__snapshots__/Cmd.cli.invoke.exit143.integration.test.ts.snap deleted file mode 100644 index 97332865c3..0000000000 --- a/packages/imperative/__tests__/__integration__/cmd/__tests__/integration/cli/invoke/__snapshots__/Cmd.cli.invoke.exit143.integration.test.ts.snap +++ /dev/null @@ -1,7 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`cmd-cli invoke exit 143 should allow a handler to set an exit code and throw an error 1`] = ` -"Command Error: -Command failed with exit code 143 -" -`; From 2f3dcfd354e110f0b05e7166b71201e4a2fae549 Mon Sep 17 00:00:00 2001 From: Gene Johnston Date: Fri, 10 Nov 2023 15:01:05 -0500 Subject: [PATCH 08/10] Fix mistakes in testing output. Signed-off-by: Gene Johnston --- .../__integration__/root/__scripts__/invalid_option.sh | 2 +- .../__integration__/root/cli.zos-console.integration.test.ts | 4 ++-- .../__integration__/start/__scripts__/start_invalid_option.sh | 2 +- .../start/cli.zos-tso.start.integration.test.ts | 4 ++-- .../__integration__/stop/__scripts__/stop_invalid_option.sh | 2 +- .../__integration__/stop/cli.zos-tso.stop.integration.test.ts | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/cli/__tests__/zosconsole/__integration__/root/__scripts__/invalid_option.sh b/packages/cli/__tests__/zosconsole/__integration__/root/__scripts__/invalid_option.sh index b69025527f..2c75b32366 100755 --- a/packages/cli/__tests__/zosconsole/__integration__/root/__scripts__/invalid_option.sh +++ b/packages/cli/__tests__/zosconsole/__integration__/root/__scripts__/invalid_option.sh @@ -1,6 +1,6 @@ #!/bin/bash set -e -echo "================Z/OS CONSOLE INVALID PARAMETERS===============" +echo "================Z/OS CONSOLE INVALID OPTION===============" zowe zos-console --foo-bar exit $? diff --git a/packages/cli/__tests__/zosconsole/__integration__/root/cli.zos-console.integration.test.ts b/packages/cli/__tests__/zosconsole/__integration__/root/cli.zos-console.integration.test.ts index 49d9f19470..a9423c17ef 100644 --- a/packages/cli/__tests__/zosconsole/__integration__/root/cli.zos-console.integration.test.ts +++ b/packages/cli/__tests__/zosconsole/__integration__/root/cli.zos-console.integration.test.ts @@ -36,7 +36,7 @@ describe("zos-console", () => { it("should fail with invalid parameter", async () => { const response = runCliScript(__dirname + "/__scripts__/invalid_parameter.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stdout.toString()).toBe(''); + expect(response.stdout.toString()).toContain('================Z/OS CONSOLE INVALID PARAMETERS==============='); expect(response.stderr.toString()).toContain('Unknown argument: foobar'); expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); expect(response.stderr.toString()).toContain('Did you mean: zos-console collect'); @@ -48,7 +48,7 @@ describe("zos-console", () => { it("should fail with invalid option", async () => { const response = runCliScript(__dirname + "/__scripts__/invalid_option.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stdout.toString()).toBe(''); + expect(response.stdout.toString()).toContain('================Z/OS CONSOLE INVALID OPTION==============='); expect(response.stderr.toString()).toContain('Unknown arguments: foo-bar, fooBar'); expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); expect(response.stderr.toString()).toContain('Did you mean: zos-console collect'); diff --git a/packages/cli/__tests__/zostso/__integration__/start/__scripts__/start_invalid_option.sh b/packages/cli/__tests__/zostso/__integration__/start/__scripts__/start_invalid_option.sh index e80cd5736b..21d37b21e2 100755 --- a/packages/cli/__tests__/zostso/__integration__/start/__scripts__/start_invalid_option.sh +++ b/packages/cli/__tests__/zostso/__integration__/start/__scripts__/start_invalid_option.sh @@ -1,6 +1,6 @@ #!/bin/bash set -e -echo "================Z/OS CONSOLE INVALID PARAMETERS===============" +echo "================Z/OS CONSOLE INVALID OPTION===============" zowe zos-tso start --foo-bar exit $? \ No newline at end of file diff --git a/packages/cli/__tests__/zostso/__integration__/start/cli.zos-tso.start.integration.test.ts b/packages/cli/__tests__/zostso/__integration__/start/cli.zos-tso.start.integration.test.ts index 7d81c90fb8..c0a244761a 100644 --- a/packages/cli/__tests__/zostso/__integration__/start/cli.zos-tso.start.integration.test.ts +++ b/packages/cli/__tests__/zostso/__integration__/start/cli.zos-tso.start.integration.test.ts @@ -36,7 +36,7 @@ describe("zos-tso start", () => { it("should fail with invalid parameter", async () => { const response = runCliScript(__dirname + "/__scripts__/start_invalid_parameter.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stdout.toString()).toBe(''); + expect(response.stdout.toString()).toContain('================Z/OS CONSOLE INVALID PARAMETERS==============='); expect(response.stderr.toString()).toContain('Unknown argument: foobar'); expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); expect(response.stderr.toString()).toContain('Did you mean: zos-tso start'); @@ -49,7 +49,7 @@ describe("zos-tso start", () => { it("should fail with invalid option", async () => { const response = runCliScript(__dirname + "/__scripts__/start_invalid_option.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stdout.toString()).toBe(''); + expect(response.stdout.toString()).toContain('================Z/OS CONSOLE INVALID OPTION==============='); expect(response.stderr.toString()).toContain('Unknown arguments: foo-bar, fooBar'); expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); expect(response.stderr.toString()).toContain('Command entered: "zos-tso start --foo-bar"'); diff --git a/packages/cli/__tests__/zostso/__integration__/stop/__scripts__/stop_invalid_option.sh b/packages/cli/__tests__/zostso/__integration__/stop/__scripts__/stop_invalid_option.sh index 4ed8f8a1ff..d71c1545c2 100755 --- a/packages/cli/__tests__/zostso/__integration__/stop/__scripts__/stop_invalid_option.sh +++ b/packages/cli/__tests__/zostso/__integration__/stop/__scripts__/stop_invalid_option.sh @@ -1,6 +1,6 @@ #!/bin/bash set -e -echo "================Z/OS CONSOLE INVALID PARAMETERS===============" +echo "================Z/OS CONSOLE INVALID OPTION===============" zowe zos-tso stop as --foo-bar exit $? \ No newline at end of file diff --git a/packages/cli/__tests__/zostso/__integration__/stop/cli.zos-tso.stop.integration.test.ts b/packages/cli/__tests__/zostso/__integration__/stop/cli.zos-tso.stop.integration.test.ts index 94df0a3f6d..34bd66ab4e 100644 --- a/packages/cli/__tests__/zostso/__integration__/stop/cli.zos-tso.stop.integration.test.ts +++ b/packages/cli/__tests__/zostso/__integration__/stop/cli.zos-tso.stop.integration.test.ts @@ -36,7 +36,7 @@ describe("zos-tso stop", () => { it("should fail with invalid parameter", async () => { const response = runCliScript(__dirname + "/__scripts__/stop_invalid_parameter.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stdout.toString()).toBe(''); + expect(response.stdout.toString()).toContain('================Z/OS CONSOLE INVALID PARAMETERS==============='); expect(response.stderr.toString()).toContain('Unknown argument: foobar'); expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); expect(response.stderr.toString()).toContain('Did you mean: zos-tso stop'); @@ -49,7 +49,7 @@ describe("zos-tso stop", () => { it("should fail with invalid option", async () => { const response = runCliScript(__dirname + "/__scripts__/stop_invalid_option.sh", TEST_ENVIRONMENT); expect(response.status).toBe(1); - expect(response.stdout.toString()).toBe(''); + expect(response.stdout.toString()).toContain('================Z/OS CONSOLE INVALID OPTION==============='); expect(response.stderr.toString()).toContain('Unknown arguments: foo-bar, fooBar'); expect(response.stderr.toString()).toContain('Command failed due to improper syntax'); expect(response.stderr.toString()).toContain('Command entered: "zos-tso stop as --foo-bar"'); From fb8a05f4cf03763a2e5ee7e93d11bf215795557b Mon Sep 17 00:00:00 2001 From: Gene Johnston Date: Fri, 10 Nov 2023 16:19:28 -0500 Subject: [PATCH 09/10] Add changelog Signed-off-by: Gene Johnston --- packages/cli/CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 89efd8c5c3..42b3ad1761 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -2,6 +2,11 @@ All notable changes to the Zowe CLI package will be documented in this file. +## Recent Changes + +- LTS Breaking: Alter the format of error messages to be more clear and actionable. +- LTS Breaking: Remove the ```bright``` command from the product. + ## `7.18.9` - Enhancement: Incorporate all source code from the zowe/imperative Github repository into the zowe/zowe-cli repository. This change should have no user impact. From 8b44dbb2ccdb77cddfaed0e4cc15d4d7e029e674 Mon Sep 17 00:00:00 2001 From: Gene Johnston Date: Sun, 12 Nov 2023 13:48:19 -0500 Subject: [PATCH 10/10] Report removal of getBrightYargsResponse Signed-off-by: Gene Johnston --- packages/imperative/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 5094bdb5a0..2347993a78 100644 --- a/packages/imperative/CHANGELOG.md +++ b/packages/imperative/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Imperative package will be documented in this file. +## Recent Changes + +- LTS Breaking: Replaced the previously deprecated function AbstractCommandYargs.getBrightYargsResponse - use AbstractCommandYargs.getZoweYargsResponse + ## `5.18.4` - BugFix: Removed out of date `Perf-Timing` performance timing package.