Skip to content

Commit

Permalink
Merge branch 'master' into upload-text-dataset-wuth-buffer
Browse files Browse the repository at this point in the history
Signed-off-by: Fernando Rijo Cedeno <[email protected]>
  • Loading branch information
zFernand0 authored Feb 5, 2024
2 parents 2ca48a9 + 9497b0f commit 5435aea
Show file tree
Hide file tree
Showing 22 changed files with 143 additions and 89 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js LTS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: lts/*

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/auto-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ jobs:
name: Process Label Action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Process Label Action
uses: hramos/respond-to-issue-based-on-label@v2
uses: dessant/label-actions@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: '.github/label-actions.yml'
github-token: ${{ secrets.GITHUB_TOKEN }}
config-path: '.github/label-actions.yml'
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js LTS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: lts/*

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
- uses: actions/stale@v9
with:
# General rules applied to both, issues and pull requests (PRs)
start-date: "2022-07-30T00:00:00Z"
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/zowe-cli-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand All @@ -70,17 +70,18 @@ jobs:

- name: Archive Results
if: ${{ always() && steps.build.outcome == 'success' }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.node-version }}-results
path: |
__tests__/__results__/
- name: Upload Results to Codecov
if: ${{ always() && steps.build.outcome == 'success' }}
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
env_vars: OS,NODE
token: ${{ secrets.CODECOV_TOKEN }}

release:
if: github.event_name == 'push' && github.ref_protected
Expand All @@ -89,14 +90,14 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
ref: ${{ github.ref }}

- name: Use Node.js LTS
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 'lts/*'

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All notable changes to the z/OS FTP Plug-in for Zowe CLI will be documented in t
## Recent Changes

- BugFix: Upload dataset using Buffer, stead of string. [2533](https://github.com/zowe/vscode-extension-for-zowe/issues/2533)
- Simplify the preparation for JCL system tests


## `2.1.7`
Expand Down
21 changes: 6 additions & 15 deletions __tests__/__resources__/properties/default_properties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down Expand Up @@ -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 <ussTestDirectory> <ussTestDirectoryLink>"
# symbolic link of ussTestDirectory.
# Run "ln -s uss-dir uss-dir-link" from the home directory on z/OS USS.
ussTestDirectoryLink: uss-dir-link
26 changes: 26 additions & 0 deletions __tests__/__system__/cli/PrepareTestJclDatasets.ts
Original file line number Diff line number Diff line change
@@ -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<string> {
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;
}
8 changes: 6 additions & 2 deletions __tests__/__system__/cli/delete/job/cli.delete.job.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ITestPropertiesSchema>;
let iefbr14DataSet: string;

describe("delete job command", () => {
// Create the unique test environment
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ITestPropertiesSchema>;
let iefbr14DataSet: string;

describe("download all-spool-by-jobid command", () => {
// Create the unique test environment
Expand All @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ITestPropertiesSchema>;
let iefbr14DataSet: string;

describe("submit job from local file command", () => {
// Create the unique test environment
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ITestPropertiesSchema>;
let iefbr14DataSet: string;

describe("list spool-files-by-jobid command", () => {
// Create the unique test environment
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<ITestPropertiesSchema>;
let iefbr14DataSet: string;

describe("rename data set command", () => {
// Create the unique test environment
Expand All @@ -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) + ")";
Expand Down
Loading

0 comments on commit 5435aea

Please sign in to comment.