Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 sys test fix port #2373

Draft
wants to merge 9 commits into
base: zowe-v2-lts
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions __tests__/__resources__/properties/default_properties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ zosjobs:
modifiedJobclass: B
# System affinity
sysaff: zosjobs-sysaff
# CIM Support
skipCIM: false
#-----------------------------------------------------------------------------#
# Set of properties for testing provisioning #
#-----------------------------------------------------------------------------#
Expand Down
1 change: 1 addition & 0 deletions __tests__/__src__/properties/ITestZosJobsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ export interface ITestZosJobsSchema {
jobclass: string;
modifiedJobclass: string;
sysaff: string;
skipCIM?: boolean;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -e

HOST=$1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -e

HOST=$1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -e

HOST=$1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -e

HOST=$1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -e

HOST=$1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -e

zowe config auto-init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
const profiles = JSONC.parse(config).profiles;
Expand Down Expand Up @@ -105,6 +106,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();
const profiles = JSONC.parse(config).profiles;
Expand Down Expand Up @@ -183,6 +185,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();
const profiles = JSONC.parse(config).profiles;
Expand Down Expand Up @@ -249,6 +252,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();
const profiles = JSONC.parse(config).profiles;
Expand Down Expand Up @@ -313,7 +317,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();
const profiles = JSONC.parse(config).profiles;
let zosmfExists = false;
Expand Down Expand Up @@ -372,7 +376,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();
const profiles = JSONC.parse(config).profiles;
let zosmfExists = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ then
exit $RC
fi

sleep 1

# Cancel the job
zowe jobs cancel job $JOBID
RC=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ then
exit $RC
fi

sleep 1

# Cancel the job 1
zowe jobs cancel job $JOBID --modify-version 1.0
RC=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ then
exit $RC
fi

sleep 1

# Cancel the job 1
zowe jobs cancel job $JOBID --modify-version 2.0
RC=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ then
exit $RC
fi

sleep 1

# Cancel the job 1
zowe jobs cancel job $JOBID --modify-version 2.0
RC=$?
Expand All @@ -26,6 +28,8 @@ then
exit $RC
fi

sleep 1

# Cancel the job 2
zowe jobs cancel job $JOBID --modify-version 2.0
RC=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ import { TestEnvironment } from "../../../../../../__tests__/__src__/environment
import { ITestPropertiesSchema } from "../../../../../../__tests__/__src__/properties/ITestPropertiesSchema";
import { JobTestsUtils } from "../../../../../zosjobs/__tests__/__system__/JobTestsUtils";
import { IO } from "@zowe/imperative";
import { DeleteJobs, IJob } from "@zowe/zos-jobs-for-zowe-sdk";
import { Session } from "@zowe/imperative";

// Test Environment populated in the beforeAll();
let REAL_SESSION: Session;
let TEST_ENVIRONMENT: ITestEnvironment<ITestPropertiesSchema>;
const LOCAL_JCL_FILE: string = __dirname + "/" + "testFileOfLocalJCL.txt";
const jobsToDelete = new Map<string, string>();
const jobDataRegexV1 = /Successfully submitted request to cancel job (\w+) \((JOB\d+)\)/;
const jobNameRegexV1 = /job (\w+)/i;

describe("zos-jobs cancel job command", () => {
// Create the unique test environment
Expand All @@ -28,6 +34,8 @@ describe("zos-jobs cancel job command", () => {
});
const systemProps = TEST_ENVIRONMENT.systemTestProperties;

REAL_SESSION = TestEnvironment.createZosmfSession(TEST_ENVIRONMENT);

const jcl = JobTestsUtils.getSleepJCL(systemProps.zosmf.user, systemProps.tso.account, systemProps.zosjobs.jobclass);
const bufferJCL: Buffer = Buffer.from(jcl);
IO.createFileSync(LOCAL_JCL_FILE);
Expand All @@ -36,6 +44,9 @@ describe("zos-jobs cancel job command", () => {

afterAll(async () => {
IO.deleteFile(LOCAL_JCL_FILE);
for (const [jobname, jobid] of jobsToDelete) {
await DeleteJobs.deleteJob(REAL_SESSION, jobname, jobid);
}
});

describe("error handling", () => {
Expand Down Expand Up @@ -67,10 +78,20 @@ 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 jobname = response.stdout.toString().match(jobNameRegexV1).pop();
const jobid = response.stdout.toString().match(jobDataRegexV1).pop();

jobsToDelete.set(jobname, jobid);
}
});

it("should cancel a job v2", () => {
Expand Down Expand Up @@ -108,18 +129,27 @@ 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");
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 jobname = response.stdout.toString().match(jobNameRegexV1).pop();
const jobid = response.stdout.toString().match(jobDataRegexV1).pop();

jobsToDelete.set(jobname, jobid);
}
});

it("cancel a job without a profile 2.0", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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=$?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,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", () => {
Expand Down Expand Up @@ -88,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 () => {
Expand Down
Loading