step9_test.js 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var Ember = require('ember');
  19. var App = require('app');
  20. require('models/stack_service_component');
  21. require('models/hosts');
  22. require('controllers/wizard/step9_controller');
  23. require('utils/helper');
  24. describe('App.InstallerStep9Controller', function () {
  25. describe('#isSubmitDisabled', function () {
  26. var tests = Em.A([
  27. {controllerName: 'addHostController', state: 'STARTED', e: false},
  28. {controllerName: 'addHostController', state: 'START FAILED', e: false},
  29. {controllerName: 'addHostController', state: 'INSTALL FAILED', e: false},
  30. {controllerName: 'addHostController', state: 'PENDING', e: true},
  31. {controllerName: 'addHostController', state: 'INSTALLED', e: true},
  32. {controllerName: 'addServiceController', state: 'STARTED', e: false},
  33. {controllerName: 'addServiceController', state: 'START FAILED', e: false},
  34. {controllerName: 'addServiceController', state: 'INSTALL FAILED', e: false},
  35. {controllerName: 'addServiceController', state: 'PENDING', e: true},
  36. {controllerName: 'addServiceController', state: 'INSTALLED', e: true},
  37. {controllerName: 'installerController', state: 'STARTED', e: false},
  38. {controllerName: 'installerController', state: 'START FAILED', e: false},
  39. {controllerName: 'installerController', state: 'INSTALL FAILED', e: true},
  40. {controllerName: 'installerController', state: 'INSTALLED', e: true},
  41. {controllerName: 'installerController', state: 'PENDING', e: true}
  42. ]);
  43. tests.forEach(function (test) {
  44. var controller = App.WizardStep9Controller.create({
  45. content: {
  46. controllerName: test.controllerName,
  47. cluster: {
  48. status: test.state
  49. }
  50. }
  51. });
  52. it('controllerName is ' + test.controllerName + '; cluster status is ' + test.state + '; isSubmitDisabled should be ' + test.e, function () {
  53. expect(controller.get('isSubmitDisabled')).to.equal(test.e);
  54. });
  55. });
  56. });
  57. describe('#status', function () {
  58. var tests = Em.A([
  59. {
  60. hosts: [
  61. {status: 'failed'},
  62. {status: 'success'}
  63. ],
  64. isStepFailed: false,
  65. progress: '100',
  66. m: 'One host is failed',
  67. e: 'failed'
  68. },
  69. {
  70. hosts: [
  71. {status: 'warning'},
  72. {status: 'success'}
  73. ],
  74. m: 'One host is failed and step is not failed',
  75. isStepFailed: false,
  76. progress: '100',
  77. e: 'warning'
  78. },
  79. {
  80. hosts: [
  81. {status: 'warning'},
  82. {status: 'success'}
  83. ],
  84. m: 'One host is failed and step is failed',
  85. isStepFailed: true,
  86. progress: '100',
  87. e: 'failed'
  88. },
  89. {
  90. hosts: [
  91. {status: 'success'},
  92. {status: 'success'}
  93. ],
  94. m: 'All hosts are success and progress is 100',
  95. isStepFailed: false,
  96. progress: '100',
  97. e: 'success'
  98. },
  99. {
  100. hosts: [
  101. {status: 'success'},
  102. {status: 'success'}
  103. ],
  104. m: 'All hosts are success and progress is 50',
  105. isStepFailed: false,
  106. progress: '50',
  107. e: 'info'
  108. }
  109. ]);
  110. tests.forEach(function (test) {
  111. var controller = App.WizardStep9Controller.create({hosts: test.hosts, isStepFailed: function () {
  112. return test.isStepFailed
  113. }, progress: test.progress});
  114. controller.updateStatus();
  115. it(test.m, function () {
  116. expect(controller.get('status')).to.equal(test.e);
  117. });
  118. });
  119. });
  120. describe('#showRetry', function () {
  121. it('cluster status is not INSTALL FAILED', function () {
  122. var controller = App.WizardStep9Controller.create({content: {cluster: {status: 'INSTALLED'}}});
  123. expect(controller.get('showRetry')).to.equal(false);
  124. });
  125. it('cluster status is INSTALL FAILED', function () {
  126. var controller = App.WizardStep9Controller.create({content: {cluster: {status: 'INSTALL FAILED'}}});
  127. expect(controller.get('showRetry')).to.equal(true);
  128. });
  129. });
  130. describe('#resetHostsForRetry', function () {
  131. var hosts = {'host1': Em.Object.create({status: 'failed', message: 'Failed'}), 'host2': Em.Object.create({status: 'success', message: 'Success'})};
  132. var controller = App.WizardStep9Controller.create({content: {hosts: hosts}});
  133. it('All should have status "pending" and message "Waiting"', function () {
  134. controller.resetHostsForRetry();
  135. for (var name in hosts) {
  136. if (hosts.hasOwnProperty(name)) {
  137. expect(controller.get('content.hosts')[name].get('status', 'pending')).to.equal('pending');
  138. expect(controller.get('content.hosts')[name].get('message', 'Waiting')).to.equal('Waiting');
  139. }
  140. }
  141. });
  142. });
  143. var hosts_for_load_and_render = {
  144. 'host1': {
  145. message: 'message1',
  146. status: 'unknown',
  147. progress: '1',
  148. logTasks: [
  149. {},
  150. {}
  151. ],
  152. bootStatus: 'REGISTERED'
  153. },
  154. 'host2': {
  155. message: '',
  156. status: 'failed',
  157. progress: '1',
  158. logTasks: [
  159. {},
  160. {}
  161. ],
  162. bootStatus: ''
  163. },
  164. 'host3': {
  165. message: '',
  166. status: 'waiting',
  167. progress: null,
  168. logTasks: [
  169. {},
  170. {}
  171. ],
  172. bootStatus: ''
  173. },
  174. 'host4': {
  175. message: 'message4',
  176. status: null,
  177. progress: '10',
  178. logTasks: [
  179. {}
  180. ],
  181. bootStatus: 'REGISTERED'
  182. }
  183. };
  184. describe('#loadHosts', function () {
  185. var controller = App.WizardStep9Controller.create({content: {hosts: hosts_for_load_and_render}});
  186. controller.loadHosts();
  187. var loaded_hosts = controller.get('hosts');
  188. it('Only REGISTERED hosts', function () {
  189. expect(loaded_hosts.length).to.equal(2);
  190. });
  191. it('All hosts have progress 0', function () {
  192. expect(loaded_hosts.everyProperty('progress', 0)).to.equal(true);
  193. });
  194. it('All hosts have progress 0', function () {
  195. expect(loaded_hosts.everyProperty('progress', 0)).to.equal(true);
  196. });
  197. it('All host don\'t have logTasks', function () {
  198. expect(loaded_hosts.everyProperty('logTasks.length', 0)).to.equal(true);
  199. });
  200. });
  201. describe('#hostHasClientsOnly', function () {
  202. var tests = Em.A([
  203. {
  204. hosts: [
  205. Em.Object.create({
  206. hostName: 'host1',
  207. logTasks: [
  208. {Tasks: {role: 'HDFS_CLIENT'}},
  209. {Tasks: {role: 'DATANODE'}}
  210. ],
  211. status: 'old_status',
  212. progress: '10',
  213. e: {status: 'old_status', progress: '10'}
  214. }),
  215. Em.Object.create({
  216. hostName: 'host2',
  217. logTasks: [
  218. {Tasks: {role: 'HDFS_CLIENT'}}
  219. ],
  220. status: 'old_status',
  221. progress: '10',
  222. e: {status: 'success', progress: '100'}
  223. })
  224. ],
  225. jsonError: false
  226. },
  227. {
  228. hosts: [
  229. Em.Object.create({
  230. hostName: 'host1',
  231. logTasks: [
  232. {Tasks: {role: 'HDFS_CLIENT'}},
  233. {Tasks: {role: 'DATANODE'}}
  234. ],
  235. status: 'old_status',
  236. progress: '10',
  237. e: {status: 'success', progress: '100'}
  238. }),
  239. Em.Object.create({
  240. hostName: 'host2',
  241. logTasks: [
  242. {Tasks: {role: 'HDFS_CLIENT'}}
  243. ],
  244. status: 'old_status',
  245. progress: '10',
  246. e: {status: 'success', progress: '100'}
  247. })
  248. ],
  249. jsonError: true
  250. }
  251. ]);
  252. tests.forEach(function (test) {
  253. it('', function () {
  254. var controller = App.WizardStep9Controller.create({hosts: test.hosts});
  255. controller.hostHasClientsOnly(test.jsonError);
  256. test.hosts.forEach(function (host) {
  257. expect(controller.get('hosts').findProperty('hostName', host.hostName).get('status')).to.equal(host.e.status);
  258. expect(controller.get('hosts').findProperty('hostName', host.hostName).get('progress')).to.equal(host.e.progress);
  259. });
  260. });
  261. });
  262. });
  263. describe('#onSuccessPerHost', function () {
  264. var tests = Em.A([
  265. {
  266. cluster: {status: 'INSTALLED'},
  267. host: Em.Object.create({status: 'pending'}),
  268. actions: [],
  269. e: {status: 'success'},
  270. m: 'No tasks for host'
  271. },
  272. {
  273. cluster: {status: 'INSTALLED'},
  274. host: Em.Object.create({status: 'info'}),
  275. actions: [
  276. {Tasks: {status: 'COMPLETED'}},
  277. {Tasks: {status: 'COMPLETED'}}
  278. ],
  279. e: {status: 'success'},
  280. m: 'All Tasks COMPLETED and cluster status INSTALLED'
  281. },
  282. {
  283. cluster: {status: 'FAILED'},
  284. host: Em.Object.create({status: 'info'}),
  285. actions: [
  286. {Tasks: {status: 'COMPLETED'}},
  287. {Tasks: {status: 'COMPLETED'}}
  288. ],
  289. e: {status: 'info'},
  290. m: 'All Tasks COMPLETED and cluster status FAILED'
  291. },
  292. {
  293. cluster: {status: 'INSTALLED'},
  294. host: Em.Object.create({status: 'info'}),
  295. actions: [
  296. {Tasks: {status: 'FAILED'}},
  297. {Tasks: {status: 'COMPLETED'}}
  298. ],
  299. e: {status: 'info'},
  300. m: 'Not all Tasks COMPLETED and cluster status INSTALLED'
  301. },
  302. {
  303. cluster: {status: 'FAILED'},
  304. host: Em.Object.create({status: 'info'}),
  305. actions: [
  306. {Tasks: {status: 'FAILED'}},
  307. {Tasks: {status: 'COMPLETED'}}
  308. ],
  309. e: {status: 'info'},
  310. m: 'Not all Tasks COMPLETED and cluster status FAILED'
  311. }
  312. ]);
  313. tests.forEach(function (test) {
  314. var controller = App.WizardStep9Controller.create({content: {cluster: {status: test.cluster.status}}});
  315. controller.onSuccessPerHost(test.actions, test.host);
  316. it(test.m, function () {
  317. expect(test.host.status).to.equal(test.e.status);
  318. });
  319. });
  320. });
  321. describe('#onErrorPerHost', function () {
  322. var tests = Em.A([
  323. {
  324. cluster: {status: 'INSTALLED'},
  325. host: Em.Object.create({status: 'pending'}),
  326. actions: [],
  327. e: {status: 'pending'},
  328. isMasterFailed: false,
  329. m: 'No tasks for host'
  330. },
  331. {
  332. cluster: {status: 'INSTALLED'},
  333. host: Em.Object.create({status: 'info'}),
  334. actions: [
  335. {Tasks: {status: 'FAILED'}},
  336. {Tasks: {status: 'COMPLETED'}}
  337. ],
  338. e: {status: 'warning'},
  339. isMasterFailed: false,
  340. m: 'One Task FAILED and cluster status INSTALLED'
  341. },
  342. {
  343. cluster: {status: 'INSTALLED'},
  344. host: Em.Object.create({status: 'info'}),
  345. actions: [
  346. {Tasks: {status: 'ABORTED'}},
  347. {Tasks: {status: 'COMPLETED'}}
  348. ],
  349. e: {status: 'warning'},
  350. isMasterFailed: false,
  351. m: 'One Task ABORTED and cluster status INSTALLED'
  352. },
  353. {
  354. cluster: {status: 'INSTALLED'},
  355. host: Em.Object.create({status: 'info'}),
  356. actions: [
  357. {Tasks: {status: 'TIMEDOUT'}},
  358. {Tasks: {status: 'COMPLETED'}}
  359. ],
  360. e: {status: 'warning'},
  361. isMasterFailed: false,
  362. m: 'One Task TIMEDOUT and cluster status INSTALLED'
  363. },
  364. {
  365. cluster: {status: 'PENDING'},
  366. host: Em.Object.create({status: 'info'}),
  367. actions: [
  368. {Tasks: {status: 'FAILED'}},
  369. {Tasks: {status: 'COMPLETED'}}
  370. ],
  371. e: {status: 'failed'},
  372. isMasterFailed: true,
  373. m: 'One Task FAILED and cluster status PENDING isMasterFailed true'
  374. },
  375. {
  376. cluster: {status: 'PENDING'},
  377. host: Em.Object.create({status: 'info'}),
  378. actions: [
  379. {Tasks: {status: 'COMPLETED'}},
  380. {Tasks: {status: 'COMPLETED'}}
  381. ],
  382. e: {status: 'info'},
  383. isMasterFailed: false,
  384. m: 'One Task FAILED and cluster status PENDING isMasterFailed false'
  385. }
  386. ]);
  387. tests.forEach(function (test) {
  388. var controller = App.WizardStep9Controller.create({content: {cluster: {status: test.cluster.status}}, isMasterFailed: function () {
  389. return test.isMasterFailed;
  390. }});
  391. controller.onErrorPerHost(test.actions, test.host);
  392. it(test.m, function () {
  393. expect(test.host.status).to.equal(test.e.status);
  394. });
  395. });
  396. });
  397. describe('#isMasterFailed', function () {
  398. var tests = Em.A([
  399. {
  400. actions: [
  401. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'DATANODE'}},
  402. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'TASKTRACKER'}},
  403. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'HBASE_REGIONSERVER'}},
  404. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'GANGLIA_MONITOR'}},
  405. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'SUPERVISOR'}}
  406. ],
  407. e: false,
  408. m: 'No one Master is failed'
  409. },
  410. {
  411. actions: [
  412. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'NAMENODE'}},
  413. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'TASKTRACKER'}},
  414. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'HBASE_REGIONSERVER'}},
  415. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'GANGLIA_MONITOR'}},
  416. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'SUPERVISOR'}}
  417. ],
  418. e: true,
  419. m: 'One Master is failed'
  420. },
  421. {
  422. actions: [
  423. {Tasks: {command: 'PENDING', status: 'FAILED', role: 'NAMENODE'}},
  424. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'TASKTRACKER'}},
  425. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'HBASE_REGIONSERVER'}},
  426. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'GANGLIA_MONITOR'}},
  427. {Tasks: {command: 'INSTALL', status: 'FAILED', role: 'SUPERVISOR'}}
  428. ],
  429. e: false,
  430. m: 'one Master is failed but command is not install'
  431. }
  432. ]);
  433. tests.forEach(function (test) {
  434. it(test.m, function () {
  435. var controller = App.WizardStep9Controller.create();
  436. expect(controller.isMasterFailed(test.actions)).to.equal(test.e);
  437. });
  438. });
  439. });
  440. describe('#onInProgressPerHost', function () {
  441. var tests = Em.A([
  442. {
  443. host: Em.Object.create({message: 'default_message'}),
  444. actions: [
  445. {Tasks: {status: 'COMPLETED'}},
  446. {Tasks: {status: 'COMPLETED'}}
  447. ],
  448. e: {message: 'default_message', b: true},
  449. m: 'All Tasks COMPLETED'
  450. },
  451. {
  452. host: Em.Object.create({message: 'default_message'}),
  453. actions: [
  454. {Tasks: {status: 'IN_PROGRESS'}},
  455. {Tasks: {status: 'COMPLETED'}}
  456. ],
  457. e: {message: 'default_message', b: false},
  458. m: 'One Task IN_PROGRESS'
  459. },
  460. {
  461. host: Em.Object.create({message: 'default_message'}),
  462. actions: [
  463. {Tasks: {status: 'QUEUED'}},
  464. {Tasks: {status: 'COMPLETED'}}
  465. ],
  466. e: {message: 'default_message', b: false},
  467. m: 'One Task QUEUED'
  468. },
  469. {
  470. host: Em.Object.create({message: 'default_message'}),
  471. actions: [
  472. {Tasks: {status: 'PENDING'}},
  473. {Tasks: {status: 'COMPLETED'}}
  474. ],
  475. e: {message: 'default_message', b: false},
  476. m: 'One Task PENDING'
  477. }
  478. ]);
  479. tests.forEach(function (test) {
  480. it(test.m, function () {
  481. var controller = App.WizardStep9Controller.create();
  482. controller.onInProgressPerHost(test.actions, test.host);
  483. expect(test.host.message == test.e.message).to.equal(test.e.b);
  484. });
  485. });
  486. });
  487. describe('#progressPerHost', function () {
  488. var tests = Em.A([
  489. {
  490. cluster: {status: 'PENDING'},
  491. host: Em.Object.create({progress: 0}),
  492. actions: [
  493. {Tasks: {status: 'COMPLETED'}},
  494. {Tasks: {status: 'COMPLETED'}},
  495. {Tasks: {status: 'QUEUED'}},
  496. {Tasks: {status: 'QUEUED'}},
  497. {Tasks: {status: 'IN_PROGRESS'}}
  498. ],
  499. e: {ret: 17, host: '17'},
  500. m: 'All types of status available. cluster status PENDING'
  501. },
  502. {
  503. cluster: {status: 'PENDING'},
  504. host: Em.Object.create({progress: 0}),
  505. actions: [],
  506. e: {ret: 33, host: '33'},
  507. m: 'No tasks available. cluster status PENDING'
  508. },
  509. {
  510. cluster: {status: 'INSTALLED'},
  511. host: Em.Object.create({progress: 0}),
  512. actions: [],
  513. e: {ret: 100, host: '100'},
  514. m: 'No tasks available. cluster status INSTALLED'
  515. },
  516. {
  517. cluster: {status: 'INSTALLED'},
  518. host: Em.Object.create({progress: 0}),
  519. actions: [
  520. {Tasks: {status: 'COMPLETED'}},
  521. {Tasks: {status: 'COMPLETED'}},
  522. {Tasks: {status: 'QUEUED'}},
  523. {Tasks: {status: 'QUEUED'}},
  524. {Tasks: {status: 'IN_PROGRESS'}}
  525. ],
  526. e: {ret: 68, host: '68'},
  527. m: 'All types of status available. cluster status INSTALLED'
  528. },
  529. {
  530. cluster: {status: 'FAILED'},
  531. host: Em.Object.create({progress: 0}),
  532. actions: [],
  533. e: {ret: 100, host: '100'},
  534. m: 'Cluster status is not PENDING or INSTALLED'
  535. }
  536. ]);
  537. tests.forEach(function (test) {
  538. it(test.m, function () {
  539. var controller = App.WizardStep9Controller.create({content: {cluster: {status: test.cluster.status}}});
  540. var progress = controller.progressPerHost(test.actions, test.host);
  541. expect(progress).to.equal(test.e.ret);
  542. expect(test.host.progress).to.equal(test.e.host);
  543. });
  544. });
  545. });
  546. describe('#clearStep', function () {
  547. var controller = App.WizardStep9Controller.create({hosts: [
  548. {},
  549. {},
  550. {}
  551. ]});
  552. it('All to default values', function () {
  553. controller.clearStep();
  554. expect(controller.get('hosts.length')).to.equal(0);
  555. expect(controller.get('status')).to.equal('info');
  556. expect(controller.get('progress')).to.equal('0');
  557. expect(controller.get('numPolls')).to.equal(1);
  558. });
  559. });
  560. describe('#replacePolledData', function () {
  561. var controller = App.WizardStep9Controller.create({polledData: [
  562. {},
  563. {},
  564. {}
  565. ]});
  566. var newPolledData = [
  567. {}
  568. ];
  569. controller.replacePolledData(newPolledData);
  570. it('replacing polled data', function () {
  571. expect(controller.get('polledData.length')).to.equal(newPolledData.length);
  572. });
  573. });
  574. describe('#isSuccess', function () {
  575. var tests = Em.A([
  576. {
  577. polledData: [
  578. {Tasks: {status: 'COMPLETED'}},
  579. {Tasks: {status: 'COMPLETED'}}
  580. ],
  581. e: true,
  582. m: 'All tasks are COMPLETED'
  583. },
  584. {
  585. polledData: [
  586. {Tasks: {status: 'COMPLETED'}},
  587. {Tasks: {status: 'FAILED'}}
  588. ],
  589. e: false,
  590. m: 'Not all tasks are COMPLETED'
  591. }
  592. ]);
  593. tests.forEach(function (test) {
  594. it(test.m, function () {
  595. var controller = App.WizardStep9Controller.create();
  596. expect(controller.isSuccess(test.polledData)).to.equal(test.e);
  597. });
  598. });
  599. });
  600. describe('#isStepFailed', function () {
  601. var tests = Em.A([
  602. {
  603. polledData: [
  604. {Tasks: {command: 'INSTALL', role: 'GANGLIA_MONITOR', status: 'TIMEDOUT'}},
  605. {Tasks: {command: 'INSTALL', role: 'GANGLIA_MONITOR', status: 'FAILED'}},
  606. {Tasks: {command: 'INSTALL', role: 'GANGLIA_MONITOR', status: 'PENDING'}}
  607. ],
  608. e: true,
  609. m: 'GANGLIA_MONITOR 2/3 failed'
  610. },
  611. {
  612. polledData: [
  613. {Tasks: {command: 'INSTALL', role: 'GANGLIA_MONITOR', status: 'TIMEDOUT'}},
  614. {Tasks: {command: 'INSTALL', role: 'GANGLIA_MONITOR', status: 'PENDING'}},
  615. {Tasks: {command: 'INSTALL', role: 'GANGLIA_MONITOR', status: 'PENDING'}}
  616. ],
  617. e: false,
  618. m: 'GANGLIA_MONITOR 1/3 failed'
  619. },
  620. {
  621. polledData: [
  622. {Tasks: {command: 'INSTALL', role: 'HBASE_REGIONSERVER', status: 'TIMEDOUT'}},
  623. {Tasks: {command: 'INSTALL', role: 'HBASE_REGIONSERVER', status: 'FAILED'}},
  624. {Tasks: {command: 'INSTALL', role: 'HBASE_REGIONSERVER', status: 'PENDING'}}
  625. ],
  626. e: true,
  627. m: 'HBASE_REGIONSERVER 2/3 failed'
  628. },
  629. {
  630. polledData: [
  631. {Tasks: {command: 'INSTALL', role: 'HBASE_REGIONSERVER', status: 'TIMEDOUT'}},
  632. {Tasks: {command: 'INSTALL', role: 'HBASE_REGIONSERVER', status: 'PENDING'}},
  633. {Tasks: {command: 'INSTALL', role: 'HBASE_REGIONSERVER', status: 'PENDING'}}
  634. ],
  635. e: false,
  636. m: 'HBASE_REGIONSERVER 1/3 failed'
  637. },
  638. {
  639. polledData: [
  640. {Tasks: {command: 'INSTALL', role: 'TASKTRACKER', status: 'TIMEDOUT'}},
  641. {Tasks: {command: 'INSTALL', role: 'TASKTRACKER', status: 'FAILED'}},
  642. {Tasks: {command: 'INSTALL', role: 'TASKTRACKER', status: 'PENDING'}}
  643. ],
  644. e: true,
  645. m: 'TASKTRACKER 2/3 failed'
  646. },
  647. {
  648. polledData: [
  649. {Tasks: {command: 'INSTALL', role: 'TASKTRACKER', status: 'TIMEDOUT'}},
  650. {Tasks: {command: 'INSTALL', role: 'TASKTRACKER', status: 'PENDING'}},
  651. {Tasks: {command: 'INSTALL', role: 'TASKTRACKER', status: 'PENDING'}}
  652. ],
  653. e: false,
  654. m: 'TASKTRACKER 1/3 failed'
  655. },
  656. {
  657. polledData: [
  658. {Tasks: {command: 'INSTALL', role: 'DATANODE', status: 'TIMEDOUT'}},
  659. {Tasks: {command: 'INSTALL', role: 'DATANODE', status: 'FAILED'}},
  660. {Tasks: {command: 'INSTALL', role: 'DATANODE', status: 'PENDING'}}
  661. ],
  662. e: true,
  663. m: 'DATANODE 2/3 failed'
  664. },
  665. {
  666. polledData: [
  667. {Tasks: {command: 'INSTALL', role: 'DATANODE', status: 'TIMEDOUT'}},
  668. {Tasks: {command: 'INSTALL', role: 'DATANODE', status: 'PENDING'}},
  669. {Tasks: {command: 'INSTALL', role: 'DATANODE', status: 'PENDING'}}
  670. ],
  671. e: false,
  672. m: 'DATANODE 1/3 failed'
  673. },
  674. {
  675. polledData: [
  676. {Tasks: {command: 'INSTALL', role: 'NAMENODE', status: 'TIMEDOUT'}},
  677. {Tasks: {command: 'INSTALL', role: 'DATANODE', status: 'PENDING'}},
  678. {Tasks: {command: 'INSTALL', role: 'DATANODE', status: 'PENDING'}}
  679. ],
  680. e: true,
  681. m: 'NAMENODE failed'
  682. },
  683. {
  684. polledData: [
  685. {Tasks: {command: 'INSTALL', role: 'NAMENODE', status: 'PENDING'}},
  686. {Tasks: {command: 'INSTALL', role: 'DATANODE', status: 'PENDING'}},
  687. {Tasks: {command: 'INSTALL', role: 'DATANODE', status: 'PENDING'}}
  688. ],
  689. e: false,
  690. m: 'Nothing failed failed'
  691. }
  692. ]);
  693. tests.forEach(function (test) {
  694. var controller = App.WizardStep9Controller.create({polledData: test.polledData});
  695. it(test.m, function () {
  696. expect(controller.isStepFailed()).to.equal(test.e);
  697. });
  698. });
  699. });
  700. describe('#getUrl', function () {
  701. var clusterName = 'tdk';
  702. var cluster = App.WizardStep9Controller.create({content: {cluster: {name: clusterName, requestId: null}}});
  703. it('check requestId priority', function () {
  704. cluster.set('content.cluster.requestId', 123);
  705. var url = cluster.getUrl(321);
  706. expect(url).to.equal(App.apiPrefix + '/clusters/' + clusterName + '/requests/' + '321' + '?fields=tasks/Tasks/command,tasks/Tasks/exit_code,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true');
  707. url = cluster.getUrl();
  708. expect(url).to.equal(App.apiPrefix + '/clusters/' + clusterName + '/requests/' + '123' + '?fields=tasks/Tasks/command,tasks/Tasks/exit_code,tasks/Tasks/start_time,tasks/Tasks/end_time,tasks/Tasks/host_name,tasks/Tasks/id,tasks/Tasks/role,tasks/Tasks/status&minimal_response=true');
  709. });
  710. });
  711. describe('#finishState', function () {
  712. var statuses = Em.A(['INSTALL FAILED', 'START FAILED', 'STARTED']);
  713. it('Installer is finished', function () {
  714. statuses.forEach(function (status) {
  715. var controller = App.WizardStep9Controller.create({content: {cluster: {status: status}}});
  716. var result = controller.finishState();
  717. expect(result).to.equal(true);
  718. });
  719. });
  720. it('Unknown cluster status ', function () {
  721. var controller = App.WizardStep9Controller.create({content: {cluster: {status: 'FAKE_STATUS'}}});
  722. var result = controller.finishState();
  723. expect(result).to.equal(false);
  724. });
  725. });
  726. describe('#setLogTasksStatePerHost', function () {
  727. var tests = Em.A([
  728. {
  729. tasksPerHost: [
  730. {Tasks: {id: 1, status: 'COMPLETED'}},
  731. {Tasks: {id: 2, status: 'COMPLETED'}}
  732. ],
  733. tasks: [],
  734. e: {m: 'COMPLETED', l: 2},
  735. m: 'host didn\'t have tasks and got 2 new'
  736. },
  737. {
  738. tasksPerHost: [
  739. {Tasks: {id: 1, status: 'COMPLETED'}},
  740. {Tasks: {id: 2, status: 'COMPLETED'}}
  741. ],
  742. tasks: [
  743. {Tasks: {id: 1, status: 'IN_PROGRESS'}},
  744. {Tasks: {id: 2, status: 'IN_PROGRESS'}}
  745. ],
  746. e: {m: 'COMPLETED', l: 2},
  747. m: 'host had 2 tasks and got both updated'
  748. },
  749. {
  750. tasksPerHost: [],
  751. tasks: [
  752. {Tasks: {id: 1, status: 'IN_PROGRESS'}},
  753. {Tasks: {id: 2, status: 'IN_PROGRESS'}}
  754. ],
  755. e: {m: 'IN_PROGRESS', l: 2},
  756. m: 'host had 2 tasks and didn\'t get updates'
  757. },
  758. {
  759. tasksPerHost: [
  760. {Tasks: {id: 1, status: 'COMPLETED'}},
  761. {Tasks: {id: 2, status: 'COMPLETED'}},
  762. {Tasks: {id: 3, status: 'COMPLETED'}}
  763. ],
  764. tasks: [
  765. {Tasks: {id: 1, status: 'IN_PROGRESS'}},
  766. {Tasks: {id: 2, status: 'IN_PROGRESS'}}
  767. ],
  768. e: {m: 'COMPLETED', l: 3},
  769. m: 'host had 2 tasks and got both updated and 1 new'
  770. }
  771. ]);
  772. tests.forEach(function (test) {
  773. it(test.m, function () {
  774. var controller = App.WizardStep9Controller.create({hosts: [Em.Object.create({logTasks: test.tasks})]});
  775. controller.setLogTasksStatePerHost(test.tasksPerHost, controller.get('hosts')[0]);
  776. expect(controller.get('hosts')[0].get('logTasks').everyProperty('Tasks.status', test.e.m)).to.equal(true);
  777. expect(controller.get('hosts')[0].get('logTasks.length')).to.equal(test.e.l);
  778. });
  779. });
  780. });
  781. describe('#parseHostInfo', function () {
  782. var tests = Em.A([
  783. {
  784. cluster: {status: 'PENDING'},
  785. hosts: Em.A([
  786. Em.Object.create({name: 'host1', status: '', message: '', progress: '', logTasks: []}),
  787. Em.Object.create({name: 'host2', status: '', message: '', progress: '', logTasks: []})
  788. ]),
  789. polledData: {
  790. tasks: [
  791. {Tasks: {host_name: 'host2', status: 'COMPLETED'}},
  792. {Tasks: {host_name: 'host2', status: 'COMPLETED'}}
  793. ]
  794. },
  795. e: {
  796. hosts: {
  797. host1: {progress: '33'},
  798. host2: {progress: '33'}
  799. },
  800. progress: '33'
  801. },
  802. m: 'Two hosts. One host without tasks. Second host has all tasks COMPLETED. Cluster status is PENDING'
  803. },
  804. {
  805. cluster: {status: 'PENDING'},
  806. hosts: Em.A([
  807. Em.Object.create({name: 'host1', status: '', message: '', progress: '', logTasks: []}),
  808. Em.Object.create({name: 'host2', status: '', message: '', progress: '', logTasks: []})
  809. ]),
  810. polledData: {
  811. tasks: [
  812. {Tasks: {host_name: 'host1', status: 'IN_PROGRESS'}},
  813. {Tasks: {host_name: 'host2', status: 'IN_PROGRESS'}}
  814. ]
  815. },
  816. e: {hosts: {host1: {progress: '12'}, host2: {progress: '12'}}, progress: '12'},
  817. m: 'Two hosts. Each host has one task IN_PROGRESS. Cluster status is PENDING'
  818. },
  819. {
  820. cluster: {status: 'PENDING'},
  821. hosts: Em.A([
  822. Em.Object.create({name: 'host1', status: '', message: '', progress: '', logTasks: []}),
  823. Em.Object.create({name: 'host2', status: '', message: '', progress: '', logTasks: []})
  824. ]),
  825. polledData: {
  826. tasks: [
  827. {Tasks: {host_name: 'host1', status: 'QUEUED'}},
  828. {Tasks: {host_name: 'host2', status: 'QUEUED'}}
  829. ]
  830. },
  831. e: {
  832. hosts: {
  833. host1: {progress: '3'},
  834. host2: {progress: '3'}
  835. },
  836. progress: '3'
  837. },
  838. m: 'Two hosts. Each host has one task QUEUED. Cluster status is PENDING'
  839. },
  840. {
  841. cluster: {status: 'INSTALLED'},
  842. hosts: Em.A([
  843. Em.Object.create({name: 'host1', status: '', message: '', progress: '', logTasks: []}),
  844. Em.Object.create({name: 'host2', status: '', message: '', progress: '', logTasks: []})
  845. ]),
  846. polledData: {
  847. tasks: [
  848. {Tasks: {host_name: 'host2', status: 'COMPLETED'}},
  849. {Tasks: {host_name: 'host2', status: 'COMPLETED'}}
  850. ]
  851. },
  852. e: {
  853. hosts: {
  854. host1: {progress: '100'},
  855. host2: {progress: '100'}
  856. },
  857. progress: '100'
  858. },
  859. m: 'Two hosts. One host without tasks. Second host has all tasks COMPLETED. Cluster status is INSTALLED'
  860. },
  861. {
  862. cluster: {status: 'INSTALLED'},
  863. hosts: Em.A([
  864. Em.Object.create({name: 'host1', status: '', message: '', progress: '', logTasks: []}),
  865. Em.Object.create({name: 'host2', status: '', message: '', progress: '', logTasks: []})
  866. ]),
  867. polledData: {
  868. tasks: [
  869. {Tasks: {host_name: 'host1', status: 'IN_PROGRESS'}},
  870. {Tasks: {host_name: 'host2', status: 'IN_PROGRESS'}}
  871. ]
  872. },
  873. e: {
  874. hosts: {
  875. host1: {progress: '58'},
  876. host2: {progress: '58'}
  877. },
  878. progress: '58'
  879. },
  880. m: 'Two hosts. Each host has one task IN_PROGRESS. Cluster status is INSTALLED'
  881. },
  882. {
  883. cluster: {status: 'INSTALLED'},
  884. hosts: Em.A([
  885. Em.Object.create({name: 'host1', status: '', message: '', progress: '', logTasks: []}),
  886. Em.Object.create({name: 'host2', status: '', message: '', progress: '', logTasks: []})
  887. ]),
  888. polledData: {
  889. tasks: [
  890. {Tasks: {host_name: 'host1', status: 'QUEUED'}},
  891. {Tasks: {host_name: 'host2', status: 'QUEUED'}}
  892. ]
  893. },
  894. e: {
  895. hosts: {
  896. host1: {progress: '40'},
  897. host2: {progress: '40'}
  898. },
  899. progress: '40'
  900. },
  901. m: 'Two hosts. Each host has one task QUEUED. Cluster status is INSTALLED'
  902. }
  903. ]);
  904. tests.forEach(function (test) {
  905. it(test.m, function () {
  906. var controller = App.WizardStep9Controller.create({hosts: test.hosts, content: {cluster: {status: test.cluster.status}}, finishState: function () {
  907. return false;
  908. }});
  909. var logTasksChangesCounter = controller.get('logTasksChangesCounter');
  910. controller.parseHostInfo(test.polledData);
  911. expect(controller.get('logTasksChangesCounter')).to.equal(logTasksChangesCounter + 1);
  912. for (var name in test.e.hosts) {
  913. if (test.e.hosts.hasOwnProperty(name)) {
  914. expect(controller.get('hosts').findProperty('name', name).get('progress')).to.equal(test.e.hosts[name].progress);
  915. }
  916. }
  917. expect(controller.get('progress')).to.equal(test.e.progress);
  918. });
  919. });
  920. });
  921. describe('#isAllComponentsInstalledSuccessCallback', function () {
  922. describe('', function() {
  923. var hosts = Em.A([
  924. Em.Object.create({name: 'host1', status: 'failed', expectedStatus: 'heartbeat_lost'}),
  925. Em.Object.create({name: 'host2', status: 'info', expectedStatus: 'heartbeat_lost'}),
  926. Em.Object.create({name: 'host3', status: 'warning', expectedStatus: 'warning'}),
  927. Em.Object.create({name: 'host4', status: 'info', expectedStatus: 'info'})
  928. ]);
  929. var heartbeatLostData = {
  930. "items": [
  931. {
  932. "Hosts": {
  933. "cluster_name": "c1",
  934. "host_name": "host1",
  935. "host_state": "HEARTBEAT_LOST"
  936. },
  937. "host_components": [
  938. {
  939. "HostRoles": {
  940. "cluster_name": "c1",
  941. "component_name": "NAMENODE",
  942. "host_name": "host1",
  943. "state": "INSTALL_FAILED"
  944. }
  945. }
  946. ]
  947. },
  948. {
  949. "Hosts": {
  950. "cluster_name": "c1",
  951. "host_name": "host2",
  952. "host_state": "HEARTBEAT_LOST"
  953. },
  954. "host_components": [
  955. {
  956. "HostRoles": {
  957. "cluster_name": "c1",
  958. "component_name": "ZOOKEEPER_SERVER",
  959. "host_name": "host2",
  960. "state": "UNKNOWN"
  961. }
  962. }
  963. ]
  964. },
  965. {
  966. "Hosts": {
  967. "cluster_name": "c1",
  968. "host_name": "host3",
  969. "host_state": "HEALTHY"
  970. },
  971. "host_components": [
  972. {
  973. "HostRoles": {
  974. "cluster_name": "c1",
  975. "component_name": "DATANODE",
  976. "host_name": "host3",
  977. "state": "INSTALL_FAILED"
  978. }
  979. }
  980. ]
  981. },
  982. {
  983. "Hosts": {
  984. "cluster_name": "c1",
  985. "host_name": "host4",
  986. "host_state": "HEALTHY"
  987. },
  988. "host_components": [
  989. {
  990. "HostRoles": {
  991. "cluster_name": "c1",
  992. "component_name": "PIG",
  993. "host_name": "host4",
  994. "state": "INSTALLED"
  995. }
  996. },
  997. {
  998. "HostRoles": {
  999. "cluster_name": "c1",
  1000. "component_name": "DATANODE",
  1001. "host_name": "host3",
  1002. "state": "INSTALLED"
  1003. }
  1004. }
  1005. ]
  1006. }
  1007. ]
  1008. };
  1009. var controller = App.WizardStep9Controller.create({hosts: hosts, content: {controllerName: 'installerController'}});
  1010. App.testMode = true;
  1011. // Action
  1012. controller.isAllComponentsInstalledSuccessCallback(heartbeatLostData);
  1013. // Validation for the status of all hosts.
  1014. controller.get('hosts').forEach(function (test) {
  1015. var status = heartbeatLostData.items.findProperty('Hosts.host_name', test.get('name')).Hosts.host_state;
  1016. it('Host "' + test.get('name') + '"' + ' with status "' + status + '" ', function () {
  1017. expect(test.get('status')).to.equal(test.get('expectedStatus'));
  1018. });
  1019. });
  1020. });
  1021. describe('', function() {
  1022. var noHeartbeatLostData = {
  1023. "items": [
  1024. {
  1025. "Hosts": {
  1026. "cluster_name": "c1",
  1027. "host_name": "host1",
  1028. "host_state": "HEALTHY"
  1029. },
  1030. "host_components": [
  1031. {
  1032. "HostRoles": {
  1033. "cluster_name": "c1",
  1034. "component_name": "NAMENODE",
  1035. "host_name": "host1",
  1036. "state": "INSTALL_FAILED"
  1037. }
  1038. }
  1039. ]
  1040. }
  1041. ]
  1042. };
  1043. var hosts = Em.A([Em.Object.create({name: 'host1', status: 'failed'})]);
  1044. // When there is no heartbeat lost for any host and cluster failed install task, Refreshing the page should not launch start all services request.
  1045. // Below transitions are possibilities in this function
  1046. // PENDING -> INSTALL or PENDING. This transition happens when install all services request is completed successfully.
  1047. // INSTALL FAILED -> INSTALL FAILED. No transition should happen when install all services request fails and then user hits refresh
  1048. // Cluster is not expected to enter this function in other states: INSTALLED, START FAILED, STARTED
  1049. var statuses = Em.A(['INSTALL FAILED', 'INSTALLED','START FAILED', 'STARTED']); // Cluster in any of this states should have no effect on the state from this function
  1050. statuses.forEach(function (priorStatus) {
  1051. var controller = App.WizardStep9Controller.create({hosts: hosts, content: {controllerName: 'installerController', cluster: {status: priorStatus}},togglePreviousSteps: function(){}});
  1052. // Action
  1053. controller.isAllComponentsInstalledSuccessCallback(noHeartbeatLostData);
  1054. // Validation for the cluster state.
  1055. var actualStatus = controller.get('content.cluster.status');
  1056. it('Cluster state before entering the function "' + priorStatus + '"', function () {
  1057. expect(actualStatus).to.equal(priorStatus);
  1058. });
  1059. });
  1060. });
  1061. });
  1062. // isServicesInstalled is called after every poll for "Install All Services" request.
  1063. // This function should result into a call to "Start All Services" request only if install request completed successfully.
  1064. describe('#isServicesInstalled', function () {
  1065. var hostStateJsonData = {
  1066. "items" : [
  1067. {
  1068. "Hosts" : {
  1069. "cluster_name" : "c1",
  1070. "host_name" : "ambari-1.c.apache.internal",
  1071. "host_state" : "HEALTHY"
  1072. },
  1073. "host_components" : [
  1074. {
  1075. "HostRoles" : {
  1076. "cluster_name" : "c1",
  1077. "component_name" : "GANGLIA_MONITOR",
  1078. "host_name" : "ambari-1.c.apache.internal",
  1079. "state" : "STARTED"
  1080. }
  1081. }
  1082. ]
  1083. }
  1084. ]
  1085. };
  1086. var hosts = Em.A([Em.Object.create({name: 'host1', progress: '33', status: 'info'}),
  1087. Em.Object.create({name: 'host2', progress: '33', status: 'info'})]);
  1088. // polledData has all hosts with status completed to trigger transition from install->start request.
  1089. var polledData = Em.A([Em.Object.create({Tasks: {name: 'host1', status: 'COMPLETED'}}),
  1090. Em.Object.create({Tasks: {name: 'host2', status: 'COMPLETED'}})]);
  1091. var controller = App.WizardStep9Controller.create({hosts: hosts, content: {controllerName: 'installerController',
  1092. cluster: {status: 'PENDING',name: 'c1'}},launchStartServices: function() {return true;}});
  1093. var tests = Em.A([
  1094. // controller has "status" value as "info" initially. If no errors are encountered then wizard stages
  1095. // transition info->success, on error info->error, on warning info->warning
  1096. {status: 'info' , e:{startServicesCalled:true}, m:'If no failed tasks then start services request should be called'},
  1097. {status: 'failed', e:{startServicesCalled:false}, m: 'If install request has failed tasks then start services call should not be called'}
  1098. ]);
  1099. beforeEach(function() {
  1100. App.testMode = true;
  1101. sinon.spy(controller, 'launchStartServices');
  1102. sinon.stub($, 'ajax').yieldsTo('success', hostStateJsonData);
  1103. });
  1104. afterEach(function() {
  1105. App.testMode = false;
  1106. controller.launchStartServices.restore();
  1107. $.ajax.restore();
  1108. });
  1109. tests.forEach(function(test){
  1110. it(test.m, function() {
  1111. controller.set('status',test.status);
  1112. //Action
  1113. controller.isServicesInstalled(polledData);
  1114. //Validation
  1115. expect(controller.launchStartServices.called).to.equal(test.e.startServicesCalled);
  1116. });
  1117. });
  1118. });
  1119. // On completion of Start all services error callback function,
  1120. // Cluster Status should be INSTALL FAILED
  1121. // All progress bar on the screen should be finished (100%) with blue color.
  1122. // Retry button should be enabled, next button should be disabled
  1123. describe('#launchStartServicesErrorCallback', function () {
  1124. App.testMode = true;
  1125. // override the actual function
  1126. App.popup = {
  1127. setErrorPopup: function() {
  1128. return true;
  1129. }
  1130. };
  1131. var hosts = Em.A([Em.Object.create({name: 'host1', progress: '33', status: 'info'}),Em.Object.create({name: 'host2', progress: '33', status: 'info'})]);
  1132. var controller = App.WizardStep9Controller.create({hosts: hosts, content: {controllerName: 'installerController', cluster: {status: 'PENDING',name: 'c1'}},togglePreviousSteps: function(){}});
  1133. //Action
  1134. controller.launchStartServicesErrorCallback({status:500, statusTesxt: 'Server Error'});
  1135. it('Cluster Status should be INSTALL FAILED', function () {
  1136. expect(controller.get('content.cluster.status')).to.equal('INSTALL FAILED');
  1137. });
  1138. it('Main progress bar on the screen should be finished (100%) with red color', function () {
  1139. expect(controller.get('progress')).to.equal('100');
  1140. expect(controller.get('status')).to.equal('failed');
  1141. });
  1142. it('All Host progress bars on the screen should be finished (100%) with blue color', function () {
  1143. controller.get('hosts').forEach(function(host){
  1144. expect(host.get('progress')).to.equal('100');
  1145. expect(host.get('status')).to.equal('info');
  1146. });
  1147. });
  1148. it('Next button should be disabled', function () {
  1149. expect(controller.get('isSubmitDisabled')).to.equal(true);
  1150. });
  1151. it('Retry button should be visible', function () {
  1152. expect(controller.get('showRetry')).to.equal(true);
  1153. })
  1154. });
  1155. });