@@ -114,8 +114,8 @@ describe("BundlePusher01", () => {
114
114
lstatSpy = jest . spyOn ( fs , "lstatSync" ) . mockImplementation ( ( ) => ( IS_NOT_DIRECTORY ) ) ;
115
115
cmciSpy = jest . spyOn ( cmci , "getResource" ) . mockImplementation ( ( ) => ( { response : { records : { } } } ) ) ;
116
116
consoleText = "" ;
117
- zosmfProfile = { host : "testhost " , user : "testuser " } ;
118
- sshProfile = { host : "testhost " , user : "testuser " } ;
117
+ zosmfProfile = { host : "wibble " , user : "user" , password : "thisIsntReal " } ;
118
+ sshProfile = { host : "wibble " , user : "user" , password : "thisIsntReal " } ;
119
119
cicsProfile = undefined ;
120
120
} ) ;
121
121
afterEach ( ( ) => {
@@ -226,15 +226,13 @@ describe("BundlePusher01", () => {
226
226
expect ( consoleText ) . not . toContain ( "WARNING: ssh profile" ) ;
227
227
} ) ;
228
228
it ( "should complain with mismatching zOSMF and CICS profile host names" , async ( ) => {
229
- cicsProfile = { host : "wibble " , user : "testuser " , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
229
+ cicsProfile = { host : "different " , user : "user " , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
230
230
231
231
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
232
232
"PUSH operation completed" ) ;
233
- expect ( consoleText ) . toContain ( "WARNING: cics profile --host value 'wibble ' does not match zosmf value 'testhost '." ) ;
233
+ expect ( consoleText ) . toContain ( "WARNING: cics profile --host value 'different ' does not match zosmf value 'wibble '." ) ;
234
234
} ) ;
235
235
it ( "should not complain with matching zOSMF and CICS profile host names" , async ( ) => {
236
- zosmfProfile = { host : "wibble" , user : "user" } ;
237
- sshProfile = { host : "wibble" , user : "user" } ;
238
236
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
239
237
240
238
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
@@ -274,9 +272,38 @@ describe("BundlePusher01", () => {
274
272
"PUSH operation completed" ) ;
275
273
expect ( consoleText ) . toContain ( "WARNING: cics profile --user value 'joe' does not match zosmf value 'fred'." ) ;
276
274
} ) ;
275
+ it ( "should complain with mismatching zOSMF and SSH profile passwords" , async ( ) => {
276
+ zosmfProfile = { host : "wibble" , user : "fred" , password : "fakeZosmfPassword" } ;
277
+ sshProfile = { host : "wibble" , user : "fred" , password : "fakeSshPassword" } ;
278
+
279
+ await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
280
+ "Incompatible security credentials exist in the zosmf and ssh profiles." ) ;
281
+
282
+ expect ( consoleText ) . not . toContain ( "fakeZosmfPassword" ) ;
283
+ expect ( consoleText ) . not . toContain ( "fakeSshPassword" ) ;
284
+ } ) ;
285
+ it ( "should tolerate mismatching zOSMF and SSH credentials if SSH keys are used" , async ( ) => {
286
+ zosmfProfile = { host : "wibble" , user : "fred" , password : "fakeZosmfPassword" } ;
287
+ sshProfile = { host : "wibble" , user : "fred" , privateKey : "fakeSshKey" } ;
288
+
289
+ await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
290
+ "PUSH operation completed" ) ;
291
+
292
+ expect ( consoleText ) . not . toContain ( "fakeZosmfPassword" ) ;
293
+ expect ( consoleText ) . not . toContain ( "fakeSshKey" ) ;
294
+ } ) ;
295
+ it ( "should complain with mismatching zOSMF and cics profile passwords" , async ( ) => {
296
+ zosmfProfile = { host : "wibble" , user : "fred" , password : "fakePassword" } ;
297
+ sshProfile = { host : "wibble" , user : "fred" , password : "fakePassword" } ;
298
+ cicsProfile = { host : "wibble" , user : "fred" , password : "fakePassword2" , cicsPlex : "12345678" } ;
299
+
300
+ await runPushTestWithError ( "__tests__/__resources__/ExampleBundle01" , false ,
301
+ "Incompatible security credentials exist in the zosmf and cics profiles." ) ;
302
+
303
+ expect ( consoleText ) . not . toContain ( "fakePassword" ) ;
304
+ expect ( consoleText ) . not . toContain ( "fakePassword2" ) ;
305
+ } ) ;
277
306
it ( "should complain with mismatching cics-deploy and CICS plex names" , async ( ) => {
278
- zosmfProfile = { host : "wibble" , user : "fred" } ;
279
- sshProfile = { host : "wibble" , user : "fred" } ;
280
307
cicsProfile = { host : "wibble" , user : "fred" , password : "thisIsntReal" , cicsPlex : "wibble" , regionName : "12345678" } ;
281
308
282
309
await runPushTest ( "__tests__/__resources__/ExampleBundle01" , true ,
@@ -1025,8 +1052,6 @@ describe("BundlePusher01", () => {
1025
1052
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 0 ) ;
1026
1053
} ) ;
1027
1054
it ( "should cope with a NODEJSAPP in the bundle with a CICS profile specified" , async ( ) => {
1028
- zosmfProfile = { host : "wibble" , user : "user" } ;
1029
- sshProfile = { host : "wibble" , user : "user" } ;
1030
1055
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" } ;
1031
1056
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1032
1057
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP" } ] ) ;
@@ -1046,8 +1071,6 @@ describe("BundlePusher01", () => {
1046
1071
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1047
1072
} ) ;
1048
1073
it ( "should query scope even with no NODEJSAPPs" , async ( ) => {
1049
- zosmfProfile = { host : "wibble" , user : "user" } ;
1050
- sshProfile = { host : "wibble" , user : "user" } ;
1051
1074
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" } ;
1052
1075
readSpy = jest . spyOn ( fs , "readFileSync" ) . mockImplementation ( ( data : string ) => {
1053
1076
if ( data . indexOf ( "cics.xml" ) > - 1 ) {
@@ -1090,8 +1113,6 @@ describe("BundlePusher01", () => {
1090
1113
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1091
1114
} ) ;
1092
1115
it ( "should cope with a NODEJSAPP in the bundle with a CICS profile specified and --verbose" , async ( ) => {
1093
- zosmfProfile = { host : "wibble" , user : "user" } ;
1094
- sshProfile = { host : "wibble" , user : "user" } ;
1095
1116
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" } ;
1096
1117
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1097
1118
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP" } ] ) ;
@@ -1121,8 +1142,6 @@ describe("BundlePusher01", () => {
1121
1142
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1122
1143
} ) ;
1123
1144
it ( "should generate diagnostics even if deploy fails" , async ( ) => {
1124
- zosmfProfile = { host : "wibble" , user : "user" } ;
1125
- sshProfile = { host : "wibble" , user : "user" } ;
1126
1145
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" } ;
1127
1146
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1128
1147
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2055I" } ] ) ;
@@ -1180,8 +1199,6 @@ describe("BundlePusher01", () => {
1180
1199
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1181
1200
} ) ;
1182
1201
it ( "should tolerate a Node.js diagnostics generation failure - region" , async ( ) => {
1183
- zosmfProfile = { host : "wibble" , user : "user" } ;
1184
- sshProfile = { host : "wibble" , user : "user" } ;
1185
1202
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1186
1203
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1187
1204
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I http://www.ibm.com/xmlns/prod/cics/bundle/NODEJSAPP" } ] ) ;
@@ -1202,8 +1219,6 @@ describe("BundlePusher01", () => {
1202
1219
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 1 ) ;
1203
1220
} ) ;
1204
1221
it ( "should tolerate a Node.js diagnostics generation failure - nodejsapp" , async ( ) => {
1205
- zosmfProfile = { host : "wibble" , user : "user" } ;
1206
- sshProfile = { host : "wibble" , user : "user" } ;
1207
1222
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1208
1223
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1209
1224
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I" } ] ) ;
@@ -1249,8 +1264,6 @@ describe("BundlePusher01", () => {
1249
1264
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1250
1265
} ) ;
1251
1266
it ( "should tolerate a Node.js diagnostics generation failure - nodejsapp empty" , async ( ) => {
1252
- zosmfProfile = { host : "wibble" , user : "user" } ;
1253
- sshProfile = { host : "wibble" , user : "user" } ;
1254
1267
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1255
1268
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1256
1269
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I" } ] ) ;
@@ -1296,8 +1309,6 @@ describe("BundlePusher01", () => {
1296
1309
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1297
1310
} ) ;
1298
1311
it ( "should generate Node.js diagnostics for 1 enabled NODEJSAPP" , async ( ) => {
1299
- zosmfProfile = { host : "wibble" , user : "user" } ;
1300
- sshProfile = { host : "wibble" , user : "user" } ;
1301
1312
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1302
1313
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1303
1314
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I" } ] ) ;
@@ -1355,8 +1366,6 @@ describe("BundlePusher01", () => {
1355
1366
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1356
1367
} ) ;
1357
1368
it ( "should generate Node.js diagnostics for 1 disabled NODEJSAPP" , async ( ) => {
1358
- zosmfProfile = { host : "wibble" , user : "user" } ;
1359
- sshProfile = { host : "wibble" , user : "user" } ;
1360
1369
cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1361
1370
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1362
1371
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I" } ] ) ;
@@ -1414,11 +1423,9 @@ describe("BundlePusher01", () => {
1414
1423
expect ( cmciSpy ) . toHaveBeenCalledTimes ( 2 ) ;
1415
1424
} ) ;
1416
1425
it ( "should generate Node.js diagnostics for 2 NODEJSAPPs" , async ( ) => {
1417
- zosmfProfile = { host : "wibble" , user : "user" } ;
1418
- sshProfile = { host : "wibble" , user : "user" } ;
1419
- cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1420
1426
submitSpy = jest . spyOn ( SubmitJobs , "submitJclString" ) . mockImplementation ( ( ) =>
1421
1427
[ { ddName : "SYSTSPRT" , stepName : "DFHDPLOY" , data : "DFHRL2012I" } ] ) ;
1428
+ cicsProfile = { host : "wibble" , user : "user" , password : "thisIsntReal" , cicsPlex : "12345678" , regionName : "12345678" } ;
1422
1429
readSpy = jest . spyOn ( fs , "readFileSync" ) . mockImplementation ( ( data : string ) => {
1423
1430
if ( data . indexOf ( "cics.xml" ) > - 1 ) {
1424
1431
return "<manifest xmlns=\"http://www.ibm.com/xmlns/prod/cics/bundle\">" +
0 commit comments