Skip to content

Commit

Permalink
Merge pull request #2373 from zowe/v2-sys-test-fix-port
Browse files Browse the repository at this point in the history
V2 sys test fix port
  • Loading branch information
zFernand0 authored Nov 25, 2024
2 parents 4201dc5 + bf7edfb commit 08e02ce
Show file tree
Hide file tree
Showing 59 changed files with 404 additions and 159 deletions.
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;
}
5 changes: 1 addition & 4 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,11 @@ module.exports = {
...projectConfig,
"reporters": [
"default",
"jest-stare",
["jest-junit", {
"outputDirectory": "__tests__/__results__",
"reportTestSuiteErrors": true
}],
["jest-stare", {
"coverageLink": "../unit/coverage/lcov-report/index.html",
"resultDir": "__tests__/__results__/jest-stare"
}],
["github-actions", { "silent": false } ]
],
"testResultsProcessor": "jest-sonar-reporter",
Expand Down
2 changes: 1 addition & 1 deletion npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"prepare": "husky install && npm run bundle:webHelp",
"package": "lerna run prepublishOnly && node scripts/bundleCliTgz.js"
},
"dependencies": {},
"devDependencies": {
"@lerna-lite/changed": "^3.3.0",
"@lerna-lite/cli": "^3.3.0",
Expand Down Expand Up @@ -69,7 +68,7 @@
"jest-html-reporter": "^3.6.0",
"jest-junit": "^12.0.0",
"jest-sonar-reporter": "^2.0.0",
"jest-stare": "^2.2.0",
"jest-stare": "^2.5.2",
"js-yaml": "^4.1.0",
"jsonfile": "^4.0.0",
"madge": "^4.0.1",
Expand All @@ -85,5 +84,13 @@
},
"jestSonar": {
"reportPath": "__tests__/__results__/jest-sonar"
},
"jest-stare": {
"additionalResultsProcessors": [
"jest-junit",
"jest-sonar-reporter"
],
"coverageLink": "../unit/coverage/lcov-report/index.html",
"resultDir": "__tests__/__results__/jest-stare"
}
}
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
Loading

0 comments on commit 08e02ce

Please sign in to comment.