@@ -112,7 +112,7 @@ describe("BundlePusher01", () => {
112
112
cmciSpy = jest . spyOn ( cmci , "getResource" ) . mockImplementation ( ( ) => ( { response : { records : { } } } ) ) ;
113
113
consoleText = "" ;
114
114
zosmfProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , port : 443 , rejectUnauthorized : true } ;
115
- sshProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" } ;
115
+ sshProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , port : 22 } ;
116
116
cicsProfile = undefined ;
117
117
} ) ;
118
118
afterEach ( ( ) => {
@@ -200,8 +200,6 @@ describe("BundlePusher01", () => {
200
200
expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
201
201
} ) ;
202
202
it ( "should implement --zosmf-* overrides" , async ( ) => {
203
- zosmfProfile = { host : "wibble" , user : "user" } ;
204
- sshProfile = { host : "wibble" , user : "user" } ;
205
203
const parms = getCommonParmsForPushTests ( ) ;
206
204
parms . arguments . zh = "overrideHost" ;
207
205
parms . arguments . zp = 123 ;
@@ -258,74 +256,125 @@ describe("BundlePusher01", () => {
258
256
expect ( zosMFSpy ) . toHaveBeenCalledTimes ( 1 ) ;
259
257
expect ( sshSpy ) . toHaveBeenCalledTimes ( 1 ) ;
260
258
} ) ;
259
+ it ( "should implement --ssh-* overrides" , async ( ) => {
260
+ const parms = getCommonParmsForPushTests ( ) ;
261
+ parms . arguments . sh = "overrideHost" ;
262
+ parms . arguments . sp = 500 ;
263
+ parms . arguments . su = "overrideUser" ;
264
+ parms . arguments . spw = "overridePassword" ;
265
+ parms . arguments . spk = "overridePrivateKey" ;
266
+ parms . arguments . skp = "overrideKeyPassphrase" ;
267
+ parms . arguments . sht = 555 ;
268
+ sshSpy . mockImplementationOnce ( ( profile : IProfile ) => {
269
+ expect ( profile . host ) . toMatch ( "overrideHost" ) ;
270
+ expect ( profile . port ) . toEqual ( 500 ) ;
271
+ expect ( profile . user ) . toMatch ( "overrideUser" ) ;
272
+ expect ( profile . password ) . toMatch ( "overridePassword" ) ;
273
+ expect ( profile . privateKey ) . toMatch ( "overridePrivateKey" ) ;
274
+ expect ( profile . keyPassphrase ) . toMatch ( "overrideKeyPassphrase" ) ;
275
+ expect ( profile . handshakeTimeout ) . toEqual ( 555 ) ;
276
+ } ) ;
277
+
278
+ await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
279
+ "PUSH operation completed" , parms ) ;
280
+ } ) ;
281
+ it ( "should complain if ssh-host notset" , async ( ) => {
282
+ sshProfile = undefined ;
283
+
284
+ await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
285
+ "Required parameter --ssh-host is not set." ) ;
286
+ } ) ;
287
+ it ( "should complain if ssh-port notset" , async ( ) => {
288
+ sshProfile = { host : "wibble" } ;
289
+
290
+ await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
291
+ "Required parameter --ssh-port is not set." ) ;
292
+ } ) ;
293
+ it ( "should complain if ssh-user notset" , async ( ) => {
294
+ sshProfile = { host : "wibble" , port : 22 } ;
295
+
296
+ await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
297
+ "Required parameter --ssh-user is not set." ) ;
298
+ } ) ;
261
299
it ( "should complain with mismatching zOSMF and SSH profile host names" , async ( ) => {
262
- sshProfile = { host : "wobble" , user : "user" } ;
300
+ const parms = getCommonParmsForPushTests ( ) ;
301
+ parms . arguments . zh = "wibble" ;
302
+ parms . arguments . sh = "wobble" ;
263
303
264
304
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
265
- "PUSH operation completed" ) ;
266
- expect ( consoleText ) . toContain ( "WARNING: ssh profile -- host value 'wobble' does not match zosmf value 'wibble'." ) ;
305
+ "PUSH operation completed" , parms ) ;
306
+ expect ( consoleText ) . toContain ( "WARNING: --ssh- host value 'wobble' does not match -- zosmf-host value 'wibble'." ) ;
267
307
} ) ;
268
308
it ( "should not complain with matching zOSMF and SSH profile host names" , async ( ) => {
269
- sshProfile = { host : "wibble" , user : "user" } ;
309
+ const parms = getCommonParmsForPushTests ( ) ;
310
+ parms . arguments . zh = "wibble" ;
311
+ parms . arguments . sh = "wibble" ;
270
312
271
313
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
272
- "PUSH operation completed" ) ;
273
- expect ( consoleText ) . not . toContain ( "WARNING: ssh profile " ) ;
314
+ "PUSH operation completed" , parms ) ;
315
+ expect ( consoleText ) . not . toContain ( "WARNING: -- ssh-host " ) ;
274
316
} ) ;
275
317
it ( "should complain with mismatching zOSMF and CICS profile host names" , async ( ) => {
276
318
cicsProfile = { host : "different" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
277
319
278
320
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
279
321
"PUSH operation completed" ) ;
280
- expect ( consoleText ) . toContain ( "WARNING: cics profile -- host value 'different' does not match zosmf value 'wibble'." ) ;
322
+ expect ( consoleText ) . toContain ( "WARNING: --cics- host value 'different' does not match -- zosmf-host value 'wibble'." ) ;
281
323
} ) ;
282
324
it ( "should not complain with matching zOSMF and CICS profile host names" , async ( ) => {
283
325
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
284
326
285
327
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
286
328
"PUSH operation completed" ) ;
287
- expect ( consoleText ) . not . toContain ( "WARNING: cics profile " ) ;
329
+ expect ( consoleText ) . not . toContain ( "WARNING: -- cics-host " ) ;
288
330
} ) ;
289
331
it ( "should complain with mismatching zOSMF and SSH profile user names" , async ( ) => {
290
- sshProfile = { host : "wibble" , user : "joe" } ;
332
+ const parms = getCommonParmsForPushTests ( ) ;
333
+ parms . arguments . zu = "fred" ;
334
+ parms . arguments . su = "joe" ;
291
335
292
336
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
293
- "PUSH operation completed" ) ;
294
- expect ( consoleText ) . toContain ( "WARNING: ssh profile -- user value 'joe' does not match zosmf value 'user '." ) ;
337
+ "PUSH operation completed" , parms ) ;
338
+ expect ( consoleText ) . toContain ( "WARNING: --ssh- user value 'joe' does not match -- zosmf-user value 'fred '." ) ;
295
339
} ) ;
296
340
it ( "should not complain with matching zOSMF and SSH profile user names" , async ( ) => {
297
- sshProfile = { host : "wibble" , user : "user" } ;
341
+ const parms = getCommonParmsForPushTests ( ) ;
342
+ parms . arguments . zu = "fred" ;
343
+ parms . arguments . su = "fred" ;
298
344
299
345
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
300
- "PUSH operation completed" ) ;
301
- expect ( consoleText ) . not . toContain ( "WARNING: ssh profile " ) ;
346
+ "PUSH operation completed" , parms ) ;
347
+ expect ( consoleText ) . not . toContain ( "WARNING: -- ssh-user " ) ;
302
348
} ) ;
303
349
it ( "should not complain with matching zOSMF and SSH profile user names - case" , async ( ) => {
304
- sshProfile = { host : "wibble" , user : "USER" } ;
350
+ const parms = getCommonParmsForPushTests ( ) ;
351
+ parms . arguments . zu = "fred" ;
352
+ parms . arguments . su = "FRED" ;
305
353
306
354
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
307
- "PUSH operation completed" ) ;
308
- expect ( consoleText ) . not . toContain ( "WARNING: ssh profile " ) ;
355
+ "PUSH operation completed" , parms ) ;
356
+ expect ( consoleText ) . not . toContain ( "WARNING: -- ssh-user " ) ;
309
357
} ) ;
310
358
it ( "should complain with mismatching zOSMF and CICS profile user names" , async ( ) => {
311
- sshProfile = { host : "wibble" , user : "fred" } ;
312
359
cicsProfile = { host : "wibble" , user : "joe" , password : "thisIsntReal" , cicsPlex : "12345678" } ;
313
360
314
361
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
315
362
"PUSH operation completed" ) ;
316
- expect ( consoleText ) . toContain ( "WARNING: cics profile -- user value 'joe' does not match zosmf value 'user'." ) ;
363
+ expect ( consoleText ) . toContain ( "WARNING: --cics- user value 'joe' does not match -- zosmf-user value 'user'." ) ;
317
364
} ) ;
318
365
it ( "should complain with mismatching zOSMF and SSH profile passwords" , async ( ) => {
319
- sshProfile = { host : "wibble" , user : "user" , password : "fakeSshPassword" } ;
366
+ const parms = getCommonParmsForPushTests ( ) ;
367
+ parms . arguments . zpw = "fakeZosmfPassword" ;
368
+ parms . arguments . spw = "fakeSshPassword" ;
320
369
321
370
await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
322
- "Incompatible security credentials exist in the zosmf and ssh profiles." ) ;
371
+ "Incompatible security credentials exist in the zosmf and ssh configurations." , parms ) ;
323
372
324
- expect ( consoleText ) . not . toContain ( "thisIsntReal " ) ;
373
+ expect ( consoleText ) . not . toContain ( "fakeZosmfPassword " ) ;
325
374
expect ( consoleText ) . not . toContain ( "fakeSshPassword" ) ;
326
375
} ) ;
327
376
it ( "should tolerate mismatching zOSMF and SSH credentials if SSH keys are used" , async ( ) => {
328
- sshProfile = { host : "wibble" , user : "fred" , privateKey : "fakeSshKey" } ;
377
+ sshProfile = { host : "wibble" , user : "fred" , privateKey : "fakeSshKey" , port : 22 } ;
329
378
330
379
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
331
380
"PUSH operation completed" ) ;
@@ -337,18 +386,11 @@ describe("BundlePusher01", () => {
337
386
cicsProfile = { host : "wibble" , user : "user" , password : "fakePassword2" , cicsPlex : "12345678" } ;
338
387
339
388
await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
340
- "Incompatible security credentials exist in the zosmf and cics profiles ." ) ;
389
+ "Incompatible security credentials exist in the zosmf and cics configurations ." ) ;
341
390
342
391
expect ( consoleText ) . not . toContain ( "thisIsntReal" ) ;
343
392
expect ( consoleText ) . not . toContain ( "fakePassword2" ) ;
344
393
} ) ;
345
- it ( "should complain with mismatching cics-deploy and CICS plex names" , async ( ) => {
346
- cicsProfile = { host : "wibble" , user : "fred" , password : "thisIsntReal" , cicsPlex : "wibble" , regionName : "12345678" } ;
347
-
348
- await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
349
- "PUSH operation completed" ) ;
350
- expect ( consoleText ) . toContain ( "WARNING: cics profile --cics-plex value 'wibble' does not match --cicsplex value '12345678'." ) ;
351
- } ) ;
352
394
it ( "should complain if remote bundle dir mkdir fails" , async ( ) => {
353
395
createSpy . mockImplementationOnce ( ( ) => { throw new Error ( "Injected Create error" ) ; } ) ;
354
396
await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
@@ -1600,5 +1642,12 @@ function getCommonParmsForPushTests(): IHandlerParameters {
1600
1642
parms . arguments . zpw = undefined ;
1601
1643
parms . arguments . zru = undefined ;
1602
1644
parms . arguments . zbp = undefined ;
1645
+ parms . arguments . sh = undefined ;
1646
+ parms . arguments . sp = undefined ;
1647
+ parms . arguments . su = undefined ;
1648
+ parms . arguments . spw = undefined ;
1649
+ parms . arguments . spk = undefined ;
1650
+ parms . arguments . skp = undefined ;
1651
+ parms . arguments . sht = undefined ;
1603
1652
return parms ;
1604
1653
}
0 commit comments