From 4f2d79928eb0ad42109c5eab0c0352b32129cee1 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 11:35:21 -0400 Subject: [PATCH 01/24] Add missing shebang lines Signed-off-by: Andrew W. Harn --- .../auto-init/__system__/__scripts__/config_auto_init.sh | 1 + .../__system__/__scripts__/config_auto_init_cert.sh | 1 + .../__system__/__scripts__/config_auto_init_profile.sh | 1 + .../check/status/zosmf.check.status.system.test.ts | 7 +++++-- .../list/systems/zosmf.list.systems.system.test.ts | 7 +++++-- 5 files changed, 13 insertions(+), 4 deletions(-) diff --git a/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init.sh b/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init.sh index 6328d7d363..dd62bf40a8 100755 --- a/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init.sh +++ b/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init.sh @@ -1,3 +1,4 @@ +#!/bin/bash set -e HOST=$1 diff --git a/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init_cert.sh b/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init_cert.sh index 88d6e63d2c..d1478052f2 100755 --- a/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init_cert.sh +++ b/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init_cert.sh @@ -1,3 +1,4 @@ +#!/bin/bash set -e HOST=$1 diff --git a/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init_profile.sh b/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init_profile.sh index 1b39110909..a0ed357b6a 100755 --- a/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init_profile.sh +++ b/packages/cli/__tests__/config/auto-init/__system__/__scripts__/config_auto_init_profile.sh @@ -1,3 +1,4 @@ +#!/bin/bash set -e zowe config auto-init diff --git a/packages/cli/__tests__/zosmf/__system__/check/status/zosmf.check.status.system.test.ts b/packages/cli/__tests__/zosmf/__system__/check/status/zosmf.check.status.system.test.ts index a2cb9867c9..b7c1d8ebcc 100644 --- a/packages/cli/__tests__/zosmf/__system__/check/status/zosmf.check.status.system.test.ts +++ b/packages/cli/__tests__/zosmf/__system__/check/status/zosmf.check.status.system.test.ts @@ -14,6 +14,8 @@ import { TestEnvironment } from "../../../../../../../__tests__/__src__/environm import { ITestPropertiesSchema } from "../../../../../../../__tests__/__src__/properties/ITestPropertiesSchema"; import { stripNewLines } from "../../../../../../../__tests__/__src__/TestUtils"; import { IO } from "@zowe/imperative"; +import { join } from "path"; +import { chmodSync } from "fs"; let testEnvironment: ITestEnvironment; let host: string; @@ -105,10 +107,11 @@ describe("zosmf check status", () => { (!process.env.HTTP_PROXY && !process.env.HTTPS_PROXY ? it : it.skip)("should fail due to invalid port", async () => { // update temporary zowe profile with an invalid port - const scriptPath = testEnvironment.workingDir + "_create_profile_invalid_port"; + const scriptPath = join(testEnvironment.workingDir, "create_profile_invalid_port.sh"); const bogusPort = 12345; - const command = `zowe config set profiles.${testEnvironment.tempProfiles?.zosmf[0]}.properties.port ${bogusPort} --gc`; + const command = `#!/bin/bash\nzowe config set profiles.${testEnvironment.tempProfiles?.zosmf[0]}.properties.port ${bogusPort} --gc`; await IO.writeFileAsync(scriptPath, command); + if (process.platform !== "win32") { chmodSync(scriptPath, 0o755); } let response = runCliScript(scriptPath, testEnvironment); expect(response.status).toBe(0); // now check the status diff --git a/packages/cli/__tests__/zosmf/__system__/list/systems/zosmf.list.systems.system.test.ts b/packages/cli/__tests__/zosmf/__system__/list/systems/zosmf.list.systems.system.test.ts index 790f7849b3..a357c4171a 100644 --- a/packages/cli/__tests__/zosmf/__system__/list/systems/zosmf.list.systems.system.test.ts +++ b/packages/cli/__tests__/zosmf/__system__/list/systems/zosmf.list.systems.system.test.ts @@ -14,6 +14,8 @@ import { TestEnvironment } from "../../../../../../../__tests__/__src__/environm import { ITestPropertiesSchema } from "../../../../../../../__tests__/__src__/properties/ITestPropertiesSchema"; import { stripNewLines } from "../../../../../../../__tests__/__src__/TestUtils"; import { IO } from "@zowe/imperative"; +import { join } from "path"; +import { chmodSync } from "fs"; let testEnvironment: ITestEnvironment; let host: string; @@ -123,10 +125,11 @@ describe("zosmf list systems", () => { (!process.env.HTTP_PROXY && !process.env.HTTPS_PROXY ? it : it.skip)("should fail due to invalid port", async () => { // update temporary zowe profile with an invalid port - const scriptPath = testEnvironment.workingDir + "_create_profile_invalid_port"; + const scriptPath = join(testEnvironment.workingDir, "create_profile_invalid_port.sh"); const bogusPort = 12345; - const command = `zowe config set profiles.${testEnvironment.tempProfiles?.zosmf[0]}.properties.port ${bogusPort} --gc`; + const command = `#!/bin/bash\nzowe config set profiles.${testEnvironment.tempProfiles?.zosmf[0]}.properties.port ${bogusPort} --gc`; await IO.writeFileAsync(scriptPath, command); + if (process.platform !== "win32") { chmodSync(scriptPath, 0o755); } let response = runCliScript(scriptPath, testEnvironment); expect(response.status).toBe(0); // now check the status From 2f8655d982baa2b4eba7dbbdb1cb3678b9786175 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 11:35:55 -0400 Subject: [PATCH 02/24] Add checks that required CLI scripts ran correctly. Signed-off-by: Andrew W. Harn --- .../__system__/cli.config.auto-init.system.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/cli/__tests__/config/auto-init/__system__/cli.config.auto-init.system.test.ts b/packages/cli/__tests__/config/auto-init/__system__/cli.config.auto-init.system.test.ts index 863f93d0ef..9a4bd30fe2 100644 --- a/packages/cli/__tests__/config/auto-init/__system__/cli.config.auto-init.system.test.ts +++ b/packages/cli/__tests__/config/auto-init/__system__/cli.config.auto-init.system.test.ts @@ -45,6 +45,7 @@ describe("config auto-init without profile", () => { base.rejectUnauthorized ] ); + expect(response.status).toEqual(0); const config = fs.readFileSync(path.join(TEST_ENVIRONMENT.workingDir, "zowe.config.json")).toString(); // Typecasting because of this issue: https://github.com/kaelzhang/node-comment-json/issues/42 @@ -107,6 +108,7 @@ describe("config auto-init without profile", () => { base.rejectUnauthorized ] ); + expect(response.status).toEqual(0); config = fs.readFileSync(path.join(TEST_ENVIRONMENT.workingDir, "zowe.config.json")).toString(); // Typecasting because of this issue: https://github.com/kaelzhang/node-comment-json/issues/42 @@ -186,6 +188,7 @@ describe("config auto-init without profile and with certificates", () => { base.rejectUnauthorized ] ); + expect(response.status).toEqual(0); const config = fs.readFileSync(path.join(TEST_ENVIRONMENT.workingDir, "zowe.config.json")).toString(); // Typecasting because of this issue: https://github.com/kaelzhang/node-comment-json/issues/42 @@ -254,6 +257,7 @@ describe("config auto-init without profile and with certificates", () => { base.rejectUnauthorized ] ); + expect(response.status).toEqual(0); config = fs.readFileSync(path.join(TEST_ENVIRONMENT.workingDir, "zowe.config.json")).toString(); // Typecasting because of this issue: https://github.com/kaelzhang/node-comment-json/issues/42 @@ -319,6 +323,7 @@ describe("config auto-init with profile", () => { it("should successfully issue the auto-init command", () => { const response = runCliScript(__dirname + "/__scripts__/config_auto_init_profile.sh", TEST_ENVIRONMENT); + expect(response.status).toEqual(0); const config = fs.readFileSync(path.join(TEST_ENVIRONMENT.workingDir, "zowe.config.json")).toString(); // Typecasting because of this issue: https://github.com/kaelzhang/node-comment-json/issues/42 @@ -379,6 +384,7 @@ describe("config auto-init with profile and certificates", () => { it("should successfully issue the auto-init command", () => { const response = runCliScript(__dirname + "/__scripts__/config_auto_init_profile.sh", TEST_ENVIRONMENT); + expect(response.status).toEqual(0); const config = fs.readFileSync(path.join(TEST_ENVIRONMENT.workingDir, "zowe.config.json")).toString(); // Typecasting because of this issue: https://github.com/kaelzhang/node-comment-json/issues/42 From 0da0ad0d777a85d2dd545ee87ebec5a4f283b2a4 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 11:36:07 -0400 Subject: [PATCH 03/24] Use local IP address due to AggregateError Signed-off-by: Andrew W. Harn --- packages/zosuss/__tests__/__system__/Shell.system.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosuss/__tests__/__system__/Shell.system.test.ts b/packages/zosuss/__tests__/__system__/Shell.system.test.ts index 1f8c07360d..eece57bd59 100644 --- a/packages/zosuss/__tests__/__system__/Shell.system.test.ts +++ b/packages/zosuss/__tests__/__system__/Shell.system.test.ts @@ -126,7 +126,7 @@ describe("zowe uss issue ssh api call test", () => { it("should handle errors correctly when connection is refused", async () => { const invalidSshSession = new SshSession({ - hostname: "localhost", + hostname: "127.0.0.1", port: 22, user: "root", password: "**ThisPasswordIsExpectedNotToBeTheRealPasswordForRoot**" From 977706061ea6e634e66e107b8115fd6d8a413e7b Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 11:36:32 -0400 Subject: [PATCH 04/24] Use cross platform supported tools in Bash scripts Signed-off-by: Andrew W. Harn --- .../stop/__scripts__/address-space/as_fully_qualified.sh | 3 ++- .../stop/__scripts__/address-space/as_success_stop.sh | 3 ++- .../stop/__scripts__/address-space/as_success_stop_rfj.sh | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_fully_qualified.sh b/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_fully_qualified.sh index 97bf3bf6e4..a4966fd2d0 100755 --- a/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_fully_qualified.sh +++ b/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_fully_qualified.sh @@ -7,7 +7,8 @@ PORT=$3 USER=$4 PASSWORD=$5 -SERVLET_KEY=`zowe tso start as --host $HOST --account $ACCOUNT --port $PORT --user $USER --password $PASSWORD --ru=false | grep -oP "(?<=: ).*"` +# SERVLET_KEY=`zowe tso start as --host $HOST --account $ACCOUNT --port $PORT --user $USER --password $PASSWORD --ru=false | grep -oP "(?<=: ).*"` +SERVLET_KEY=`zowe tso start as --host $HOST --account $ACCOUNT --port $PORT --user $USER --password $PASSWORD --ru=false | awk -F': ' '{print $2}' | sed '1p;d'` zowe zos-tso stop address-space ${SERVLET_KEY} --host $HOST --port $PORT --user $USER --password $PASSWORD --ru=false exit $? \ No newline at end of file diff --git a/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_success_stop.sh b/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_success_stop.sh index 88d2188082..a32a4d780a 100755 --- a/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_success_stop.sh +++ b/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_success_stop.sh @@ -1,7 +1,8 @@ #!/bin/bash set -e -SERVLET_KEY=`zowe tso start as | grep -oP "(?<=: ).*"` +# SERVLET_KEY=`zowe tso start as | grep -oP "(?<=: ).*"` +SERVLET_KEY=`zowe tso start as | awk -F': ' '{print $2}' | sed '1p;d'` zowe zos-tso stop address-space ${SERVLET_KEY} exit $? \ No newline at end of file diff --git a/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_success_stop_rfj.sh b/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_success_stop_rfj.sh index f587af271f..bcccfa0f26 100755 --- a/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_success_stop_rfj.sh +++ b/packages/cli/__tests__/zostso/__system__/stop/__scripts__/address-space/as_success_stop_rfj.sh @@ -1,7 +1,8 @@ #!/bin/bash set -e -SERVLET_KEY=`zowe tso start as | grep -oP "(?<=: ).*"` +# SERVLET_KEY=`zowe tso start as | grep -oP "(?<=: ).*"` +SERVLET_KEY=`zowe tso start as | awk -F': ' '{print $2}' | sed '1p;d'` zowe zos-tso stop address-space ${SERVLET_KEY} --response-format-json exit $? \ No newline at end of file From f7a61a6dd4853c544f18bfcdc62aa2a331c98e7b Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 11:37:11 -0400 Subject: [PATCH 05/24] Fix DS name too long issues Signed-off-by: Andrew W. Harn --- .../__tests__/__system__/methods/invoke/Invoke.system.test.ts | 2 +- .../__tests__/__system__/methods/list/List.system.test.ts | 2 +- .../__tests__/__system__/methods/search/Search.system.test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/zosfiles/__tests__/__system__/methods/invoke/Invoke.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/invoke/Invoke.system.test.ts index a1daccc33d..ffe59aa738 100644 --- a/packages/zosfiles/__tests__/__system__/methods/invoke/Invoke.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/invoke/Invoke.system.test.ts @@ -205,7 +205,7 @@ describe("Invoke AMS - encoded", () => { systemProps = testEnvironment.systemTestProperties; REAL_SESSION = TestEnvironment.createZosmfSession(testEnvironment); - dsname = getUniqueDatasetName(`${systemProps.zosmf.user}.ZOSFILE.ENCO#ED.VSAM`); + dsname = getUniqueDatasetName(`${systemProps.zosmf.user}.ZOSFILE.ENCO#ED.VSAM`, false, 1); volume = systemProps.datasets.vol.toUpperCase(); }); diff --git a/packages/zosfiles/__tests__/__system__/methods/list/List.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/list/List.system.test.ts index 4e3981e4ae..b9011e5724 100644 --- a/packages/zosfiles/__tests__/__system__/methods/list/List.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/list/List.system.test.ts @@ -648,7 +648,7 @@ describe("List command group", () => { let caughtError; try { - response = await List.dataSetsMatchingPattern(REAL_SESSION, [dsname + ".INVALID"]); + response = await List.dataSetsMatchingPattern(REAL_SESSION, [dsname + ".INVAL"]); } catch (error) { caughtError = error; } diff --git a/packages/zosfiles/__tests__/__system__/methods/search/Search.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/search/Search.system.test.ts index db839abc14..f982c81787 100644 --- a/packages/zosfiles/__tests__/__system__/methods/search/Search.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/search/Search.system.test.ts @@ -59,7 +59,7 @@ describe("Search", () => { let expectedApiResponse: any; beforeAll(async () => { - dsnPrefix = getUniqueDatasetName(`${defaultSystem.zosmf.user}.ZOSFILES.SEARCH`); + dsnPrefix = getUniqueDatasetName(`${defaultSystem.zosmf.user}.ZOSFILES.SEARCH`, false, 1); pattern = dsnPrefix + ".*"; goodDsNames = [`${dsnPrefix}.SEQ1`, `${dsnPrefix}.SEQ4`, `${dsnPrefix}.SEQ5`]; From 724cb45bd642101bd271545ab9b63c8c2d1d67f2 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 11:37:50 -0400 Subject: [PATCH 06/24] Handle ECONNRESET error when reusing sockets in AbstractRestClient Signed-off-by: Andrew W. Harn --- .../client/AbstractRestClient.unit.test.ts | 50 +++++++++++++++++++ .../__model__/MockHttpRequestResponse.ts | 6 +++ .../src/rest/src/client/AbstractRestClient.ts | 19 +++++-- 3 files changed, 70 insertions(+), 5 deletions(-) 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 d77a854961..d81ea50636 100644 --- a/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts +++ b/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts @@ -426,6 +426,56 @@ describe("AbstractRestClient tests", () => { expect(error.message).toMatchSnapshot(); }); + // called IRL when socket is reused and HTTP 1.1 race condition is hit + it("should handle a socket reuse error", async () => { + const errorObject: any = { + name: "socket hang up", + message: "socket hang up", + code: "ECONNRESET" + }; + + let reusedSocket = true; + const requestFnc = jest.fn((options, callback) => { + let emitter = new MockHttpRequestResponse(); + + ProcessUtils.nextTick(() => { + callback(emitter); + + if (reusedSocket) { + emitter.reusedSocket = true; + ProcessUtils.nextTick(() => { + emitter.emit("error", errorObject); + reusedSocket = false; + }); + } else { + ProcessUtils.nextTick(() => { + emitter.emit("data", Buffer.from("\"response data\"", "utf8")); + }); + + ProcessUtils.nextTick(() => { + emitter.emit("end"); + }); + } + }); + return emitter; + }); + + (https.request as any) = requestFnc; + + let error; + let response: string = ""; + + try { + response = await RestClient.getExpectString(new Session({hostname: "test"}), "/resource"); + } catch (thrownError) { + error = thrownError; + } + + expect(error).not.toBeDefined(); + expect(response).toEqual("\"response data\""); + expect(requestFnc).toHaveBeenCalledTimes(2); + }); + it("should call http request for http requests", async () => { const requestEmitter = new MockHttpRequestResponse(); const httpRequestFnc = jest.fn((options, callback) => { diff --git a/packages/imperative/src/rest/__tests__/client/__model__/MockHttpRequestResponse.ts b/packages/imperative/src/rest/__tests__/client/__model__/MockHttpRequestResponse.ts index 5306899a13..59a92ab446 100644 --- a/packages/imperative/src/rest/__tests__/client/__model__/MockHttpRequestResponse.ts +++ b/packages/imperative/src/rest/__tests__/client/__model__/MockHttpRequestResponse.ts @@ -65,4 +65,10 @@ export class MockHttpRequestResponse extends EventEmitter { * @memberof RequestOrResponse */ public headers: { [key: string]: any }; + + /** + * Simulate a reused socket + * @memberof MockHttpRequestResponse + */ + public reusedSocket: boolean = false; } diff --git a/packages/imperative/src/rest/src/client/AbstractRestClient.ts b/packages/imperative/src/rest/src/client/AbstractRestClient.ts index 46b6eec4b3..471c16a721 100644 --- a/packages/imperative/src/rest/src/client/AbstractRestClient.ts +++ b/packages/imperative/src/rest/src/client/AbstractRestClient.ts @@ -330,11 +330,20 @@ export abstract class AbstractRestClient { * Invoke any onError method whenever an error occurs on writing */ clientRequest.on("error", (errorResponse: any) => { - reject(this.populateError({ - msg: "Failed to send an HTTP request.", - causeErrors: errorResponse, - source: "client" - })); + // Handle the HTTP 1.1 Keep-Alive race condition + if (errorResponse.code === "ECONNRESET" && clientRequest.reusedSocket) { + this.request(options).then((response: string) => { + resolve(response); + }).catch((err) => { + reject(err); + }); + } else { + reject(this.populateError({ + msg: "Failed to send an HTTP request.", + causeErrors: errorResponse, + source: "client" + })); + } }); if (options.requestStream != null) { From cd63e8f006fd5c0e87f47c3ce325440517936988 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 14:47:39 -0400 Subject: [PATCH 07/24] Add CIM flag to skip CIM 1.0 tests on systems that do not support it Signed-off-by: Andrew W. Harn --- .../properties/default_properties.yaml | 2 + .../__src__/properties/ITestZosJobsSchema.ts | 1 + ...li.zos-jobs.delete.old-jobs.system.test.ts | 57 +++++--- .../__system__/CancelJobs.system.test.ts | 135 +++++++++++------- .../__system__/DeleteJobs.system.test.ts | 37 +++-- 5 files changed, 151 insertions(+), 81 deletions(-) diff --git a/__tests__/__resources__/properties/default_properties.yaml b/__tests__/__resources__/properties/default_properties.yaml index 9e3c215a5e..a3c570b6bc 100644 --- a/__tests__/__resources__/properties/default_properties.yaml +++ b/__tests__/__resources__/properties/default_properties.yaml @@ -104,6 +104,8 @@ zosjobs: modifiedJobclass: B # System affinity sysaff: zosjobs-sysaff + # CIM Support + skipCIM: cim-skipped #-----------------------------------------------------------------------------# # Set of properties for testing provisioning # #-----------------------------------------------------------------------------# diff --git a/__tests__/__src__/properties/ITestZosJobsSchema.ts b/__tests__/__src__/properties/ITestZosJobsSchema.ts index ba6685b85d..cb18e46020 100644 --- a/__tests__/__src__/properties/ITestZosJobsSchema.ts +++ b/__tests__/__src__/properties/ITestZosJobsSchema.ts @@ -16,4 +16,5 @@ export interface ITestZosJobsSchema { jobclass: string; modifiedJobclass: string; sysaff: string; + skipCIM?: boolean; } diff --git a/packages/cli/__tests__/zosjobs/__system__/delete/cli.zos-jobs.delete.old-jobs.system.test.ts b/packages/cli/__tests__/zosjobs/__system__/delete/cli.zos-jobs.delete.old-jobs.system.test.ts index be09c0dfaf..743e3a41a9 100644 --- a/packages/cli/__tests__/zosjobs/__system__/delete/cli.zos-jobs.delete.old-jobs.system.test.ts +++ b/packages/cli/__tests__/zosjobs/__system__/delete/cli.zos-jobs.delete.old-jobs.system.test.ts @@ -17,6 +17,7 @@ import { runCliScript } from "@zowe/cli-test-utils"; // Test Environment populated in the beforeAll(); let TEST_ENVIRONMENT: ITestEnvironment; let IEFBR14_JCL: string; +const modifyVersionDefaultUsesCIM = false; describe("zos-jobs delete old-jobs command", () => { // Create the unique test environment @@ -39,35 +40,51 @@ describe("zos-jobs delete old-jobs command", () => { describe("successful scenario", () => { it("should delete all old jobs sequentially default", () => { - const response = runCliScript(__dirname + "/__scripts__/old-jobs/delete_old_jobs.sh", - TEST_ENVIRONMENT, [IEFBR14_JCL]); - expect(response.status).toBe(0); - expect(response.stderr.toString()).toBe(""); - expect(response.stdout.toString()).toContain("Successfully deleted"); + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const response = runCliScript(__dirname + "/__scripts__/old-jobs/delete_old_jobs.sh", + TEST_ENVIRONMENT, [IEFBR14_JCL]); + expect(response.status).toBe(0); + expect(response.stderr.toString()).toBe(""); + expect(response.stdout.toString()).toContain("Successfully deleted"); + } }); it("should delete all old jobs in parallel default", () => { - const response = runCliScript(__dirname + "/__scripts__/old-jobs/delete_old_jobs.sh", - TEST_ENVIRONMENT, [IEFBR14_JCL, "--mcr", "0"]); - expect(response.status).toBe(0); - expect(response.stderr.toString()).toBe(""); - expect(response.stdout.toString()).toContain("Successfully deleted"); + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const response = runCliScript(__dirname + "/__scripts__/old-jobs/delete_old_jobs.sh", + TEST_ENVIRONMENT, [IEFBR14_JCL, "--mcr", "0"]); + expect(response.status).toBe(0); + expect(response.stderr.toString()).toBe(""); + expect(response.stdout.toString()).toContain("Successfully deleted"); + } }); it("should delete all old jobs with modifyVersion 1.0 sequentially", () => { - const response = runCliScript(__dirname + "/__scripts__/old-jobs/delete_old_jobs.sh", - TEST_ENVIRONMENT, [IEFBR14_JCL, "--modify-version", "1.0"]); - expect(response.status).toBe(0); - expect(response.stderr.toString()).toBe(""); - expect(response.stdout.toString()).toContain("Successfully deleted"); + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const response = runCliScript(__dirname + "/__scripts__/old-jobs/delete_old_jobs.sh", + TEST_ENVIRONMENT, [IEFBR14_JCL, "--modify-version", "1.0"]); + expect(response.status).toBe(0); + expect(response.stderr.toString()).toBe(""); + expect(response.stdout.toString()).toContain("Successfully deleted"); + } }); it("should delete all old jobs with modifyVersion 1.0 parallel", () => { - const response = runCliScript(__dirname + "/__scripts__/old-jobs/delete_old_jobs.sh", - TEST_ENVIRONMENT, [IEFBR14_JCL, "--mcr", "0", "--modify-version", "1.0"]); - expect(response.status).toBe(0); - expect(response.stderr.toString()).toBe(""); - expect(response.stdout.toString()).toContain("Successfully deleted"); + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const response = runCliScript(__dirname + "/__scripts__/old-jobs/delete_old_jobs.sh", + TEST_ENVIRONMENT, [IEFBR14_JCL, "--mcr", "0", "--modify-version", "1.0"]); + expect(response.status).toBe(0); + expect(response.stderr.toString()).toBe(""); + expect(response.stdout.toString()).toContain("Successfully deleted"); + } }); it("should delete all old jobs with modifyVersion 2.0 sequentially", () => { diff --git a/packages/zosjobs/__tests__/__system__/CancelJobs.system.test.ts b/packages/zosjobs/__tests__/__system__/CancelJobs.system.test.ts index 5ce5b20883..ecd4bb3a20 100644 --- a/packages/zosjobs/__tests__/__system__/CancelJobs.system.test.ts +++ b/packages/zosjobs/__tests__/__system__/CancelJobs.system.test.ts @@ -22,6 +22,7 @@ let sleepJCL: string; let systemProps: ITestPropertiesSchema; let testEnvironment: ITestEnvironment; const LONG_TIMEOUT = 100000; // 100 second timeout - jobs could take a while to complete due to system load +const modifyVersionDefaultUsesCIM = false; describe("CancelJobs System tests", () => { @@ -44,11 +45,15 @@ describe("CancelJobs System tests", () => { describe("Positive tests", () => { it("should be able to cancel a job using cancelJob (modify version 1)", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); - expect(job.retcode).toBeNull(); // job is not complete, no CC - const response = await CancelJobs.cancelJob(REAL_SESSION, job.jobname, job.jobid, "1.0"); - expect(response).toBeUndefined(); - testEnvironment.resources.jobs.push(job); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); + expect(job.retcode).toBeNull(); // job is not complete, no CC + const response = await CancelJobs.cancelJob(REAL_SESSION, job.jobname, job.jobid, "1.0"); + expect(response).toBeUndefined(); + testEnvironment.resources.jobs.push(job); + } }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJob (modify version 2)", async () => { @@ -61,20 +66,28 @@ describe("CancelJobs System tests", () => { }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJob (modify version default)", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); - expect(job.retcode).toBeNull(); // job is not complete, no CC - const response = await CancelJobs.cancelJob(REAL_SESSION, job.jobname, job.jobid); - expect(response).not.toBeUndefined(); - expect(response?.status).toEqual("0"); // intermittent failure - testEnvironment.resources.jobs.push(job); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); + expect(job.retcode).toBeNull(); // job is not complete, no CC + const response = await CancelJobs.cancelJob(REAL_SESSION, job.jobname, job.jobid); + expect(response).not.toBeUndefined(); + expect(response?.status).toEqual("0"); // intermittent failure + testEnvironment.resources.jobs.push(job); + } }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJobForJob (modify version 1)", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); - expect(job.retcode).toBeNull(); // job is not complete, no CC - const response = await CancelJobs.cancelJobForJob(REAL_SESSION, job, "1.0"); - expect(response).toBeUndefined(); - testEnvironment.resources.jobs.push(job); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); + expect(job.retcode).toBeNull(); // job is not complete, no CC + const response = await CancelJobs.cancelJobForJob(REAL_SESSION, job, "1.0"); + expect(response).toBeUndefined(); + testEnvironment.resources.jobs.push(job); + } }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJobForJob (modify version 2)", async () => { @@ -87,20 +100,28 @@ describe("CancelJobs System tests", () => { }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJobForJob (modify version default)", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); - expect(job.retcode).toBeNull(); // job is not complete, no CC - const response = await CancelJobs.cancelJobForJob(REAL_SESSION, job); - expect(response).not.toBeUndefined(); - expect(response?.status).toEqual("0"); // intermittent failure - testEnvironment.resources.jobs.push(job); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); + expect(job.retcode).toBeNull(); // job is not complete, no CC + const response = await CancelJobs.cancelJobForJob(REAL_SESSION, job); + expect(response).not.toBeUndefined(); + expect(response?.status).toEqual("0"); // intermittent failure + testEnvironment.resources.jobs.push(job); + } }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJobCommon (job version 1)", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); - expect(job.retcode).toBeNull(); // job is not complete, no CC - const response = await CancelJobs.cancelJobCommon(REAL_SESSION, {jobname: job.jobname, jobid: job.jobid, version: "1.0"}); - expect(response).toBeUndefined(); - testEnvironment.resources.jobs.push(job); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); + expect(job.retcode).toBeNull(); // job is not complete, no CC + const response = await CancelJobs.cancelJobCommon(REAL_SESSION, {jobname: job.jobname, jobid: job.jobid, version: "1.0"}); + expect(response).toBeUndefined(); + testEnvironment.resources.jobs.push(job); + } }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJobCommon (job version 2.0 - synchronous)", async () => { @@ -113,11 +134,15 @@ describe("CancelJobs System tests", () => { }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJobCommon (job version default)", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); - expect(job.retcode).toBeNull(); // job is not complete, no CC - const response = await CancelJobs.cancelJobCommon(REAL_SESSION, {jobname: job.jobname, jobid: job.jobid}); - expect(response?.status).toEqual("0"); // intermittent failure - testEnvironment.resources.jobs.push(job); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); + expect(job.retcode).toBeNull(); // job is not complete, no CC + const response = await CancelJobs.cancelJobCommon(REAL_SESSION, {jobname: job.jobname, jobid: job.jobid}); + expect(response?.status).toEqual("0"); // intermittent failure + testEnvironment.resources.jobs.push(job); + } }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJobCommon (job version 2.0 - synchronous) and return an error feedback object", async () => { @@ -206,29 +231,41 @@ describe("CancelJobs System tests - encoded", () => { describe("Positive tests", () => { it("should be able to cancel a job using cancelJob (modify version default)", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); - expect(job.retcode).toBeNull(); // job is not complete, no CC - const response = await CancelJobs.cancelJob(REAL_SESSION, job.jobname, job.jobid); - expect(response).not.toBeUndefined(); - expect(response?.status).toEqual("0"); // intermittent failure - testEnvironment.resources.jobs.push(job); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); + expect(job.retcode).toBeNull(); // job is not complete, no CC + const response = await CancelJobs.cancelJob(REAL_SESSION, job.jobname, job.jobid); + expect(response).not.toBeUndefined(); + expect(response?.status).toEqual("0"); // intermittent failure + testEnvironment.resources.jobs.push(job); + } }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJobForJob (modify version default)", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); - expect(job.retcode).toBeNull(); // job is not complete, no CC - const response = await CancelJobs.cancelJobForJob(REAL_SESSION, job); - expect(response).not.toBeUndefined(); - expect(response?.status).toEqual("0"); // intermittent failure - testEnvironment.resources.jobs.push(job); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); + expect(job.retcode).toBeNull(); // job is not complete, no CC + const response = await CancelJobs.cancelJobForJob(REAL_SESSION, job); + expect(response).not.toBeUndefined(); + expect(response?.status).toEqual("0"); // intermittent failure + testEnvironment.resources.jobs.push(job); + } }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJobCommon (job version default)", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); - expect(job.retcode).toBeNull(); // job is not complete, no CC - const response = await CancelJobs.cancelJobCommon(REAL_SESSION, {jobname: job.jobname, jobid: job.jobid}); - expect(response?.status).toEqual("0"); // intermittent failure - testEnvironment.resources.jobs.push(job); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: sleepJCL, status: "INPUT"}); + expect(job.retcode).toBeNull(); // job is not complete, no CC + const response = await CancelJobs.cancelJobCommon(REAL_SESSION, {jobname: job.jobname, jobid: job.jobid}); + expect(response?.status).toEqual("0"); // intermittent failure + testEnvironment.resources.jobs.push(job); + } }, LONG_TIMEOUT); it("should be able to cancel a job using cancelJobCommon (job version 2.0 - synchronous) and return an error feedback object", async () => { diff --git a/packages/zosjobs/__tests__/__system__/DeleteJobs.system.test.ts b/packages/zosjobs/__tests__/__system__/DeleteJobs.system.test.ts index d0f96bf6bf..8dcb1c8b58 100644 --- a/packages/zosjobs/__tests__/__system__/DeleteJobs.system.test.ts +++ b/packages/zosjobs/__tests__/__system__/DeleteJobs.system.test.ts @@ -24,6 +24,7 @@ let iefbr14JCL: string; let defaultSystem: ITestPropertiesSchema; let testEnvironment: ITestEnvironment; const LONG_TIMEOUT = 100000; // 100 second timeout - jobs could take a while to complete due to system load +const modifyVersionDefaultUsesCIM = false; describe("DeleteJobs System tests", () => { @@ -44,24 +45,36 @@ describe("DeleteJobs System tests", () => { describe("Positive tests", () => { it("should be able to delete a job using deleteJob", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); - expect(job.retcode).toEqual("CC 0000"); - const response = await DeleteJobs.deleteJob(REAL_SESSION, job.jobname, job.jobid); - expect(response).toBeUndefined(); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); + expect(job.retcode).toEqual("CC 0000"); + const response = await DeleteJobs.deleteJob(REAL_SESSION, job.jobname, job.jobid); + expect(response).toBeUndefined(); + } }, LONG_TIMEOUT); it("should be able to delete a job using deleteJobForJob", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); - expect(job.retcode).toEqual("CC 0000"); - const response = await DeleteJobs.deleteJobForJob(REAL_SESSION, job); - expect(response).toBeUndefined(); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); + expect(job.retcode).toEqual("CC 0000"); + const response = await DeleteJobs.deleteJobForJob(REAL_SESSION, job); + expect(response).toBeUndefined(); + } }, LONG_TIMEOUT); it("should be able to delete a job using deleteJobCommon", async () => { - const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); - expect(job.retcode).toEqual("CC 0000"); - const response = await DeleteJobs.deleteJobCommon(REAL_SESSION, {jobname: job.jobname, jobid: job.jobid}); - expect(response).toBeUndefined(); + if (testEnvironment.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const job = await SubmitJobs.submitJclNotifyCommon(REAL_SESSION, {jcl: iefbr14JCL}); + expect(job.retcode).toEqual("CC 0000"); + const response = await DeleteJobs.deleteJobCommon(REAL_SESSION, {jobname: job.jobname, jobid: job.jobid}); + expect(response).toBeUndefined(); + } }, LONG_TIMEOUT); it("should be able to delete a job using deleteJobCommon (job modify version 2.0 - synchronous)", async () => { From ff32587cf74b1ce31121fedfc85f8ef4f733457b Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 14:48:15 -0400 Subject: [PATCH 08/24] Fix system tests where firewall can return a timeout instead Signed-off-by: Andrew W. Harn --- .../__system__/check/status/zosmf.check.status.system.test.ts | 2 +- .../__system__/list/systems/zosmf.list.systems.system.test.ts | 2 +- .../__tests__/__system__/methods/CheckStatus.system.test.ts | 2 +- .../__system__/methods/ListDefinedSystems.system.test.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cli/__tests__/zosmf/__system__/check/status/zosmf.check.status.system.test.ts b/packages/cli/__tests__/zosmf/__system__/check/status/zosmf.check.status.system.test.ts index b7c1d8ebcc..70dbf02be3 100644 --- a/packages/cli/__tests__/zosmf/__system__/check/status/zosmf.check.status.system.test.ts +++ b/packages/cli/__tests__/zosmf/__system__/check/status/zosmf.check.status.system.test.ts @@ -116,7 +116,7 @@ describe("zosmf check status", () => { expect(response.status).toBe(0); // now check the status response = runCliScript(__dirname + "/__scripts__/command/zosmf_check_status.sh", testEnvironment); - expect(stripNewLines(response.stderr.toString())).toContain("connect ECONNREFUSED"); + expect(stripNewLines(response.stderr.toString())).toMatch(/.*(ECONNREFUSED|ECONNRESET|ETIMEDOUT).*/); }); }); }); diff --git a/packages/cli/__tests__/zosmf/__system__/list/systems/zosmf.list.systems.system.test.ts b/packages/cli/__tests__/zosmf/__system__/list/systems/zosmf.list.systems.system.test.ts index a357c4171a..1654798fd9 100644 --- a/packages/cli/__tests__/zosmf/__system__/list/systems/zosmf.list.systems.system.test.ts +++ b/packages/cli/__tests__/zosmf/__system__/list/systems/zosmf.list.systems.system.test.ts @@ -134,7 +134,7 @@ describe("zosmf list systems", () => { expect(response.status).toBe(0); // now check the status response = runCliScript(__dirname + "/__scripts__/command/zosmf_list_systems.sh", testEnvironment); - expect(stripNewLines(response.stderr.toString())).toContain("connect ECONNREFUSED"); + expect(stripNewLines(response.stderr.toString())).toMatch(/.*(ECONNREFUSED|ECONNRESET|ETIMEDOUT).*/); }); }); }); diff --git a/packages/zosmf/__tests__/__system__/methods/CheckStatus.system.test.ts b/packages/zosmf/__tests__/__system__/methods/CheckStatus.system.test.ts index d08670a8d1..5c0f79f376 100644 --- a/packages/zosmf/__tests__/__system__/methods/CheckStatus.system.test.ts +++ b/packages/zosmf/__tests__/__system__/methods/CheckStatus.system.test.ts @@ -122,7 +122,7 @@ describe("Check Status Api", () => { expect(error).toBeTruthy(); expect(response).toBeFalsy(); const jsonCauseErrors = error.causeErrors; - expect(jsonCauseErrors.code).toMatch(/(ECONNREFUSED|ECONNRESET)/); + expect(jsonCauseErrors.code).toMatch(/(ECONNREFUSED|ECONNRESET|ETIMEDOUT)/); expect(jsonCauseErrors.syscall).toEqual("connect"); expect(jsonCauseErrors.port).toEqual(badPort); }); diff --git a/packages/zosmf/__tests__/__system__/methods/ListDefinedSystems.system.test.ts b/packages/zosmf/__tests__/__system__/methods/ListDefinedSystems.system.test.ts index faeae9c6c2..294d6895ab 100644 --- a/packages/zosmf/__tests__/__system__/methods/ListDefinedSystems.system.test.ts +++ b/packages/zosmf/__tests__/__system__/methods/ListDefinedSystems.system.test.ts @@ -122,7 +122,7 @@ describe("List Defined Systems Api", () => { expect(error).toBeTruthy(); expect(response).toBeFalsy(); const jsonCauseErrors = error.causeErrors; - expect(jsonCauseErrors.code).toMatch(/(ECONNREFUSED|ECONNRESET)/); + expect(jsonCauseErrors.code).toMatch(/(ECONNREFUSED|ECONNRESET|ETIMEDOUT)/); expect(jsonCauseErrors.syscall).toMatch(/(connect|read)/); }); }); From 0b06d95b0968e73b965551ed93d5bbc0103bc913 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 14:48:26 -0400 Subject: [PATCH 09/24] Fix another DSN name too long error Signed-off-by: Andrew W. Harn --- .../__tests__/__system__/methods/list/List.system.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zosfiles/__tests__/__system__/methods/list/List.system.test.ts b/packages/zosfiles/__tests__/__system__/methods/list/List.system.test.ts index b9011e5724..3cba83972c 100644 --- a/packages/zosfiles/__tests__/__system__/methods/list/List.system.test.ts +++ b/packages/zosfiles/__tests__/__system__/methods/list/List.system.test.ts @@ -985,7 +985,7 @@ describe("List command group - encoded", () => { let caughtError; try { - response = await List.dataSetsMatchingPattern(REAL_SESSION, [dsname + ".INVALID"]); + response = await List.dataSetsMatchingPattern(REAL_SESSION, [dsname + ".INVAL"]); } catch (error) { caughtError = error; } From eec3141039d3d200eb255d796b3ef97149e99f8b Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 16:00:24 -0400 Subject: [PATCH 10/24] Add missing CIM related tests Signed-off-by: Andrew W. Harn --- .../cli.zos-jobs.cancel.job.system.test.ts | 105 +++++++++------- .../cli.zos-jobs.delete.job.system.test.ts | 113 ++++++++++-------- 2 files changed, 126 insertions(+), 92 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 06bc908393..9d9f82b0ab 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 @@ -21,6 +21,7 @@ let TEST_ENVIRONMENT: ITestEnvironment; const LOCAL_JCL_FILE: string = __dirname + "/" + "testFileOfLocalJCL.txt"; const jobDataRegexV1 = /Successfully submitted request to cancel job (\w+) \((JOB\d+)\)/; const jobDataRegex = /Successfully canceled job (\w+) \((JOB\d+)\)/; +const modifyVersionDefaultUsesCIM = false; describe("zos-jobs cancel job command", () => { // Create the unique test environment @@ -73,13 +74,17 @@ describe("zos-jobs cancel job command", () => { describe("successful scenario", () => { it("should cancel a job v1", () => { - const response = runCliScript(__dirname + "/__scripts__/job/cancel_job_v1.sh", TEST_ENVIRONMENT, [LOCAL_JCL_FILE]); - expect(response.stderr.toString()).toBe(""); - expect(response.status).toBe(0); - expect(response.stdout.toString()).toContain("Successfully submitted request to cancel job"); + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const response = runCliScript(__dirname + "/__scripts__/job/cancel_job_v1.sh", TEST_ENVIRONMENT, [LOCAL_JCL_FILE]); + expect(response.stderr.toString()).toBe(""); + expect(response.status).toBe(0); + expect(response.stdout.toString()).toContain("Successfully submitted request to cancel job"); - const jobid = response.stdout.toString().match(jobDataRegexV1).pop(); - TEST_ENVIRONMENT.resources.jobs.push(jobid); + const jobid = response.stdout.toString().match(jobDataRegexV1).pop(); + TEST_ENVIRONMENT.resources.jobs.push(jobid); + } }); it("should cancel a job v2", () => { @@ -94,15 +99,19 @@ describe("zos-jobs cancel job command", () => { }); it("should cancel a job default", () => { - const response = runCliScript(__dirname + "/__scripts__/job/cancel_job.sh", TEST_ENVIRONMENT, [LOCAL_JCL_FILE]); - expect(response.stderr.toString()).toBe(""); - expect(response.status).toBe(0); - expect(response.stdout.toString()).toContain("Successfully canceled job"); - expect(response.stdout.toString()).not.toContain("Failed to cancel job"); - expect(response.stdout.toString()).not.toContain("Failed to cancel job"); + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const response = runCliScript(__dirname + "/__scripts__/job/cancel_job.sh", TEST_ENVIRONMENT, [LOCAL_JCL_FILE]); + expect(response.stderr.toString()).toBe(""); + expect(response.status).toBe(0); + expect(response.stdout.toString()).toContain("Successfully canceled job"); + expect(response.stdout.toString()).not.toContain("Failed to cancel job"); + expect(response.stdout.toString()).not.toContain("Failed to cancel job"); - const jobid = response.stdout.toString().match(jobDataRegex).pop(); - TEST_ENVIRONMENT.resources.jobs.push(jobid); + const jobid = response.stdout.toString().match(jobDataRegex).pop(); + TEST_ENVIRONMENT.resources.jobs.push(jobid); + } }); describe("without profiles", () => { @@ -124,21 +133,25 @@ describe("zos-jobs cancel job command", () => { }); it("cancel a job without a profile 1.0", async () => { - const response = runCliScript(__dirname + "/__scripts__/job/cancel_job_v1_fully_qualified.sh", - TEST_ENVIRONMENT_NO_PROF, - [ - LOCAL_JCL_FILE, - DEFAULT_SYSTEM_PROPS.zosmf.host, - DEFAULT_SYSTEM_PROPS.zosmf.port, - DEFAULT_SYSTEM_PROPS.zosmf.user, - DEFAULT_SYSTEM_PROPS.zosmf.password, - ]); - expect(response.stderr.toString()).toBe(""); - expect(response.status).toBe(0); - expect(response.stdout.toString()).toContain("Successfully submitted request to cancel job"); - - const jobid = response.stdout.toString().match(jobDataRegexV1).pop(); - TEST_ENVIRONMENT_NO_PROF.resources.jobs.push(jobid); + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const response = runCliScript(__dirname + "/__scripts__/job/cancel_job_v1_fully_qualified.sh", + TEST_ENVIRONMENT_NO_PROF, + [ + LOCAL_JCL_FILE, + DEFAULT_SYSTEM_PROPS.zosmf.host, + DEFAULT_SYSTEM_PROPS.zosmf.port, + DEFAULT_SYSTEM_PROPS.zosmf.user, + DEFAULT_SYSTEM_PROPS.zosmf.password, + ]); + expect(response.stderr.toString()).toBe(""); + expect(response.status).toBe(0); + expect(response.stdout.toString()).toContain("Successfully submitted request to cancel job"); + + const jobid = response.stdout.toString().match(jobDataRegexV1).pop(); + TEST_ENVIRONMENT_NO_PROF.resources.jobs.push(jobid); + } }); it("cancel a job without a profile 2.0", async () => { @@ -160,21 +173,25 @@ describe("zos-jobs cancel job command", () => { }); it("cancel a job without a profile default", async () => { - const response = runCliScript(__dirname + "/__scripts__/job/cancel_job_fully_qualified.sh", - TEST_ENVIRONMENT_NO_PROF, - [ - LOCAL_JCL_FILE, - DEFAULT_SYSTEM_PROPS.zosmf.host, - DEFAULT_SYSTEM_PROPS.zosmf.port, - DEFAULT_SYSTEM_PROPS.zosmf.user, - DEFAULT_SYSTEM_PROPS.zosmf.password, - ]); - expect(response.stderr.toString()).toBe(""); - expect(response.status).toBe(0); - expect(response.stdout.toString()).toContain("Successfully canceled job"); - - const jobid = response.stdout.toString().match(jobDataRegex).pop(); - TEST_ENVIRONMENT_NO_PROF.resources.jobs.push(jobid); + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const response = runCliScript(__dirname + "/__scripts__/job/cancel_job_fully_qualified.sh", + TEST_ENVIRONMENT_NO_PROF, + [ + LOCAL_JCL_FILE, + DEFAULT_SYSTEM_PROPS.zosmf.host, + DEFAULT_SYSTEM_PROPS.zosmf.port, + DEFAULT_SYSTEM_PROPS.zosmf.user, + DEFAULT_SYSTEM_PROPS.zosmf.password, + ]); + expect(response.stderr.toString()).toBe(""); + expect(response.status).toBe(0); + expect(response.stdout.toString()).toContain("Successfully canceled job"); + + const jobid = response.stdout.toString().match(jobDataRegex).pop(); + TEST_ENVIRONMENT_NO_PROF.resources.jobs.push(jobid); + } }); }); }); 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 e34559b5fe..12d55be2bc 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 @@ -17,6 +17,7 @@ import { ITestPropertiesSchema } from "../../../../../../__tests__/__src__/prope // Test Environment populated in the beforeAll(); let TEST_ENVIRONMENT: ITestEnvironment; let IEFBR14_JCL: string; +const modifyVersionDefaultUsesCIM = false; describe("zos-jobs delete job command", () => { // Create the unique test environment @@ -41,11 +42,15 @@ describe("zos-jobs delete job command", () => { describe("successful scenario", () => { it("should delete a job 1.0", () => { - const response = runCliScript(__dirname + "/__scripts__/job/delete_job_v1.sh", - TEST_ENVIRONMENT, [IEFBR14_JCL]); - expect(response.stderr.toString()).toBe(""); - expect(response.status).toBe(0); - expect(response.stdout.toString()).toContain("Successfully submitted request to delete job"); + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const response = runCliScript(__dirname + "/__scripts__/job/delete_job_v1.sh", + TEST_ENVIRONMENT, [IEFBR14_JCL]); + expect(response.stderr.toString()).toBe(""); + expect(response.status).toBe(0); + expect(response.stdout.toString()).toContain("Successfully submitted request to delete job"); + } }); it("should delete a job 2.0", () => { @@ -57,11 +62,15 @@ describe("zos-jobs delete job command", () => { }); it("should delete a job default", () => { - const response = runCliScript(__dirname + "/__scripts__/job/delete_job.sh", - TEST_ENVIRONMENT, [IEFBR14_JCL]); - expect(response.stderr.toString()).toBe(""); - expect(response.status).toBe(0); - expect(response.stdout.toString()).toContain("Successfully deleted job"); + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const response = runCliScript(__dirname + "/__scripts__/job/delete_job.sh", + TEST_ENVIRONMENT, [IEFBR14_JCL]); + expect(response.stderr.toString()).toBe(""); + expect(response.status).toBe(0); + expect(response.stdout.toString()).toContain("Successfully deleted job"); + } }); describe("without profiles", () => { @@ -83,26 +92,30 @@ describe("zos-jobs delete job command", () => { }); it("delete a job without a profile 1.0", async () => { - const ZOWE_OPT_BASE_PATH = "ZOWE_OPT_BASE_PATH"; - - // if API Mediation layer is being used (basePath has a value) then - // set an ENVIRONMENT variable to be used by zowe. - if (DEFAULT_SYSTEM_PROPS.zosmf.basePath != null) { - TEST_ENVIRONMENT_NO_PROF.env[ZOWE_OPT_BASE_PATH] = DEFAULT_SYSTEM_PROPS.zosmf.basePath; + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const ZOWE_OPT_BASE_PATH = "ZOWE_OPT_BASE_PATH"; + + // if API Mediation layer is being used (basePath has a value) then + // set an ENVIRONMENT variable to be used by zowe. + if (DEFAULT_SYSTEM_PROPS.zosmf.basePath != null) { + TEST_ENVIRONMENT_NO_PROF.env[ZOWE_OPT_BASE_PATH] = DEFAULT_SYSTEM_PROPS.zosmf.basePath; + } + + const response = runCliScript(__dirname + "/__scripts__/job/delete_job_v1_fully_qualified.sh", + TEST_ENVIRONMENT_NO_PROF, + [ + IEFBR14_JCL, + DEFAULT_SYSTEM_PROPS.zosmf.host, + DEFAULT_SYSTEM_PROPS.zosmf.port, + DEFAULT_SYSTEM_PROPS.zosmf.user, + DEFAULT_SYSTEM_PROPS.zosmf.password, + ]); + expect(response.stderr.toString()).toBe(""); + expect(response.status).toBe(0); + expect(response.stdout.toString()).toContain("Successfully submitted request to delete job"); } - - const response = runCliScript(__dirname + "/__scripts__/job/delete_job_v1_fully_qualified.sh", - TEST_ENVIRONMENT_NO_PROF, - [ - IEFBR14_JCL, - DEFAULT_SYSTEM_PROPS.zosmf.host, - DEFAULT_SYSTEM_PROPS.zosmf.port, - DEFAULT_SYSTEM_PROPS.zosmf.user, - DEFAULT_SYSTEM_PROPS.zosmf.password, - ]); - expect(response.stderr.toString()).toBe(""); - expect(response.status).toBe(0); - expect(response.stdout.toString()).toContain("Successfully submitted request to delete job"); }); it("delete a job without a profile 2.0", async () => { @@ -129,26 +142,30 @@ describe("zos-jobs delete job command", () => { }); it("delete a job without a profile default", async () => { - const ZOWE_OPT_BASE_PATH = "ZOWE_OPT_BASE_PATH"; - - // if API Mediation layer is being used (basePath has a value) then - // set an ENVIRONMENT variable to be used by zowe. - if (DEFAULT_SYSTEM_PROPS.zosmf.basePath != null) { - TEST_ENVIRONMENT_NO_PROF.env[ZOWE_OPT_BASE_PATH] = DEFAULT_SYSTEM_PROPS.zosmf.basePath; + if (TEST_ENVIRONMENT.systemTestProperties.zosjobs.skipCIM && modifyVersionDefaultUsesCIM) { + process.stdout.write("Skipping test because skipCIM is set."); + } else { + const ZOWE_OPT_BASE_PATH = "ZOWE_OPT_BASE_PATH"; + + // if API Mediation layer is being used (basePath has a value) then + // set an ENVIRONMENT variable to be used by zowe. + if (DEFAULT_SYSTEM_PROPS.zosmf.basePath != null) { + TEST_ENVIRONMENT_NO_PROF.env[ZOWE_OPT_BASE_PATH] = DEFAULT_SYSTEM_PROPS.zosmf.basePath; + } + + const response = runCliScript(__dirname + "/__scripts__/job/delete_job_fully_qualified.sh", + TEST_ENVIRONMENT_NO_PROF, + [ + IEFBR14_JCL, + DEFAULT_SYSTEM_PROPS.zosmf.host, + DEFAULT_SYSTEM_PROPS.zosmf.port, + DEFAULT_SYSTEM_PROPS.zosmf.user, + DEFAULT_SYSTEM_PROPS.zosmf.password, + ]); + expect(response.stderr.toString()).toBe(""); + expect(response.status).toBe(0); + expect(response.stdout.toString()).toContain("Successfully deleted job"); } - - const response = runCliScript(__dirname + "/__scripts__/job/delete_job_fully_qualified.sh", - TEST_ENVIRONMENT_NO_PROF, - [ - IEFBR14_JCL, - DEFAULT_SYSTEM_PROPS.zosmf.host, - DEFAULT_SYSTEM_PROPS.zosmf.port, - DEFAULT_SYSTEM_PROPS.zosmf.user, - DEFAULT_SYSTEM_PROPS.zosmf.password, - ]); - expect(response.stderr.toString()).toBe(""); - expect(response.status).toBe(0); - expect(response.stdout.toString()).toContain("Successfully deleted job"); }); }); }); From 5f8c518174c6d245767b3cfc6040a932dc931ba2 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 16:00:34 -0400 Subject: [PATCH 11/24] Add timeout tests Signed-off-by: Andrew W. Harn --- .../__tests__/__system__/methods/CheckStatus.system.test.ts | 2 +- .../__system__/methods/ListDefinedSystems.system.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/zosmf/__tests__/__system__/methods/CheckStatus.system.test.ts b/packages/zosmf/__tests__/__system__/methods/CheckStatus.system.test.ts index 5c0f79f376..2054077af1 100644 --- a/packages/zosmf/__tests__/__system__/methods/CheckStatus.system.test.ts +++ b/packages/zosmf/__tests__/__system__/methods/CheckStatus.system.test.ts @@ -125,6 +125,6 @@ describe("Check Status Api", () => { expect(jsonCauseErrors.code).toMatch(/(ECONNREFUSED|ECONNRESET|ETIMEDOUT)/); expect(jsonCauseErrors.syscall).toEqual("connect"); expect(jsonCauseErrors.port).toEqual(badPort); - }); + }, 300000); }); }); diff --git a/packages/zosmf/__tests__/__system__/methods/ListDefinedSystems.system.test.ts b/packages/zosmf/__tests__/__system__/methods/ListDefinedSystems.system.test.ts index 294d6895ab..a855091dae 100644 --- a/packages/zosmf/__tests__/__system__/methods/ListDefinedSystems.system.test.ts +++ b/packages/zosmf/__tests__/__system__/methods/ListDefinedSystems.system.test.ts @@ -124,6 +124,6 @@ describe("List Defined Systems Api", () => { const jsonCauseErrors = error.causeErrors; expect(jsonCauseErrors.code).toMatch(/(ECONNREFUSED|ECONNRESET|ETIMEDOUT)/); expect(jsonCauseErrors.syscall).toMatch(/(connect|read)/); - }); + }, 300000); }); }); From dd99b92c13f9ffcdced65e37e96c139d0bb0b086 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 16:00:59 -0400 Subject: [PATCH 12/24] Fix lint error Signed-off-by: Andrew W. Harn --- .../src/rest/__tests__/client/AbstractRestClient.unit.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 d81ea50636..24249d7f0c 100644 --- a/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts +++ b/packages/imperative/src/rest/__tests__/client/AbstractRestClient.unit.test.ts @@ -436,7 +436,7 @@ describe("AbstractRestClient tests", () => { let reusedSocket = true; const requestFnc = jest.fn((options, callback) => { - let emitter = new MockHttpRequestResponse(); + const emitter = new MockHttpRequestResponse(); ProcessUtils.nextTick(() => { callback(emitter); From e56c96217e132551e088a0bb32a7d8551ed6206f Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 16:01:25 -0400 Subject: [PATCH 13/24] Fix Logs error (#2336) Signed-off-by: Andrew W. Harn --- packages/cli/src/zoslogs/list/logs/Logs.handler.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/zoslogs/list/logs/Logs.handler.ts b/packages/cli/src/zoslogs/list/logs/Logs.handler.ts index 4ff94a9b3c..66c4e504e3 100644 --- a/packages/cli/src/zoslogs/list/logs/Logs.handler.ts +++ b/packages/cli/src/zoslogs/list/logs/Logs.handler.ts @@ -22,7 +22,8 @@ export default class LogsHandler extends ZosmfBaseHandler { public async processCmd(commandParameters: IHandlerParameters) { const outputHeader = "Retrieved %s messages from %s, starts from %s, ends at %s. "; - let startTime = new Date().toISOString(); + let startTime: any; + const startDate = new Date().toISOString(); if (commandParameters.arguments.startTime !== undefined) { startTime = commandParameters.arguments.startTime; // in case the input is milliseconds format, which is a long number @@ -39,6 +40,7 @@ export default class LogsHandler extends ZosmfBaseHandler { try{ const resp: IZosLogType = await GetZosLog.getZosLog(this.mSession, zosLogParms); + if (startTime == null) { startTime = startDate; } const logItems: Array = resp.items; if (logItems === undefined || logItems.length === 0) { From 0326f8b50bae92271f3a289fb6ef2e2b3b04b1a6 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Wed, 30 Oct 2024 16:16:39 -0400 Subject: [PATCH 14/24] Add a sleep for fast running systems Signed-off-by: Andrew W. Harn --- .../list-jobs/submit_and_list_jobs_fully_qualified.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs_fully_qualified.sh b/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs_fully_qualified.sh index 922016bd87..a8cf9c24ba 100755 --- a/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs_fully_qualified.sh +++ b/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs_fully_qualified.sh @@ -11,6 +11,7 @@ PASS=$5 JOBID1=`zowe zos-jobs submit data-set $JCL --host $HOST --port $PORT --user $USER --password $PASS --ru=false --rff jobid --rft string` JOBID2=`zowe zos-jobs submit data-set $JCL --host $HOST --port $PORT --user $USER --password $PASS --ru=false --rff jobid --rft string` +sleep 1 echo "Listing jobs to find job IDs $JOBID1 and $JOBID2" LIST_JOB_OUTPUT=`zowe zos-jobs list jobs --host $HOST --port $PORT --user $USER --password $PASS --ru=false` From bd2ccd40fd6d63ad6736f14aff5ca8766da35b7d Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Thu, 31 Oct 2024 11:47:55 -0400 Subject: [PATCH 15/24] Fix Issue Tso issue Signed-off-by: Andrew W. Harn --- packages/zostso/src/IssueTso.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zostso/src/IssueTso.ts b/packages/zostso/src/IssueTso.ts index 48f3d3ce6a..ad417afce5 100644 --- a/packages/zostso/src/IssueTso.ts +++ b/packages/zostso/src/IssueTso.ts @@ -72,7 +72,7 @@ export class IssueTso { }; return response; } catch (e) { - if (e.mMessage.includes("status 404")) { + if (e.mMessage?.includes("status 404")) { // Set useNewApi to false to handle fallback logic useNewApi = false; } else { From 5068ade390275512ab822451d386dbd0ab0b82dc Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Thu, 31 Oct 2024 11:51:08 -0400 Subject: [PATCH 16/24] Replace mMessage with message Signed-off-by: Andrew W. Harn --- packages/zostso/src/IssueTso.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zostso/src/IssueTso.ts b/packages/zostso/src/IssueTso.ts index ad417afce5..2fd0d5e26d 100644 --- a/packages/zostso/src/IssueTso.ts +++ b/packages/zostso/src/IssueTso.ts @@ -72,7 +72,7 @@ export class IssueTso { }; return response; } catch (e) { - if (e.mMessage?.includes("status 404")) { + if (e.message?.includes("status 404")) { // Set useNewApi to false to handle fallback logic useNewApi = false; } else { From 06b65091798928b222ec1ebd07d48eac75625dd7 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Thu, 31 Oct 2024 14:31:33 -0400 Subject: [PATCH 17/24] Fix small timing issues Signed-off-by: Andrew W. Harn --- .../cancel/__scripts__/job/cancel_job_fully_qualified.sh | 2 ++ .../list/__scripts__/list-jobs/submit_and_list_jobs.sh | 2 ++ .../__tests__/__system__/ModifyJobs.system.test.ts | 9 +++++++++ .../__tests__/__system__/MonitorJobs.system.test.ts | 8 +++----- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_fully_qualified.sh b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_fully_qualified.sh index a192432415..66e33b592f 100755 --- a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_fully_qualified.sh +++ b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_fully_qualified.sh @@ -22,6 +22,8 @@ then exit $RC fi +sleep 1 + # Cancel the job zowe jobs cancel job $JOBID --host $HOST --port $PORT --user $USER --password $PASS --ru=false RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs.sh b/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs.sh index fc6f6e9979..ae162ab180 100755 --- a/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs.sh +++ b/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs.sh @@ -3,10 +3,12 @@ set -e # Submit two jobs and capture their IDs JOBID1=`zowe zos-jobs submit data-set $1 --rff jobid --rft string` +sleep 1 JOBID2=`zowe zos-jobs submit data-set $1 --rff jobid --rft string` echo "Listing jobs to find job IDs $JOBID1 and $JOBID2" +sleep 1 LIST_JOB_OUTPUT=`zowe zos-jobs list jobs` if echo $LIST_JOB_OUTPUT | grep -q $JOBID1 then diff --git a/packages/zosjobs/__tests__/__system__/ModifyJobs.system.test.ts b/packages/zosjobs/__tests__/__system__/ModifyJobs.system.test.ts index 2ccc7fff18..407b9aefc4 100644 --- a/packages/zosjobs/__tests__/__system__/ModifyJobs.system.test.ts +++ b/packages/zosjobs/__tests__/__system__/ModifyJobs.system.test.ts @@ -15,6 +15,7 @@ import { ITestEnvironment } from "../../../../__tests__/__src__/environment/ITes import { TestEnvironment } from "../../../../__tests__/__src__/environment/TestEnvironment"; import { ITestPropertiesSchema } from "../../../../__tests__/__src__/properties/ITestPropertiesSchema"; import { JobTestsUtils } from "./JobTestsUtils"; +import { wait } from "../../../../__tests__/__src__/TestUtils"; let testEnvironment: ITestEnvironment; let systemProps: ITestPropertiesSchema; @@ -47,6 +48,10 @@ describe("Modify Jobs - System Tests", () => { await TestEnvironment.cleanUp(testEnvironment); }); + beforeEach(async () => { + await wait(1000); + }); + describe("Positive tests", () => { it("should return a success message once jobclass has been modified", async () => { const job: any = await ModifyJobs.modifyJobCommon( @@ -120,6 +125,10 @@ describe("Modify Jobs - System Tests - Encoded", () => { await TestEnvironment.cleanUp(testEnvironment); }); + beforeEach(async () => { + await wait(1000); + }); + describe("Positive tests", () => { it("should return a success message once jobclass has been modified", async () => { const job: any = await ModifyJobs.modifyJobCommon( diff --git a/packages/zosjobs/__tests__/__system__/MonitorJobs.system.test.ts b/packages/zosjobs/__tests__/__system__/MonitorJobs.system.test.ts index 5ba150128f..ad44714e69 100644 --- a/packages/zosjobs/__tests__/__system__/MonitorJobs.system.test.ts +++ b/packages/zosjobs/__tests__/__system__/MonitorJobs.system.test.ts @@ -18,6 +18,7 @@ import { ZosmfRestClient } from "@zowe/core-for-zowe-sdk"; import { TestEnvironment } from "../../../../__tests__/__src__/environment/TestEnvironment"; import { ITestPropertiesSchema } from "../../../../__tests__/__src__/properties/ITestPropertiesSchema"; import { ITestEnvironment } from "../../../../__tests__/__src__/environment/ITestEnvironment"; +import { wait } from "../../../../__tests__/__src__/TestUtils"; // long running test timeout const LONG_TIMEOUT = 100000; @@ -45,6 +46,7 @@ let MONITOR_JOB_NAME: string; // Utility function to cleanup async function cleanTestJobs() { // The tests may submit jobs - we will clean every job that may have been left by failures, etc. + await wait(1000); // Wait for jobs to register in z/OSMF const jobs: IJob[] = await GetJobs.getJobsCommon(REAL_SESSION, {owner: REAL_SESSION.ISession.user, prefix: MONITOR_JOB_NAME}); if (jobs.length > 0) { for (const job of jobs) { @@ -89,12 +91,8 @@ describe.each([false, true])("System Tests - Monitor Jobs - Encoded: %s", (encod SYSAFF = testEnvironment.systemTestProperties.zosjobs.sysaff; }); - // Cleanup before & after each test - this will ensure that hopefully no jobs are left outstanding (or are currently + // Cleanup after each test - this will ensure that hopefully no jobs are left outstanding (or are currently // outstanding) when the tests run - beforeEach(async () => { - GetJobs.getStatusCommon = ORIG_JOBS_STATUS; - await cleanTestJobs(); - }); afterEach(async () => { GetJobs.getStatusCommon = ORIG_JOBS_STATUS; await cleanTestJobs(); From 45e1e65b60ad6c01764a49edbf6f49c34c5f6694 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Thu, 31 Oct 2024 16:11:38 -0400 Subject: [PATCH 18/24] Fix more timing issues & logic errors Signed-off-by: Andrew W. Harn --- .../zosjobs/__system__/cancel/__scripts__/job/cancel_job.sh | 2 ++ .../__system__/cancel/__scripts__/job/cancel_job_v1.sh | 2 ++ .../cancel/__scripts__/job/cancel_job_v1_fully_qualified.sh | 2 ++ .../__system__/cancel/__scripts__/job/cancel_job_v2.sh | 2 ++ .../__system__/cancel/__scripts__/job/cancel_job_v2_bad.sh | 4 ++++ .../cancel/__scripts__/job/cancel_job_v2_fully_qualified.sh | 2 ++ .../zosjobs/__system__/delete/__scripts__/job/delete_job.sh | 2 +- .../delete/__scripts__/job/delete_job_fully_qualified.sh | 2 +- .../__system__/delete/__scripts__/job/delete_job_v1.sh | 2 +- .../delete/__scripts__/job/delete_job_v1_fully_qualified.sh | 2 +- .../__system__/delete/__scripts__/job/delete_job_v2.sh | 2 +- .../delete/__scripts__/job/delete_job_v2_fully_qualified.sh | 2 +- .../__system__/delete/__scripts__/old-jobs/delete_old_jobs.sh | 2 +- .../download/__scripts__/download-output/download.sh | 2 +- .../__scripts__/download-output/download_fully_qualified.sh | 2 +- .../list/__scripts__/list-jobs/submit_and_list_jobs.sh | 1 + .../list-jobs/submit_and_list_jobs_fully_qualified.sh | 2 ++ .../__scripts__/all-spool-content/get_all_spool_content.sh | 2 +- 18 files changed, 27 insertions(+), 10 deletions(-) diff --git a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job.sh b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job.sh index d3632092d7..9e11ffd46b 100755 --- a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job.sh +++ b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job.sh @@ -16,6 +16,8 @@ then exit $RC fi +sleep 1 + # Cancel the job zowe jobs cancel job $JOBID RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v1.sh b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v1.sh index 3c21f25e03..1f08c8455b 100755 --- a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v1.sh +++ b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v1.sh @@ -16,6 +16,8 @@ then exit $RC fi +sleep 1 + # Cancel the job 1 zowe jobs cancel job $JOBID --modify-version 1.0 RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v1_fully_qualified.sh b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v1_fully_qualified.sh index a9d11afbe5..0a062d6d82 100755 --- a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v1_fully_qualified.sh +++ b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v1_fully_qualified.sh @@ -22,6 +22,8 @@ then exit $RC fi +sleep 1 + # Cancel the job zowe jobs cancel job $JOBID --host $HOST --port $PORT --user $USER --password $PASS --ru=false --modify-version 1.0 RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2.sh b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2.sh index d5abaaaee2..0c1170f4fe 100755 --- a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2.sh +++ b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2.sh @@ -16,6 +16,8 @@ then exit $RC fi +sleep 1 + # Cancel the job 1 zowe jobs cancel job $JOBID --modify-version 2.0 RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2_bad.sh b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2_bad.sh index c3165a9047..c87f49179f 100755 --- a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2_bad.sh +++ b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2_bad.sh @@ -16,6 +16,8 @@ then exit $RC fi +sleep 1 + # Cancel the job 1 zowe jobs cancel job $JOBID --modify-version 2.0 RC=$? @@ -26,6 +28,8 @@ then exit $RC fi +sleep 1 + # Cancel the job 2 zowe jobs cancel job $JOBID --modify-version 2.0 RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2_fully_qualified.sh b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2_fully_qualified.sh index 3a0d1b7177..5f1f40917d 100755 --- a/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2_fully_qualified.sh +++ b/packages/cli/__tests__/zosjobs/__system__/cancel/__scripts__/job/cancel_job_v2_fully_qualified.sh @@ -22,6 +22,8 @@ then exit $RC fi +sleep 1 + # Cancel the job zowe jobs cancel job $JOBID --host $HOST --port $PORT --user $USER --password $PASS --ru=false --modify-version 2.0 RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job.sh b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job.sh index e560bfdadf..a8d234d19d 100755 --- a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job.sh +++ b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job.sh @@ -17,7 +17,7 @@ then fi # Loop until the job goes to the output queue -until [ $ATTEMPTS -gt 0 ] +until [ $ATTEMPTS -lt 1 ] do STATUS=`zowe jobs view job-status-by-jobid $JOBID --rff status --rft string` RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_fully_qualified.sh b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_fully_qualified.sh index 2642614827..40477cafd7 100755 --- a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_fully_qualified.sh +++ b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_fully_qualified.sh @@ -23,7 +23,7 @@ then fi # Loop until the job goes to the output queue -until [ $ATTEMPTS -gt 0 ] +until [ $ATTEMPTS -lt 1 ] do STATUS=`zowe jobs view job-status-by-jobid $JOBID --host $HOST --port $PORT --user $USER --password $PASS --ru=false --rff status --rft string` RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v1.sh b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v1.sh index 5142e33080..9fad992df1 100755 --- a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v1.sh +++ b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v1.sh @@ -17,7 +17,7 @@ then fi # Loop until the job goes to the output queue -until [ $ATTEMPTS -gt 0 ] +until [ $ATTEMPTS -lt 1 ] do STATUS=`zowe jobs view job-status-by-jobid $JOBID --rff status --rft string` RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v1_fully_qualified.sh b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v1_fully_qualified.sh index ddb46643a3..5041a60c53 100755 --- a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v1_fully_qualified.sh +++ b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v1_fully_qualified.sh @@ -23,7 +23,7 @@ then fi # Loop until the job goes to the output queue -until [ $ATTEMPTS -gt 0 ] +until [ $ATTEMPTS -lt 1 ] do STATUS=`zowe jobs view job-status-by-jobid $JOBID --host $HOST --port $PORT --user $USER --password $PASS --ru=false --rff status --rft string` RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v2.sh b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v2.sh index b8a80a8af4..0887eab49a 100755 --- a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v2.sh +++ b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v2.sh @@ -17,7 +17,7 @@ then fi # Loop until the job goes to the output queue -until [ $ATTEMPTS -gt 0 ] +until [ $ATTEMPTS -lt 1 ] do STATUS=`zowe jobs view job-status-by-jobid $JOBID --rff status --rft string` RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v2_fully_qualified.sh b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v2_fully_qualified.sh index e8f114b68c..f10be13a6f 100755 --- a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v2_fully_qualified.sh +++ b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/job/delete_job_v2_fully_qualified.sh @@ -23,7 +23,7 @@ then fi # Loop until the job goes to the output queue -until [ $ATTEMPTS -gt 0 ] +until [ $ATTEMPTS -lt 1 ] do STATUS=`zowe jobs view job-status-by-jobid $JOBID --host $HOST --port $PORT --user $USER --password $PASS --ru=false --rff status --rft string` RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/old-jobs/delete_old_jobs.sh b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/old-jobs/delete_old_jobs.sh index 6946cc549d..e165a2fb02 100755 --- a/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/old-jobs/delete_old_jobs.sh +++ b/packages/cli/__tests__/zosjobs/__system__/delete/__scripts__/old-jobs/delete_old_jobs.sh @@ -18,7 +18,7 @@ then fi # Loop until the job goes to the output queue -until [ $ATTEMPTS -gt 0 ] +until [ $ATTEMPTS -lt 1 ] do STATUS=`zowe jobs view job-status-by-jobid $JOBID --rff status --rft string` RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/download/__scripts__/download-output/download.sh b/packages/cli/__tests__/zosjobs/__system__/download/__scripts__/download-output/download.sh index 8563a01a94..0ccea48361 100755 --- a/packages/cli/__tests__/zosjobs/__system__/download/__scripts__/download-output/download.sh +++ b/packages/cli/__tests__/zosjobs/__system__/download/__scripts__/download-output/download.sh @@ -20,7 +20,7 @@ fi echo "Submitted job ID: $JOBID" # Loop until the job goes to the output queue -until [ $ATTEMPTS -gt 0 ] +until [ $ATTEMPTS -lt 1 ] do STATUS=`zowe jobs view job-status-by-jobid $JOBID --rff status --rft string` RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/download/__scripts__/download-output/download_fully_qualified.sh b/packages/cli/__tests__/zosjobs/__system__/download/__scripts__/download-output/download_fully_qualified.sh index cb7def1726..534394bf09 100755 --- a/packages/cli/__tests__/zosjobs/__system__/download/__scripts__/download-output/download_fully_qualified.sh +++ b/packages/cli/__tests__/zosjobs/__system__/download/__scripts__/download-output/download_fully_qualified.sh @@ -26,7 +26,7 @@ fi echo "Submitted job ID: $JOBID" # Loop until the job goes to the output queue -until [ $ATTEMPTS -gt 0 ] +until [ $ATTEMPTS -lt 1 ] do STATUS=`zowe jobs view job-status-by-jobid $JOBID --host $HOST --port $PORT --user $USER --password $PASS --ru=false --rff status --rft string` RC=$? diff --git a/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs.sh b/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs.sh index ae162ab180..bff24c1186 100755 --- a/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs.sh +++ b/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs.sh @@ -9,6 +9,7 @@ JOBID2=`zowe zos-jobs submit data-set $1 --rff jobid --rft string` echo "Listing jobs to find job IDs $JOBID1 and $JOBID2" sleep 1 + LIST_JOB_OUTPUT=`zowe zos-jobs list jobs` if echo $LIST_JOB_OUTPUT | grep -q $JOBID1 then diff --git a/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs_fully_qualified.sh b/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs_fully_qualified.sh index a8cf9c24ba..1c05c40b9c 100755 --- a/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs_fully_qualified.sh +++ b/packages/cli/__tests__/zosjobs/__system__/list/__scripts__/list-jobs/submit_and_list_jobs_fully_qualified.sh @@ -9,9 +9,11 @@ PASS=$5 # Submit two jobs and capture their IDs JOBID1=`zowe zos-jobs submit data-set $JCL --host $HOST --port $PORT --user $USER --password $PASS --ru=false --rff jobid --rft string` +sleep 1 JOBID2=`zowe zos-jobs submit data-set $JCL --host $HOST --port $PORT --user $USER --password $PASS --ru=false --rff jobid --rft string` sleep 1 + echo "Listing jobs to find job IDs $JOBID1 and $JOBID2" LIST_JOB_OUTPUT=`zowe zos-jobs list jobs --host $HOST --port $PORT --user $USER --password $PASS --ru=false` diff --git a/packages/cli/__tests__/zosjobs/__system__/view/__scripts__/all-spool-content/get_all_spool_content.sh b/packages/cli/__tests__/zosjobs/__system__/view/__scripts__/all-spool-content/get_all_spool_content.sh index f60e02909b..0cfed87ae2 100755 --- a/packages/cli/__tests__/zosjobs/__system__/view/__scripts__/all-spool-content/get_all_spool_content.sh +++ b/packages/cli/__tests__/zosjobs/__system__/view/__scripts__/all-spool-content/get_all_spool_content.sh @@ -17,7 +17,7 @@ then fi # Loop until the job goes to the output queue -until [ $ATTEMPTS -gt 0 ] +until [ $ATTEMPTS -lt 1 ] do STATUS=`zowe zos-jobs view job-status-by-jobid $JOBID --rff status --rft string` RC=$? From 93a851428a597011c657e86148568ce3c9ef528a Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Thu, 31 Oct 2024 16:22:59 -0400 Subject: [PATCH 19/24] Update changelogs Signed-off-by: Andrew W. Harn --- packages/cli/CHANGELOG.md | 4 ++++ packages/imperative/CHANGELOG.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packages/cli/CHANGELOG.md b/packages/cli/CHANGELOG.md index 2c571c6f39..979c731153 100644 --- a/packages/cli/CHANGELOG.md +++ b/packages/cli/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to the Zowe CLI package will be documented in this file. +## Recent Changes + +- BugFix: Fixed an issue where the `zowe zos-logs list logs` command could fail or not return all logs if a start time was not supplied. [#2336](https://github.com/zowe/zowe-cli/pull/2336) + ## `8.4.0` - Enhancement: Added optional `--attributes` flag to `zowe zos-files upload file-to-uss` to allow passing a .zosattributes file path for upload encoding format. [#2319] (https://github.com/zowe/zowe-cli/pull/2319) diff --git a/packages/imperative/CHANGELOG.md b/packages/imperative/CHANGELOG.md index 090ec53b33..590109e856 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 + +- BugFix: Handled an HTTP 1.1 race condition where an SDK user may experience an ECONNRESET error if a session was reused on Node 20 and above due to HTTP Keep-Alive. [#2339](https://github.com/zowe/zowe-cli/pull/2339) + ## `8.3.1` - BugFix: Fixed an issue where the `plugins install` command could fail when installing a scoped package because scoped registry was used to fetch all dependencies. [#2317](https://github.com/zowe/zowe-cli/issues/2317) From 62a48b1fe89d2081e5c587524af981923f7b20d8 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Fri, 1 Nov 2024 08:33:04 -0400 Subject: [PATCH 20/24] Fix errors that surfaced on Jenkins Signed-off-by: Andrew W. Harn --- .../stop/__snapshots__/cli.zos-tso.stop.system.test.ts.snap | 4 ++-- .../methods/upload/__resources__/upload_file_to_uss.sh | 2 +- .../__system__/methods/upload/__resources__/view_file_uss.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/cli/__tests__/zostso/__system__/stop/__snapshots__/cli.zos-tso.stop.system.test.ts.snap b/packages/cli/__tests__/zostso/__system__/stop/__snapshots__/cli.zos-tso.stop.system.test.ts.snap index aab1477817..f536d4cdf8 100644 --- a/packages/cli/__tests__/zostso/__system__/stop/__snapshots__/cli.zos-tso.stop.system.test.ts.snap +++ b/packages/cli/__tests__/zostso/__system__/stop/__snapshots__/cli.zos-tso.stop.system.test.ts.snap @@ -5,7 +5,7 @@ exports[`zos-tso stop should fail with invalid option 1`] = ` Unknown arguments: foo-bar, fooBar Command failed due to improper syntax Command entered: \\"zos-tso start as --foo-bar\\" -Available commands are \\"address-space\\". +Available commands are \\"address-space, app\\". Use \\"zowe zos-tso start --help\\" to view groups, commands, and options. Response From Service @@ -28,7 +28,7 @@ Command failed due to improper syntax Did you mean: zos-tso stop as? Command entered: \\"zos-tso stop foobar\\" -Available commands are \\"address-space\\". +Available commands are \\"address-space, app\\". Use \\"zowe zos-tso stop --help\\" to view groups, commands, and options. Response From Service diff --git a/packages/zosfiles/__tests__/__system__/methods/upload/__resources__/upload_file_to_uss.sh b/packages/zosfiles/__tests__/__system__/methods/upload/__resources__/upload_file_to_uss.sh index ae60e4afa2..c09803cce6 100755 --- a/packages/zosfiles/__tests__/__system__/methods/upload/__resources__/upload_file_to_uss.sh +++ b/packages/zosfiles/__tests__/__system__/methods/upload/__resources__/upload_file_to_uss.sh @@ -9,5 +9,5 @@ inputFile=$7 ussName=$8 attributes=$9 -zowe zos-files upload file-to-uss $inputFile $ussName --attributes $attributes --host $host --port $port --user $user --password $password --ru $ru +zowe zos-files upload file-to-uss "$inputFile" "$ussName" --attributes "$attributes" --host $host --port $port --user $user --password $password --ru $ru exit $? \ No newline at end of file diff --git a/packages/zosfiles/__tests__/__system__/methods/upload/__resources__/view_file_uss.sh b/packages/zosfiles/__tests__/__system__/methods/upload/__resources__/view_file_uss.sh index a1356ff9bf..bfa85f180b 100755 --- a/packages/zosfiles/__tests__/__system__/methods/upload/__resources__/view_file_uss.sh +++ b/packages/zosfiles/__tests__/__system__/methods/upload/__resources__/view_file_uss.sh @@ -8,5 +8,5 @@ ru=$6 ussName=$7 encoding=$8 -zowe zos-files view uf $ussName --encoding $encoding --host $host --port $port --user $user --password $password --ru $ru +zowe zos-files view uf "$ussName" --encoding $encoding --host $host --port $port --user $user --password $password --ru $ru exit $? \ No newline at end of file From 356d2777bb4d202cf4ecd1dc339ae53545c4c870 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Fri, 1 Nov 2024 08:46:18 -0400 Subject: [PATCH 21/24] Update defaults to prevent breakage Signed-off-by: Andrew W. Harn --- __tests__/__resources__/properties/default_properties.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/__resources__/properties/default_properties.yaml b/__tests__/__resources__/properties/default_properties.yaml index a3c570b6bc..21fc02313f 100644 --- a/__tests__/__resources__/properties/default_properties.yaml +++ b/__tests__/__resources__/properties/default_properties.yaml @@ -105,7 +105,7 @@ zosjobs: # System affinity sysaff: zosjobs-sysaff # CIM Support - skipCIM: cim-skipped + skipCIM: false #-----------------------------------------------------------------------------# # Set of properties for testing provisioning # #-----------------------------------------------------------------------------# From b3dda5190499ec71c34f538e354f405ca310e9bf Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Fri, 1 Nov 2024 10:29:26 -0400 Subject: [PATCH 22/24] Resolve some TSO system test timing issues Signed-off-by: Andrew W. Harn --- .../__system__/api.TsoASApp.system.test.ts | 76 +++++++++---------- 1 file changed, 35 insertions(+), 41 deletions(-) diff --git a/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts b/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts index 849a4ee778..3fd55b14d4 100644 --- a/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts +++ b/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts @@ -47,7 +47,7 @@ describe("All test", () => { it("should create TSO address space and run an application instance at the created AS", async () => { let error: ImperativeError; - const response = await runCliScript( + const response = runCliScript( __dirname + "/__scripts__/start/start_app_new_as.sh", testEnvironment, [ @@ -65,24 +65,13 @@ describe("All test", () => { expect(response.stdout.toString()).toContain( "HELLOW exec processing has started" ); - expect(response.stdout.toString()).toContain( - "UNIX message queue id = " - ); - expect(response.stdout.toString()).toContain( - "Input message type = " - ); - expect(response.stdout.toString()).toContain( - "Output message type = " - ); - expect(response.stdout.toString()).toContain( - "Reading application input from the UNIX message queue." - ); expect(error).toBeUndefined(); await StopTso.stop( REAL_SESSION, JSON.parse(response.stdout.toString()).servletKey ); }); + it("should create TSO application instance on existing address space", async () => { dsname = getUniqueDatasetName(`${defaultSystem.zosmf.user}.ZOSTEST`); await Create.dataSet(REAL_SESSION, CreateDataSetTypeEnum.DATA_SET_PARTITIONED, dsname); @@ -100,7 +89,7 @@ describe("All test", () => { stopResponse: null, }; - const response = await runCliScript( + const response = runCliScript( __dirname + "/__scripts__/start/start_app_existing_as.sh", testEnvironment, [ @@ -119,18 +108,6 @@ describe("All test", () => { expect(response.stdout.toString()).toContain( "HELLOW exec processing has started" ); - expect(response.stdout.toString()).toContain( - "UNIX message queue id = " - ); - expect(response.stdout.toString()).toContain( - "Input message type = " - ); - expect(response.stdout.toString()).toContain( - "Output message type = " - ); - expect(response.stdout.toString()).toContain( - "Reading application input from the UNIX message queue." - ); //Clean up test await StopTso.stop( @@ -141,7 +118,7 @@ describe("All test", () => { }); describe("Send TSO app tests", () => { it("Should send message to TSO address space app", async () => { - const startResponse = await runCliScript( + const startResponse = runCliScript( __dirname + "/__scripts__/start/start_app_new_as.sh", testEnvironment, [ @@ -154,10 +131,12 @@ describe("All test", () => { dsname+"(TESTAPP)" ] ); + const startServletkey = JSON.parse( startResponse.stdout.toString() ).servletKey; - const response = await runCliScript( + + const response = runCliScript( __dirname + "/__scripts__/send/send_tso_app.sh", testEnvironment, [ @@ -172,13 +151,30 @@ describe("All test", () => { "test2", ] ); + const response2 = runCliScript( + __dirname + "/__scripts__/receive/receive_tso_app.sh", + testEnvironment, + [ + ACCOUNT_NUMBER, + defaultSystem.zosmf.host, + defaultSystem.zosmf.port, + defaultSystem.zosmf.user, + defaultSystem.zosmf.password, + defaultSystem.zosmf.rejectUnauthorized, + startServletkey, + "test2", + "true", + ] + ); + const responses = response.stdout.toString() + response2.stdout.toString(); expect(response.stdout.toString()).toBeDefined(); - expect(response.stdout.toString()).toContain( + expect(response2.stdout.toString()).toBeDefined; + expect(responses).toContain( "Application input = LONG 100" ); - expect(response.stdout.toString()).toContain("servletKey"); - expect(response.stdout.toString()).toContain("READY "); + expect(responses).toContain("servletKey"); + expect(responses).toContain("READY "); //Clean up test await StopTso.stop(REAL_SESSION, startServletkey); @@ -186,7 +182,7 @@ describe("All test", () => { }); describe("Receive TSO app tests", () => { it("should pull from message queue but not reach the end (--no-rur)", async () => { - const startResponse = await runCliScript( + const startResponse = runCliScript( __dirname + "/__scripts__/start/start_app_new_as.sh", testEnvironment, [ @@ -202,7 +198,7 @@ describe("All test", () => { const startServletkey = JSON.parse( startResponse.stdout.toString() ).servletKey; - await runCliScript( + runCliScript( __dirname + "/__scripts__/send/send_tso_app.sh", testEnvironment, [ @@ -217,7 +213,7 @@ describe("All test", () => { "test2", ] ); - const response = await runCliScript( + const response = runCliScript( __dirname + "/__scripts__/receive/receive_tso_app.sh", testEnvironment, [ @@ -232,16 +228,14 @@ describe("All test", () => { "false", ] ); - expect(response.stdout.toString()).toContain("999"); - expect(response.stdout.toString()).toContain("1000"); - expect(response.stdout.toString()).toContain("1001"); - expect(response.stdout.toString()).not.toContain("4000"); + expect(response.stdout.toString()).toContain("1"); + expect(response.stdout.toString()).not.toContain("3999"); //Clean up test await StopTso.stop(REAL_SESSION, startServletkey); }); it("should empty message queue using --rur flag", async () => { - const startResponse = await runCliScript( + const startResponse = runCliScript( __dirname + "/__scripts__/start/start_app_new_as.sh", testEnvironment, [ @@ -257,7 +251,7 @@ describe("All test", () => { const startServletkey = JSON.parse( startResponse.stdout.toString() ).servletKey; - await runCliScript( + runCliScript( __dirname + "/__scripts__/send/send_tso_app.sh", testEnvironment, [ @@ -272,7 +266,7 @@ describe("All test", () => { "test2", ] ); - const response = await runCliScript( + const response = runCliScript( __dirname + "/__scripts__/receive/receive_tso_app.sh", testEnvironment, [ From d37d43126d8e16a721273fb6195d6c4acee2cfbf Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Fri, 1 Nov 2024 10:32:58 -0400 Subject: [PATCH 23/24] Fix test Signed-off-by: Andrew W. Harn --- .../zostso/__tests__/__system__/api.TsoASApp.system.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts b/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts index 3fd55b14d4..199725d1a8 100644 --- a/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts +++ b/packages/zostso/__tests__/__system__/api.TsoASApp.system.test.ts @@ -169,7 +169,7 @@ describe("All test", () => { const responses = response.stdout.toString() + response2.stdout.toString(); expect(response.stdout.toString()).toBeDefined(); - expect(response2.stdout.toString()).toBeDefined; + expect(response2.stdout.toString()).toBeDefined(); expect(responses).toContain( "Application input = LONG 100" ); From dbe3e4af01df969e9b807e9a28b561abfe17fe28 Mon Sep 17 00:00:00 2001 From: "Andrew W. Harn" Date: Fri, 1 Nov 2024 10:47:39 -0400 Subject: [PATCH 24/24] Fix system test snapshot Signed-off-by: Andrew W. Harn --- .../stop/__snapshots__/cli.zos-tso.stop.system.test.ts.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/__tests__/zostso/__system__/stop/__snapshots__/cli.zos-tso.stop.system.test.ts.snap b/packages/cli/__tests__/zostso/__system__/stop/__snapshots__/cli.zos-tso.stop.system.test.ts.snap index f536d4cdf8..fc29854daa 100644 --- a/packages/cli/__tests__/zostso/__system__/stop/__snapshots__/cli.zos-tso.stop.system.test.ts.snap +++ b/packages/cli/__tests__/zostso/__system__/stop/__snapshots__/cli.zos-tso.stop.system.test.ts.snap @@ -28,7 +28,7 @@ Command failed due to improper syntax Did you mean: zos-tso stop as? Command entered: \\"zos-tso stop foobar\\" -Available commands are \\"address-space, app\\". +Available commands are \\"address-space\\". Use \\"zowe zos-tso stop --help\\" to view groups, commands, and options. Response From Service