Skip to content

Commit 5e4c175

Browse files
committed
treat FSUM messages as a failure
1 parent 5b98124 commit 5e4c175

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

__tests__/api/BundlePush/BundlePusher.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,40 @@ describe("BundlePusher01", () => {
436436
expect(readSpy).toHaveBeenCalledTimes(1);
437437
expect(uploadSpy).toHaveBeenCalledTimes(1);
438438
});
439+
it("should handle failure of remote npm install with FSUM message", async () => {
440+
shellSpy.mockImplementation((session: any, cmd: string, dir: string, stdoutHandler: (data: string) => void) => {
441+
if (cmd.indexOf("npm install") > -1) {
442+
stdoutHandler("Injected FSUM7351 not found message");
443+
}
444+
else {
445+
return true;
446+
}
447+
});
448+
existsSpy.mockImplementation((data: string) => {
449+
if (data.indexOf(".zosattributes") > -1) {
450+
return false;
451+
}
452+
if (data.indexOf("package.json") > -1) {
453+
return true;
454+
}
455+
});
456+
457+
await runPushTestWithError("__tests__/__resources__/ExampleBundle01", false,
458+
"A problem occurred attempting to run 'npm install' in remote directory '/u/ThisDoesNotExist/12345678'. " +
459+
"Problem is: The output from the remote command implied that an error occurred.");
460+
461+
expect(consoleText).toContain("Injected FSUM7351 not found message");
462+
expect(zosMFSpy).toHaveBeenCalledTimes(1);
463+
expect(sshSpy).toHaveBeenCalledTimes(1);
464+
expect(createSpy).toHaveBeenCalledTimes(1);
465+
expect(listSpy).toHaveBeenCalledTimes(1);
466+
expect(shellSpy).toHaveBeenCalledTimes(1);
467+
expect(membersSpy).toHaveBeenCalledTimes(0);
468+
expect(submitSpy).toHaveBeenCalledTimes(0);
469+
expect(existsSpy).toHaveBeenCalledTimes(2);
470+
expect(readSpy).toHaveBeenCalledTimes(1);
471+
expect(uploadSpy).toHaveBeenCalledTimes(1);
472+
});
439473
it("should handle error with remote bundle deploy", async () => {
440474
submitSpy.mockImplementationOnce(() => { throw new Error("Injected deploy error"); });
441475

src/api/BundlePush/BundlePusher.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ export class BundlePusher {
302302

303303
// Did the SSH command work? It's unclear how to tell, but for starters let's look for the word
304304
// 'error' in the output text.
305-
if (this.sshOutputText.toUpperCase().indexOf("ERROR ") > -1) {
305+
if (this.sshOutputText.toUpperCase().indexOf("ERROR ") > -1 ||
306+
this.sshOutputText.toUpperCase().indexOf("FSUM") > -1 ) {
306307
// if we've not already logged the output, log it now
307308
if (this.params.arguments.verbose !== true)
308309
{

0 commit comments

Comments
 (0)