step9_test.js 41 KB

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