diff --git a/CHANGELOG.md b/CHANGELOG.md index 923c0599..b097dd7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the z/OS FTP Plug-in for Zowe CLI will be documented in this file. + +## Recent Changes + +- Simplify the preparation for JCL system tests + + ## `2.1.7` - Update the version of zos-node-accessor to 1.0.16 diff --git a/__tests__/__resources__/properties/default_properties.yaml b/__tests__/__resources__/properties/default_properties.yaml index cf3e2b95..2e83890c 100644 --- a/__tests__/__resources__/properties/default_properties.yaml +++ b/__tests__/__resources__/properties/default_properties.yaml @@ -6,9 +6,6 @@ # my-writable-pds - this is a PDS on the system that we can write new # # members too. member names are randomized, so it's # # possible for existing members to be overwritten # -# ds-iefbr14-pds - PDS qualified by an IEFBR14 member JCL to submit # -# ds-sleep-pds - PDS qualified by an SLEEP member JCL to submit -# ds-iefbr14-ps - PS with an IEFBR14 JCL to submit # # ftp-host - The host name for the LPAR with FTP # # ftp-port - The FTP port # # uss-dir - directory which we can upload files to and then # @@ -40,24 +37,18 @@ datasets: # if this fails an error should be thrown and you may have to # re-create this data set renamablePDS: my-renamable-pds - # a Loadlib dataset name - dsnLoadLib: my-loadlib-dsn + # a Loadlib dataset name. It's supposed SYS1.NUCLEUS exists on every z/OS. + dsnLoadLib: SYS1.NUCLEUS # data set name prefix like "HLQ.ZFTPTEST" # all datasets generated by system test have this prefix in DSN dsnPrefix: my-dsn-prefix #-----------------------------------------------------------------------------# -# Set of properties for testing jobs # -#-----------------------------------------------------------------------------# -jobs: - # a PDS member containing IEFBR14 JCL that your user ID can submit - iefbr14Member: ds-iefbr14-pds - # a PDS member containing SLEEP JCL that your user ID can submit - sleepMember: ds-sleep-pds -#-----------------------------------------------------------------------------# # Set of properties for testing USS functionality # #-----------------------------------------------------------------------------# uss: - # directory to try to list, upload, download, delete files from + # directory to try to list, upload, download, delete files from. + # Run "mkdir uss-dir" from the home directory on z/OS USS. ussTestDirectory: uss-dir - # symbolic link of ussTestDirectory, created with "ln -s " + # symbolic link of ussTestDirectory. + # Run "ln -s uss-dir uss-dir-link" from the home directory on z/OS USS. ussTestDirectoryLink: uss-dir-link diff --git a/__tests__/__system__/cli/PrepareTestJclDatasets.ts b/__tests__/__system__/cli/PrepareTestJclDatasets.ts new file mode 100644 index 00000000..b9fb5695 --- /dev/null +++ b/__tests__/__system__/cli/PrepareTestJclDatasets.ts @@ -0,0 +1,26 @@ +/* + * This program and the accompanying materials are made available under the terms of the + * Eclipse Public License v2.0 which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-v20.html + * + * SPDX-License-Identifier: EPL-2.0 + * + * Copyright Contributors to the Zowe Project. + * + */ + +import { DataSetUtils } from "../../../src/api/DataSetUtils"; +import { TRANSFER_TYPE_ASCII } from "../../../src/api/CoreUtils"; + +export async function prepareTestJclDataSet(connection: any, pds: string, jclName: string): Promise { + const datasetName = `${pds}(${jclName})`; + const filteredMembers = await DataSetUtils.listMembers(connection, pds); + if (filteredMembers.find(member => member === jclName) === undefined) { + const options = { + localFile: `${__dirname}/../../../__tests__/__resources__/${jclName}.JCL`, + transferType: TRANSFER_TYPE_ASCII, + }; + await DataSetUtils.uploadDataSet(connection, datasetName, options); + } + return datasetName; +} diff --git a/__tests__/__system__/cli/delete/job/cli.delete.job.test.ts b/__tests__/__system__/cli/delete/job/cli.delete.job.test.ts index 417d4ae9..83d5a554 100644 --- a/__tests__/__system__/cli/delete/job/cli.delete.job.test.ts +++ b/__tests__/__system__/cli/delete/job/cli.delete.job.test.ts @@ -13,9 +13,11 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test- import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema"; import { FTPConfig } from "../../../../../src/api/FTPConfig"; import { CoreUtils } from "../../../../../src/api/CoreUtils"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let connection: any; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; describe("delete job command", () => { // Create the unique test environment @@ -27,16 +29,18 @@ describe("delete job command", () => { }); expect(testEnvironment).toBeDefined(); connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to submit a job from a local file and then delete the job", async () => { // download the appropriate JCL content from the data set - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member; const iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); const jobID = await connection.submitJCL(iefbr14Content); const ONE_SECOND = 1000; diff --git a/__tests__/__system__/cli/download/all-spool-by-jobid/cli.download.all-spool-by-jobid.test.ts b/__tests__/__system__/cli/download/all-spool-by-jobid/cli.download.all-spool-by-jobid.test.ts index a147932e..fd712dfe 100644 --- a/__tests__/__system__/cli/download/all-spool-by-jobid/cli.download.all-spool-by-jobid.test.ts +++ b/__tests__/__system__/cli/download/all-spool-by-jobid/cli.download.all-spool-by-jobid.test.ts @@ -14,9 +14,11 @@ import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSc import { FTPConfig } from "../../../../../src/api/FTPConfig"; import { IO } from "@zowe/imperative"; import { CoreUtils } from "../../../../../src/api/CoreUtils"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let connection: any; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; describe("download all-spool-by-jobid command", () => { // Create the unique test environment @@ -28,16 +30,18 @@ describe("download all-spool-by-jobid command", () => { }); expect(testEnvironment).toBeDefined(); connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to submit an IEFBR14 job and then download the jobid", async () => { // download the appropriate JCL content from the data set - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member; const iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); const jobid = await connection.submitJCL(iefbr14Content.toString()); const JOB_WAIT = 2000; @@ -56,7 +60,6 @@ describe("download all-spool-by-jobid command", () => { it("should be able to submit a job from a local file and then download the spool, omitting the jobid directory", async () => { // download the appropriate JCL content from the data set - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member; const iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); const jobid = await connection.submitJCL(iefbr14Content.toString()); const JOB_WAIT = 2000; diff --git a/__tests__/__system__/cli/download/data-set/cli.download.data-set.test.ts b/__tests__/__system__/cli/download/data-set/cli.download.data-set.test.ts index 8eb92ae9..4cc84ceb 100644 --- a/__tests__/__system__/cli/download/data-set/cli.download.data-set.test.ts +++ b/__tests__/__system__/cli/download/data-set/cli.download.data-set.test.ts @@ -14,9 +14,11 @@ import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSc import { FTPConfig } from "../../../../../src/api/FTPConfig"; import { generateRandomAlphaNumericString, generateRandomBytes } from "../../../../__src__/TestUtils"; import { IO } from "@zowe/imperative"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let connection: any; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; describe("submit job from local file command", () => { // Create the unique test environment @@ -28,16 +30,18 @@ describe("submit job from local file command", () => { }); expect(testEnvironment).toBeDefined(); connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to download a data set to a local file in text mode and verify the content", async () => { // download the appropriate JCL content from the data set - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member; const iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); const downloadFilePath = testEnvironment.workingDir + "/iefbr14.txt"; const result = runCliScript(__dirname + "/__scripts__/command_download_data_set.sh", testEnvironment, diff --git a/__tests__/__system__/cli/list/spool-files-by-jobid/cli.list.spool-files-by-jobid.test.ts b/__tests__/__system__/cli/list/spool-files-by-jobid/cli.list.spool-files-by-jobid.test.ts index b96ccea4..82f52f17 100644 --- a/__tests__/__system__/cli/list/spool-files-by-jobid/cli.list.spool-files-by-jobid.test.ts +++ b/__tests__/__system__/cli/list/spool-files-by-jobid/cli.list.spool-files-by-jobid.test.ts @@ -13,9 +13,11 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test- import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema"; import { FTPConfig } from "../../../../../src/api/FTPConfig"; import { CoreUtils } from "../../../../../src/api/CoreUtils"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let connection: any; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; describe("list spool-files-by-jobid command", () => { // Create the unique test environment @@ -27,16 +29,18 @@ describe("list spool-files-by-jobid command", () => { }); expect(testEnvironment).toBeDefined(); connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to submit a job and then list spool files for the job ID", async () => { // download the appropriate JCL content from the data set - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member; const iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); expect(iefbr14Content).toContain("IEFBR14"); const jobid = await connection.submitJCL(iefbr14Content); diff --git a/__tests__/__system__/cli/rename/data-set/cli.rename.data-set.test.ts b/__tests__/__system__/cli/rename/data-set/cli.rename.data-set.test.ts index f75ff604..c49f6995 100644 --- a/__tests__/__system__/cli/rename/data-set/cli.rename.data-set.test.ts +++ b/__tests__/__system__/cli/rename/data-set/cli.rename.data-set.test.ts @@ -14,11 +14,13 @@ import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSc import { FTPConfig } from "../../../../../src/api/FTPConfig"; import { generateRandomAlphaNumericString, randomDsName } from "../../../../__src__/TestUtils"; import { inspect } from "util"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let user: string; let connection: any; let testDataSet: string; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; describe("rename data set command", () => { // Create the unique test environment @@ -32,15 +34,17 @@ describe("rename data set command", () => { connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); user = testEnvironment.systemTestProperties.zftp.user.trim().toUpperCase(); testDataSet = testEnvironment.systemTestProperties.datasets.renamablePDS; + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to upload a file to a data set member then rename the member", async () => { - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member.toUpperCase(); const iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); const memberSuffixLength = 6; const originalMember = testDataSet + "(R" + generateRandomAlphaNumericString(memberSuffixLength) + ")"; diff --git a/__tests__/__system__/cli/submit/data-set/cli.submit.data-set.test.ts b/__tests__/__system__/cli/submit/data-set/cli.submit.data-set.test.ts index 939f6d63..302862ad 100644 --- a/__tests__/__system__/cli/submit/data-set/cli.submit.data-set.test.ts +++ b/__tests__/__system__/cli/submit/data-set/cli.submit.data-set.test.ts @@ -12,10 +12,13 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test-utils"; import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema"; import { FTPConfig } from "../../../../../src/api/FTPConfig"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let user: string; let connection: any; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; +let sleepDataSet: string; describe("submit job from data set command", () => { // Create the unique test environment @@ -28,15 +31,18 @@ describe("submit job from data set command", () => { expect(testEnvironment).toBeDefined(); connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); user = testEnvironment.systemTestProperties.zftp.user.trim().toUpperCase(); + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); + sleepDataSet = await prepareTestJclDataSet(connection, pds, "SLEEP"); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to submit a job from a data set and see the job name and job id", async () => { - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member; const result = runCliScript(__dirname + "/__scripts__/command_submit_data_set.sh", testEnvironment, [iefbr14DataSet]); expect(result.stderr.toString()).toEqual(""); expect(result.status).toEqual(0); @@ -45,7 +51,6 @@ describe("submit job from data set command", () => { }); it("should be able to submit a job from a data set with wait option and get rc successfully", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; const option = "--wait"; const wait = "3,10"; const result = runCliScript(__dirname + "/__scripts__/command_submit_data_set_wait.sh", testEnvironment, [sleepDataSet,option,wait]); @@ -58,7 +63,6 @@ describe("submit job from data set command", () => { }); it("should give a syntax error if the wait value is invalid", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; const option = "--wait"; const wait = "3,"; const result = runCliScript(__dirname + "/__scripts__/command_submit_data_set_wait.sh", testEnvironment, [sleepDataSet,option,wait]); @@ -68,7 +72,6 @@ describe("submit job from data set command", () => { }); it("should be able to submit a job from a data set but not finished within specified wait option", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; const option = "--wait"; const wait = "1,2"; const result = runCliScript(__dirname + "/__scripts__/command_submit_data_set_wait.sh", testEnvironment, [sleepDataSet,option,wait]); @@ -80,7 +83,6 @@ describe("submit job from data set command", () => { }); it("should be able to submit a job from a data set with wait-for-output option and get rc successfully", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; const option = "--wait-for-output"; const result = runCliScript(__dirname + "/__scripts__/command_submit_data_set_wait.sh", testEnvironment, [sleepDataSet,option]); expect(result.stderr.toString()).toEqual(""); @@ -91,7 +93,6 @@ describe("submit job from data set command", () => { }); it("should be able to submit a job from a data set with wait-for-active option and get rc successfully", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; const option = "--wait-for-active"; const result = runCliScript(__dirname + "/__scripts__/command_submit_data_set_wait.sh", testEnvironment, [sleepDataSet,option]); expect(result.stderr.toString()).toEqual(""); diff --git a/__tests__/__system__/cli/submit/local-file/cli.submit.local-file.test.ts b/__tests__/__system__/cli/submit/local-file/cli.submit.local-file.test.ts index e6f02968..f4793ada 100644 --- a/__tests__/__system__/cli/submit/local-file/cli.submit.local-file.test.ts +++ b/__tests__/__system__/cli/submit/local-file/cli.submit.local-file.test.ts @@ -13,9 +13,14 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test- import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema"; import { FTPConfig } from "../../../../../src/api/FTPConfig"; import { IO } from "@zowe/imperative"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let connection: any; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; +let sleepDataSet: string; +let iefbr14Content: string; +let sleepContent: string; describe("submit job from local file command", () => { // Create the unique test environment @@ -27,16 +32,20 @@ describe("submit job from local file command", () => { }); expect(testEnvironment).toBeDefined(); connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); + sleepDataSet = await prepareTestJclDataSet(connection, pds, "SLEEP"); + iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); + sleepContent = (await connection.getDataset(sleepDataSet)).toString(); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to submit a job from a local file and see the job name and job id", async () => { - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member; - const iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/iefbr14.txt"; await IO.writeFileAsync(jclFilePath, iefbr14Content); const result = runCliScript(__dirname + "/__scripts__/command_submit_local_file.sh", testEnvironment, [jclFilePath]); @@ -47,8 +56,6 @@ describe("submit job from local file command", () => { }); it("should be able to submit a job from a local file with wait option and get rc successfully", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; - const sleepContent = (await connection.getDataset(sleepDataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/sleep.txt"; await IO.writeFileAsync(jclFilePath, sleepContent); const option = "--wait"; @@ -63,8 +70,6 @@ describe("submit job from local file command", () => { }); it("should give a syntax error if the wait value is invalid", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; - const sleepContent = (await connection.getDataset(sleepDataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/sleep.txt"; await IO.writeFileAsync(jclFilePath, sleepContent); const option = "--wait"; @@ -76,8 +81,6 @@ describe("submit job from local file command", () => { }); it("should be able to submit a job from a local file but not finished within specified wait option", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; - const sleepContent = (await connection.getDataset(sleepDataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/sleep.txt"; await IO.writeFileAsync(jclFilePath, sleepContent); const option ="--wait"; @@ -91,8 +94,6 @@ describe("submit job from local file command", () => { }); it("should be able to submit a job from a local file with wait-for-output option and get rc successfully", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; - const sleepContent = (await connection.getDataset(sleepDataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/sleep.txt"; await IO.writeFileAsync(jclFilePath, sleepContent); const option = "--wait-for-output"; @@ -105,8 +106,6 @@ describe("submit job from local file command", () => { }); it("should be able to submit a job from a local file with wait-for-active option and get rc successfully", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; - const sleepContent = (await connection.getDataset(sleepDataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/sleep.txt"; await IO.writeFileAsync(jclFilePath, sleepContent); const option = "--wait-for-active"; diff --git a/__tests__/__system__/cli/submit/stdin/cli.submit.stdin.test.ts b/__tests__/__system__/cli/submit/stdin/cli.submit.stdin.test.ts index 90619b55..d35de744 100644 --- a/__tests__/__system__/cli/submit/stdin/cli.submit.stdin.test.ts +++ b/__tests__/__system__/cli/submit/stdin/cli.submit.stdin.test.ts @@ -13,9 +13,14 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test- import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema"; import { FTPConfig } from "../../../../../src/api/FTPConfig"; import { IO } from "@zowe/imperative"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let connection: any; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; +let sleepDataSet: string; +let iefbr14Content: string; +let sleepContent: string; describe("submit job from stdin command", () => { // Create the unique test environment @@ -27,16 +32,20 @@ describe("submit job from stdin command", () => { }); expect(testEnvironment).toBeDefined(); connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); + sleepDataSet = await prepareTestJclDataSet(connection, pds, "SLEEP"); + iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); + sleepContent = (await connection.getDataset(sleepDataSet)).toString(); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to submit a job from standard in and see the job name and job id", async () => { - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member; - const iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/iefbr14.txt"; await IO.writeFileAsync(jclFilePath, iefbr14Content); const result = runCliScript(__dirname + "/__scripts__/command_submit_stdin.sh", testEnvironment, [jclFilePath]); @@ -47,8 +56,6 @@ describe("submit job from stdin command", () => { }); it("should be able to submit a job from stdin with wait option and get rc successfully", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; - const sleepContent = (await connection.getDataset(sleepDataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/sleep.txt"; await IO.writeFileAsync(jclFilePath, sleepContent); const option ="--wait"; @@ -63,8 +70,6 @@ describe("submit job from stdin command", () => { }); it("should give a syntax error if the wait value is invalid", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; - const sleepContent = (await connection.getDataset(sleepDataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/sleep.txt"; await IO.writeFileAsync(jclFilePath, sleepContent); const option ="--wait"; @@ -77,8 +82,6 @@ describe("submit job from stdin command", () => { it("should be able to submit a job from stdin but not finished within specified wait option", async () => { // download the appropriate JCL content from the data set - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; - const sleepContent = (await connection.getDataset(sleepDataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/sleep.txt"; await IO.writeFileAsync(jclFilePath, sleepContent); const option ="--wait"; @@ -92,8 +95,6 @@ describe("submit job from stdin command", () => { }); it("should be able to submit a job from stdin with wait-for-output option and get rc successfully", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; - const sleepContent = (await connection.getDataset(sleepDataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/sleep.txt"; await IO.writeFileAsync(jclFilePath, sleepContent); const option = "--wait-for-output"; @@ -106,8 +107,6 @@ describe("submit job from stdin command", () => { }); it("should be able to submit a job from stdin with wait-for-active option and get rc successfully", async () => { - const sleepDataSet = testEnvironment.systemTestProperties.jobs.sleepMember; - const sleepContent = (await connection.getDataset(sleepDataSet)).toString(); const jclFilePath = testEnvironment.workingDir + "/sleep.txt"; await IO.writeFileAsync(jclFilePath, sleepContent); const option = "--wait-for-active"; diff --git a/__tests__/__system__/cli/view/all-spool-by-jobid/cli.view.all-spool-by-jobid.test.ts b/__tests__/__system__/cli/view/all-spool-by-jobid/cli.view.all-spool-by-jobid.test.ts index 67bb457f..eafc371d 100644 --- a/__tests__/__system__/cli/view/all-spool-by-jobid/cli.view.all-spool-by-jobid.test.ts +++ b/__tests__/__system__/cli/view/all-spool-by-jobid/cli.view.all-spool-by-jobid.test.ts @@ -13,9 +13,12 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test- import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema"; import { FTPConfig } from "../../../../../src/api/FTPConfig"; import { CoreUtils } from "../../../../../src/api/CoreUtils"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let connection: any; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; +let iefbr14Content: string; describe("view all-spool-by-jobid command", () => { // Create the unique test environment @@ -27,17 +30,18 @@ describe("view all-spool-by-jobid command", () => { }); expect(testEnvironment).toBeDefined(); connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); + iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to submit a job and then view all its spool", async () => { - // download the appropriate JCL content from the data set - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member; - let iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); const jobID = await connection.submitJCL(iefbr14Content); const JOB_WAIT = 2000; await CoreUtils.sleep(JOB_WAIT); diff --git a/__tests__/__system__/cli/view/data-set/cli.view.data-set.test.ts b/__tests__/__system__/cli/view/data-set/cli.view.data-set.test.ts index dcab7c96..26423dfd 100644 --- a/__tests__/__system__/cli/view/data-set/cli.view.data-set.test.ts +++ b/__tests__/__system__/cli/view/data-set/cli.view.data-set.test.ts @@ -13,10 +13,12 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test- import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema"; import { FTPConfig } from "../../../../../src/api/FTPConfig"; import { generateRandomAlphaNumericString, generateRandomBytes } from "../../../../__src__/TestUtils"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let connection: any; let testDataSet: string; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; describe("view data-set command", () => { // Create the unique test environment @@ -29,15 +31,17 @@ describe("view data-set command", () => { expect(testEnvironment).toBeDefined(); connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); testDataSet = testEnvironment.systemTestProperties.datasets.writablePDS; + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to view the job data set from the test properties file", async () => { - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member.toUpperCase(); const iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); const result = runCliScript(__dirname + "/__scripts__/command_view_data_set.sh", testEnvironment, [iefbr14DataSet]); expect(result.stderr.toString()).toEqual(""); diff --git a/__tests__/__system__/cli/view/job-status-by-jobid/cli.view.job-status-by-jobid.test.ts b/__tests__/__system__/cli/view/job-status-by-jobid/cli.view.job-status-by-jobid.test.ts index b89c1b61..09d51a39 100644 --- a/__tests__/__system__/cli/view/job-status-by-jobid/cli.view.job-status-by-jobid.test.ts +++ b/__tests__/__system__/cli/view/job-status-by-jobid/cli.view.job-status-by-jobid.test.ts @@ -13,9 +13,12 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test- import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema"; import { FTPConfig } from "../../../../../src/api/FTPConfig"; import { CoreUtils } from "../../../../../src/api/CoreUtils"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let connection: any; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; +let iefbr14Content: string; describe("view job-status-by-jobid command", () => { // Create the unique test environment @@ -27,17 +30,19 @@ describe("view job-status-by-jobid command", () => { }); expect(testEnvironment).toBeDefined(); connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); + iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to submit a job and then view its status", async () => { // download the appropriate JCL content from the data set - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member; - const iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); const jobID = await connection.submitJCL(iefbr14Content); const ONE_SECOND = 1000; await CoreUtils.sleep(ONE_SECOND); diff --git a/__tests__/__system__/cli/view/spool-file-by-id/cli.view.spool-file-by-id.test.ts b/__tests__/__system__/cli/view/spool-file-by-id/cli.view.spool-file-by-id.test.ts index b92da779..8f51a676 100644 --- a/__tests__/__system__/cli/view/spool-file-by-id/cli.view.spool-file-by-id.test.ts +++ b/__tests__/__system__/cli/view/spool-file-by-id/cli.view.spool-file-by-id.test.ts @@ -13,9 +13,12 @@ import { ITestEnvironment, TestEnvironment, runCliScript } from "@zowe/cli-test- import { ITestPropertiesSchema } from "../../../../__src__/doc/ITestPropertiesSchema"; import { FTPConfig } from "../../../../../src/api/FTPConfig"; import { CoreUtils } from "../../../../../src/api/CoreUtils"; +import { prepareTestJclDataSet } from "../../PrepareTestJclDatasets"; let connection: any; let testEnvironment: ITestEnvironment; +let iefbr14DataSet: string; +let iefbr14Content: string; describe("view spool-file-by-id command", () => { // Create the unique test environment @@ -27,17 +30,18 @@ describe("view spool-file-by-id command", () => { }); expect(testEnvironment).toBeDefined(); connection = await FTPConfig.connectFromArguments(testEnvironment.systemTestProperties.zftp); + + const pds = testEnvironment.systemTestProperties.datasets.writablePDS; + iefbr14DataSet = await prepareTestJclDataSet(connection, pds, "IEFBR14"); + iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); }); afterAll(async () => { - connection.close(); + connection?.close(); await TestEnvironment.cleanUp(testEnvironment); }); it("should be able to submit a job and then view the JESJCL DD by ID", async () => { - // download the appropriate JCL content from the data set - const iefbr14DataSet = testEnvironment.systemTestProperties.jobs.iefbr14Member; - let iefbr14Content = (await connection.getDataset(iefbr14DataSet)).toString(); const jobID = await connection.submitJCL(iefbr14Content); const FIVE_SECOND = 5000; await CoreUtils.sleep(FIVE_SECOND);