Skip to content

Commit 355006d

Browse files
committed
Merge remote-tracking branch 'upstream/dev' into branch1
2 parents 5890a3a + d2b4c9b commit 355006d

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed

__tests__/api/BundlePush/BundlePusher.test.ts

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1302,7 +1302,7 @@ describe("BundlePusher01", () => {
13021302
it("should generate diagnostics even if deploy fails", async () => {
13031303
cicsProfile = { host: "wibble", port: 443, user: "user", password: "thisIsntReal" };
13041304
submitSpy = jest.spyOn(SubmitJobs, "submitJclString").mockImplementation(() =>
1305-
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2055I"}] );
1305+
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2055I DFHRL2067W"}] );
13061306
readSpy = jest.spyOn(fs, "readFileSync").mockImplementation((data: string) => {
13071307
if (data.indexOf("cics.xml") > -1) {
13081308
return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\">" +
@@ -1653,6 +1653,55 @@ describe("BundlePusher01", () => {
16531653
expect(uploadSpy).toHaveBeenCalledTimes(1);
16541654
expect(cmciSpy).toHaveBeenCalledTimes(2);
16551655
});
1656+
1657+
it("should not attempt to generate diagnostics for NODEJSAPPs if bundle does not install", async () => {
1658+
readSpy = jest.spyOn(fs, "readFileSync").mockImplementation((data: string) => {
1659+
if (data.indexOf("cics.xml") > -1) {
1660+
return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\">" +
1661+
"<define name=\"test\" type=\"http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP\" path=\"nodejsapps/test.nodejsapp\"></define>" +
1662+
"</manifest>";
1663+
}
1664+
});
1665+
submitSpy = jest.spyOn(SubmitJobs, "submitJclString").mockImplementation(() =>
1666+
[{ddName: "SYSTSPRT", stepName: "DFHDPLOY", data: "DFHRL2055I"}] );
1667+
cicsProfile = { host: "wibble", user: "user", password: "thisIsntReal", cicsPlex: "12345678", regionName: "12345678" };
1668+
cmciSpy.mockImplementation((cicsSession: any, nodejsData: cmci.IResourceParms) => {
1669+
if (nodejsData.name === "CICSRegion") {
1670+
return { response: {
1671+
records: {
1672+
cicsregion: {
1673+
applid: "ABCDEFG", jobid: "JOB12345", jobname: "MYCICS"
1674+
}
1675+
}
1676+
}
1677+
};
1678+
} else if (nodejsData.name === "CICSNodejsapp") {
1679+
return { response: {
1680+
records: {
1681+
cicsnodejsapp: [{
1682+
name: "name", pid: "22", enablestatus: "ENABLED", stderr: "/tmp/stderr", stdout: "/tmp/stdout", eyu_cicsname: "1"
1683+
}]
1684+
}
1685+
}
1686+
};
1687+
} else {
1688+
return {};
1689+
}
1690+
});
1691+
1692+
const parms = getCommonParmsForPushTests();
1693+
1694+
await runPushTestWithError("__tests__/__resources__/ExampleBundle01", false,
1695+
"DFHDPLOY stopped processing for jobid UNKNOWN due to an error.", parms);
1696+
1697+
expect(consoleText).toContain("Gathering scope information");
1698+
expect(consoleText).toContain("Querying regions in scope over CMCI");
1699+
expect(consoleText).not.toContain("Querying NODEJSAPP resources over CMCI");
1700+
expect(consoleText).not.toContain("zowe cics get resource CICSNodejsapp");
1701+
expect(consoleText).not.toContain("An attempt to query the remote CICSplex using the cics plug-in has failed");
1702+
expect(consoleText).toContain("DFHDPLOY output implied the bundle failed to install.");
1703+
expect(cmciSpy).toHaveBeenCalledTimes(1);
1704+
});
16561705
});
16571706

16581707
async function runPushTestWithError(localBundleDir: string, overwrite: boolean, errorText: string, parmsIn?: IHandlerParameters) {

src/api/BundlePush/BundlePusher.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,15 @@ export class BundlePusher {
399399

400400
// Collect general information about the regions in the CICSplex scope
401401
let deployMessages = await this.generateGeneralDiagnostics(cicsSession);
402-
if (deployMessages !== "" && bundle.containsDefinitionsOfType("http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP")) {
402+
403+
if (deployError !== undefined && dfhdployOutput.indexOf("DFHRL2067") === -1) {
404+
// If we have an error, but DFHDPLOY did not report that some bundleparts are disabled,
405+
// we can assume bundle didn't install at all. In this case skip generation of
406+
// Node.js diagnostics.
407+
deployMessages += "DFHDPLOY output implied the bundle failed to install. Check the output above for further information. ";
408+
deployMessages += "Consider examining the JESMSGLG, MSGUSR, SYSPRINT and SYSOUT spool files of the CICS region job, ";
409+
deployMessages += "or consult your CICS system programmer.\n";
410+
} else if (deployMessages !== "" && bundle.containsDefinitionsOfType("http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP")) {
403411
// Generate additional diagnostic output for Node.js
404412
deployMessages += await this.generateNodejsSpecificDiagnostics(cicsSession);
405413
}

0 commit comments

Comments
 (0)