Skip to content

Commit 50e3b0c

Browse files
committed
don't over tolerate FSUM9195
1 parent ccd6c79 commit 50e3b0c

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

__tests__/api/BundlePush/BundlePusher.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,24 @@ describe("BundlePusher01", () => {
335335
expect(membersSpy).toHaveBeenCalledTimes(2);
336336
expect(submitSpy).toHaveBeenCalledTimes(2);
337337
});
338+
it("should not tolerate mixture of FSUM9195 and other FSUM messages", async () => {
339+
shellSpy.mockImplementation((session: any, cmd: string, dir: string, stdoutHandler: (data: string) => void) => {
340+
stdoutHandler("Injected FSUM9195 and FSUM9196 error message");
341+
});
342+
343+
await runPushTestWithError("__tests__/__resources__/ExampleBundle01", true,
344+
"A problem occurred attempting to run 'rm -r *' in remote directory '/u/ThisDoesNotExist/12345678'. " +
345+
"Problem is: The output from the remote command implied that an error occurred.");
346+
347+
expect(consoleText).toContain("Injected FSUM9195 and FSUM9196 error message");
348+
expect(zosMFSpy).toHaveBeenCalledTimes(1);
349+
expect(sshSpy).toHaveBeenCalledTimes(1);
350+
expect(createSpy).toHaveBeenCalledTimes(1);
351+
expect(listSpy).toHaveBeenCalledTimes(1);
352+
expect(shellSpy).toHaveBeenCalledTimes(1);
353+
expect(membersSpy).toHaveBeenCalledTimes(2);
354+
expect(submitSpy).toHaveBeenCalledTimes(1);
355+
});
338356
it("should handle error with attribs file", async () => {
339357
existsSpy.mockImplementation((data: string) => {
340358
if (data.indexOf(".zosattributes") > -1) {

src/api/BundlePush/BundlePusher.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,15 +319,26 @@ export class BundlePusher {
319319
try {
320320
this.sshOutputText = "";
321321
const shell = await Shell.executeSshCwd(sshSession, sshCommand, directory, this.sshOutput.bind(this));
322+
const upperCaseOutputText = this.sshOutputText.toUpperCase();
322323

323324
// Did the SSH command work? It's unclear how to tell, but for starters let's look for common
324-
// signifiers in the output text. Note that FSUM9195 implies that we've tried to delete the
325+
// signifiers in the output text. Note that FSUM9195 can imply that we've tried to delete the
325326
// contents of an empty directory - that's not a problem.
326-
const upperCaseOutputText = this.sshOutputText.toUpperCase();
327-
if (upperCaseOutputText.indexOf("ERROR ") > -1 ||
328-
(upperCaseOutputText.indexOf("FSUM") > -1 &&
329-
upperCaseOutputText.indexOf("FSUM9195") === -1) ||
327+
328+
// If there any FSUM messages other than FSUM9195 then that's a problem
329+
let otherFSUMMessages = false;
330+
const countFSUM = (upperCaseOutputText.match(/FSUM/g) || []).length;
331+
const countFSUM9195 = (upperCaseOutputText.match(/FSUM9195/g) || []).length;
332+
if (countFSUM > countFSUM9195) {
333+
otherFSUMMessages = true;
334+
}
335+
336+
// Now check for other common error signifiers
337+
if (otherFSUMMessages ||
338+
upperCaseOutputText.indexOf("ERROR ") > -1 ||
339+
upperCaseOutputText.indexOf("EDC") > -1 ||
330340
upperCaseOutputText.indexOf("ERR!") > -1 ) {
341+
331342
// if we've not already logged the output, log it now
332343
if (this.params.arguments.verbose !== true)
333344
{

0 commit comments

Comments
 (0)