Skip to content

Commit

Permalink
Fix remaining errors in system tests
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Johnson <[email protected]>
  • Loading branch information
t1m0thyj committed Oct 14, 2024
1 parent b2a3bac commit 336d3e4
Show file tree
Hide file tree
Showing 10 changed files with 95 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,24 @@ describe("List active workflow details cli system tests", () => {
afterAll(async () => {
// deleting wf instance
const response: any = await ZosmfRestClient.getExpectJSON(REAL_SESSION, "/zosmf/workflow/rest/1.0/workflows?workflowName=" + wfName);
response.workflows.forEach(async (element: any) => {
for (const element of response.workflows) {
if (element.workflowName === wfName) {
try {
await DeleteWorkflow.deleteWorkflow(REAL_SESSION, element.workflowKey);
} catch { /* Do nothing */ }
}
});
}
});
describe("Success Scenarios", () => {
it("Should list active workflow details using wf key.", async () => {
it("Should list active workflow details using wf key.", () => {
const response = runCliScript(__dirname + "/__scripts__/command/list_active_workflow_key_details.sh",
testEnvironment, [wfKey]);
expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(response.stdout.toString()).toContain("Workflow Details");
});

it("Should list active workflow details using wf name.", async () => {
it("Should list active workflow details using wf name.", () => {
const response = runCliScript(__dirname + "/__scripts__/command/list_active_workflow_name_details.sh",
testEnvironment, [wfName]);
expect(response.stderr.toString()).toBe("");
Expand All @@ -92,14 +92,14 @@ describe("List active workflow details cli system tests", () => {
});
});
describe("Failure Scenarios", () => {
it("Should throw error if the workflow does not exist", async () => {
it("Should throw error if the workflow does not exist", () => {
const response = runCliScript(__dirname + "/__scripts__/command/list_active_workflow_key_details.sh",
testEnvironment, [fakeDefFile]);
expect(response.status).toBe(1);
expect(response.stderr.toString()).toContain("does not exist.");
});

it("Should throw error if the workflow name does not exist", async () => {
it("Should throw error if the workflow name does not exist", () => {
const response = runCliScript(__dirname + "/__scripts__/command/list_active_workflow_name_details.sh",
testEnvironment, [fakeDefFile]);
expect(response.status).toBe(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,16 @@ describe("List workflow cli system tests", () => {
}
});
describe("Success Scenarios", () => {
it("Should return list of workflows in zOSMF.", async () => {
it("Should return list of workflows in zOSMF.", () => {
const response = runCliScript(__dirname + "/__scripts__/command/command_list_workflow.sh",
testEnvironment, [wfName]);
expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(response.stdout.toString()).toContain(`${wfName}`);
});
it("Should return a message if search does not match any existing workflows", async () => {
it("Should return a message if search does not match any existing workflows", () => {
const fakeName = `${wfName}${wfName}${wfName}`;
const response = await runCliScript(__dirname + "/__scripts__/command/command_list_workflow.sh",
const response = runCliScript(__dirname + "/__scripts__/command/command_list_workflow.sh",
testEnvironment, [fakeName]);
expect(response.status).toBe(0);
expect(response.stdout.toString()).toContain("No workflows match the requested querry");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,23 @@ describe("Retrieve workflow definition cli system tests", () => {
testEnvironment.resources.files.push(definitionFile);
});
describe("Success Scenarios", () => {
it("Should return the details of a workflow definition file.", async () => {
it("Should return the details of a workflow definition file.", () => {
const response = runCliScript(__dirname + "/__scripts__/command/command_definition_file_details.sh",
testEnvironment, [`/${defaultSystem.unix.testdir.toLocaleLowerCase()}/${uniqueFileName}.xml`]);
expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(response.stdout.toString()).toContain(`success": true`);
});
it("Should return a message if search does not match any existing files", async () => {
const response = await runCliScript(__dirname + "/__scripts__/command/command_definition_file_details.sh",
it("Should return a message if search does not match any existing files", () => {
const response = runCliScript(__dirname + "/__scripts__/command/command_definition_file_details.sh",
testEnvironment, [`/${defaultSystem.unix.testdir.toLocaleLowerCase()}/${uniqueFileName}`]);
expect(response.status).toBe(1);
expect(response.stdout.toString()).toContain("not found or cannot be accessed.");
});

it("Should return a message if search is for a diectory", async () => {
it("Should return a message if search is for a diectory", () => {
const fakeName = `/${defaultSystem.unix.testdir.toLocaleLowerCase()}`;
const response = await runCliScript(__dirname + "/__scripts__/command/command_definition_file_details.sh",
const response = runCliScript(__dirname + "/__scripts__/command/command_definition_file_details.sh",
testEnvironment, [fakeName]);
expect(response.status).toBe(1);
expect(response.stdout.toString()).toContain("is not a UNIX file");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe("Create workflow cli system tests", () => {
afterEach(async () => {
let error;
const response: any = await ZosmfRestClient.getExpectJSON(REAL_SESSION, "/zosmf/workflow/rest/1.0/workflows?workflowName=" + wfName);
response.workflows.forEach(async (element: any) => {
for (const element of response.workflows) {
if (element.workflowName === wfName) {
wfKey = element.workflowKey;
try {
Expand All @@ -73,25 +73,25 @@ describe("Create workflow cli system tests", () => {
error = err;
}
}
});
}
});
it("Should create workflow in zOSMF.", async () => {
it("Should create workflow in zOSMF.", () => {
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_uss.sh",
testEnvironment, [wfName, definitionFile, system, owner]);
expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(response.stdout.toString()).toContain("workflowKey");
});
it("Should throw error if workflow with the same name already exists", async () => {
const createWf = await runCliScript(__dirname + "/__scripts__/command/command_create_workflow_uss.sh",
it("Should throw error if workflow with the same name already exists", () => {
const createWf = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_uss.sh",

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note test

Unused variable createWf.
testEnvironment, [wfName, definitionFile, system, owner]);
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_uss.sh",
testEnvironment, [wfName, definitionFile, system, owner]);
expect(response.status).toBe(1);
expect(response.stderr.toString()).toContain("already exists.");
});
it("Should not throw error if workflow with the same name already exists and there is overwrite", async () => {
const createWf = await runCliScript(__dirname + "/__scripts__/command/command_create_workflow_uss.sh",
it("Should not throw error if workflow with the same name already exists and there is overwrite", () => {
const createWf = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_uss.sh",

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note test

Unused variable createWf.
testEnvironment, [wfName, definitionFile, system, owner]);
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_uss.sh",
testEnvironment, [wfName, definitionFile, system, owner, "--overwrite"]);
Expand All @@ -101,7 +101,7 @@ describe("Create workflow cli system tests", () => {
});
});
describe("Failure Scenarios", () => {
it("Should throw error if the uss file does not exist", async () => {
it("Should throw error if the uss file does not exist", () => {
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_uss.sh",
testEnvironment, [wfName, fakeDefFile, system, owner]);
expect(response.status).toBe(1);
Expand All @@ -113,7 +113,7 @@ describe("Create workflow cli system tests", () => {
describe("Success Scenarios", () => {
afterEach(async () =>{
let error;
const response: any = await ZosmfRestClient.getExpectJSON(REAL_SESSION, "/zosmf/workflow/rest/1.0/workflows?workflowName=" + wfName);
const response: any = await ZosmfRestClient.getExpectJSON(REAL_SESSION, "/zosmf/workflow/rest/1.0/workflows?workflowName=" + wfName);
let deleteWorkflow: any;
for (deleteWorkflow of response.workflows) {
if(deleteWorkflow.workflowName===wfName){
Expand All @@ -126,34 +126,34 @@ describe("Create workflow cli system tests", () => {
}
}
});
it("Should create workflow in zOSMF.", async () => {
const response = await runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",
it("Should create workflow in zOSMF.", () => {
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",
testEnvironment, [wfName, workflow, system, owner]);
expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(response.stdout.toString()).toContain("workflowKey");
});
it("Should throw error if workflow with the same name already exists", async () => {
const createWf = await runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",
it("Should throw error if workflow with the same name already exists", () => {
const createWf = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note test

Unused variable createWf.
testEnvironment, [wfName, workflow, system, owner]);
const response = await runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",
testEnvironment, [wfName, workflow, system, owner]);
expect(response.status).toBe(1);
expect(response.stderr.toString()).toContain("already exists.");
});
it("Should not throw error if workflow with the same name already exists and there is overwrite", async () => {
const createWf = await runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",
it("Should not throw error if workflow with the same name already exists and there is overwrite", () => {
const createWf = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note test

Unused variable createWf.
testEnvironment, [wfName, workflow, system, owner]);
const response = await runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",
testEnvironment, [wfName, workflow, system, owner, "--overwrite"]);
expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(response.stdout.toString()).toContain("workflowKey");
});
});
describe("Failure Scenarios", () => {
it("Should throw error if the local file does not exist", async () => {
const response = await runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",
it("Should throw error if the local file does not exist", () => {
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_local_file.sh",
testEnvironment, [wfName, fakeLocalFile, system, owner]);
expect(response.status).toBe(1);
expect(response.stderr.toString()).toContain("no such file or directory");
Expand All @@ -179,7 +179,7 @@ describe("Create workflow cli system tests", () => {
afterEach(async () => {
let error;
const response: any = await ZosmfRestClient.getExpectJSON(REAL_SESSION, "/zosmf/workflow/rest/1.0/workflows?workflowName=" + wfName);
response.workflows.forEach(async (element: any) => {
for (const element of response.workflows) {
if (element.workflowName === wfName) {
wfKey = element.workflowKey;
try {
Expand All @@ -188,25 +188,25 @@ describe("Create workflow cli system tests", () => {
error = err;
}
}
});
}
});
it("Should create workflow in zOSMF.", async () => {
it("Should create workflow in zOSMF.", () => {
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_ds.sh",
testEnvironment, [wfName, definitionDs, system, owner]);
expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(response.stdout.toString()).toContain("workflowKey");
});
it("Should throw error if workflow with the same name already exists", async () => {
const createWf = await runCliScript(__dirname + "/__scripts__/command/command_create_workflow_ds.sh",
it("Should throw error if workflow with the same name already exists", () => {
const createWf = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_ds.sh",

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note test

Unused variable createWf.
testEnvironment, [wfName, definitionDs, system, owner]);
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_ds.sh",
testEnvironment, [wfName, definitionDs, system, owner]);
expect(response.status).toBe(1);
expect(response.stderr.toString()).toContain("already exists.");
});
it("Should not throw error if workflow with the same name already exists and there is overwrite", async () => {
const createWf = await runCliScript(__dirname + "/__scripts__/command/command_create_workflow_ds.sh",
it("Should not throw error if workflow with the same name already exists and there is overwrite", () => {
const createWf = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_ds.sh",

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note test

Unused variable createWf.
testEnvironment, [wfName, definitionDs, system, owner]);
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_ds.sh",
testEnvironment, [wfName, definitionDs, system, owner, "--overwrite"]);
Expand All @@ -216,7 +216,7 @@ describe("Create workflow cli system tests", () => {
});
});
describe("Failure Scenarios", () => {
it("Should throw error if the dataset does not exist", async () => {
it("Should throw error if the dataset does not exist", () => {
const response = runCliScript(__dirname + "/__scripts__/command/command_create_workflow_ds.sh",
testEnvironment, [wfName, fakeDefFile, system, owner]);
expect(response.status).toBe(1);
Expand Down
Loading

0 comments on commit 336d3e4

Please sign in to comment.