step4_controller_test.js 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238
  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. App = require('app');
  19. require('controllers/main/service/reassign/step4_controller');
  20. describe('App.ReassignMasterWizardStep4Controller', function () {
  21. var controller = App.ReassignMasterWizardStep4Controller.create({
  22. content: Em.Object.create({
  23. reassign: Em.Object.create(),
  24. reassignHosts: Em.Object.create()
  25. })
  26. });
  27. beforeEach(function () {
  28. sinon.stub(App.ajax, 'send', Em.K);
  29. });
  30. afterEach(function () {
  31. App.ajax.send.restore();
  32. });
  33. describe('#setAdditionalConfigs()', function () {
  34. it('Component is absent', function () {
  35. controller.set('additionalConfigsMap', []);
  36. var configs = {};
  37. expect(controller.setAdditionalConfigs(configs, 'COMP1', '')).to.be.false;
  38. expect(configs).to.eql({});
  39. });
  40. it('configs for Hadoop 2 is present', function () {
  41. controller.set('additionalConfigsMap', [
  42. {
  43. componentName: 'COMP1',
  44. configs: {
  45. 'test-site': {
  46. 'property1': '<replace-value>:1111'
  47. }
  48. },
  49. configs_Hadoop2: {
  50. 'test-site': {
  51. 'property2': '<replace-value>:2222'
  52. }
  53. }
  54. }
  55. ]);
  56. var configs = {
  57. 'test-site': {}
  58. };
  59. expect(controller.setAdditionalConfigs(configs, 'COMP1', 'host1')).to.be.true;
  60. expect(configs).to.eql({
  61. 'test-site': {
  62. 'property2': 'host1:2222'
  63. }
  64. });
  65. });
  66. });
  67. describe('#getHostComponentsNames()', function () {
  68. it('No host-components', function () {
  69. controller.set('hostComponents', []);
  70. expect(controller.getHostComponentsNames()).to.be.empty;
  71. });
  72. it('one host-components', function () {
  73. controller.set('hostComponents', ['COMP1']);
  74. expect(controller.getHostComponentsNames()).to.equal('Comp1');
  75. });
  76. it('ZKFC host-components', function () {
  77. controller.set('hostComponents', ['COMP1', 'ZKFC']);
  78. expect(controller.getHostComponentsNames()).to.equal('Comp1+ZKFC');
  79. });
  80. });
  81. describe('#testDBConnection', function() {
  82. beforeEach(function() {
  83. controller.set('requiredProperties', Em.A([]));
  84. controller.set('content.serviceProperties', Em.Object.create({'javax.jdo.option.ConnectionDriverName': 'mysql'}));
  85. controller.set('content.reassign.component_name', 'HIVE_SERVER');
  86. sinon.stub(controller, 'getConnectionProperty', Em.K);
  87. sinon.stub(App.router, 'get', Em.K);
  88. });
  89. afterEach(function() {
  90. controller.getConnectionProperty.restore();
  91. App.router.get.restore();
  92. });
  93. it('tests database connection', function() {
  94. sinon.stub(controller, 'prepareDBCheckAction', Em.K);
  95. controller.testDBConnection();
  96. expect(controller.prepareDBCheckAction.calledOnce).to.be.true;
  97. controller.prepareDBCheckAction.restore();
  98. });
  99. it('tests prepareDBCheckAction', function() {
  100. controller.prepareDBCheckAction();
  101. expect(App.ajax.send.calledOnce).to.be.true;
  102. });
  103. });
  104. describe('#removeUnneededTasks()', function () {
  105. var isHaEnabled = false;
  106. beforeEach(function () {
  107. sinon.stub(App, 'get', function () {
  108. return isHaEnabled;
  109. });
  110. controller.set('tasks', [
  111. {id: 1, command: 'stopServices'},
  112. {id: 2, command: 'cleanMySqlServer'},
  113. {id: 3, command: 'createHostComponents'},
  114. {id: 4, command: 'putHostComponentsInMaintenanceMode'},
  115. {id: 5, command: 'reconfigure'},
  116. {id: 6, command: 'installHostComponents'},
  117. {id: 7, command: 'startZooKeeperServers'},
  118. {id: 8, command: 'startNameNode'},
  119. {id: 9, command: 'deleteHostComponents'},
  120. {id: 10, command: 'configureMySqlServer'},
  121. {id: 11, command: 'startMySqlServer'},
  122. {id: 12, command: 'startServices'}
  123. ]);
  124. });
  125. afterEach(function () {
  126. App.get.restore();
  127. });
  128. it('hasManualSteps is false', function () {
  129. controller.set('content.hasManualSteps', false);
  130. controller.removeUnneededTasks();
  131. expect(controller.get('tasks').mapProperty('id')).to.eql([1,3,4,5,6,9,12]);
  132. });
  133. it('reassign component is not NameNode and HA disabled', function () {
  134. controller.set('content.hasManualSteps', true);
  135. controller.set('content.reassign.component_name', 'COMP1');
  136. isHaEnabled = false;
  137. console.log(controller.get('tasks').mapProperty('id'))
  138. controller.removeUnneededTasks();
  139. console.log(controller.get('tasks').mapProperty('id'))
  140. expect(controller.get('tasks').mapProperty('id')).to.eql([1, 3, 4, 5, 6]);
  141. });
  142. it('reassign component is not NameNode and HA enabled', function () {
  143. controller.set('content.hasManualSteps', true);
  144. controller.set('content.reassign.component_name', 'COMP1');
  145. isHaEnabled = true;
  146. controller.removeUnneededTasks();
  147. expect(controller.get('tasks').mapProperty('id')).to.eql([1, 3, 4, 5, 6]);
  148. });
  149. it('reassign component is NameNode and HA disabled', function () {
  150. controller.set('content.hasManualSteps', true);
  151. controller.set('content.reassign.component_name', 'NAMENODE');
  152. isHaEnabled = false;
  153. controller.removeUnneededTasks();
  154. expect(controller.get('tasks').mapProperty('id')).to.eql([1, 3, 4, 5, 6]);
  155. });
  156. it('reassign component is NameNode and HA enabled', function () {
  157. controller.set('content.hasManualSteps', true);
  158. controller.set('content.reassign.component_name', 'NAMENODE');
  159. isHaEnabled = true;
  160. controller.removeUnneededTasks();
  161. expect(controller.get('tasks').mapProperty('id')).to.eql([1, 3, 4, 5, 6, 7, 8]);
  162. });
  163. it('reassign component is HiveServer and db type is mysql', function () {
  164. controller.set('content.hasManualSteps', false);
  165. controller.set('content.databaseType', 'mysql');
  166. controller.set('content.reassign.component_name', 'HIVE_SERVER');
  167. isHaEnabled = false;
  168. controller.removeUnneededTasks();
  169. expect(controller.get('tasks').mapProperty('id')).to.eql([1, 2, 3, 4, 5, 6, 9, 10, 11, 12]);
  170. });
  171. it('reassign component is HiveServer and db type is not mysql', function () {
  172. controller.set('content.hasManualSteps', false);
  173. controller.set('content.databaseType', 'derby');
  174. controller.set('content.reassign.component_name', 'HIVE_SERVER');
  175. isHaEnabled = false;
  176. controller.removeUnneededTasks();
  177. expect(controller.get('tasks').mapProperty('id')).to.eql([1, 3, 4, 5, 6, 9, 12]);
  178. });
  179. it('reassign component is Oozie Server and db type is derby', function () {
  180. controller.set('content.hasManualSteps', true);
  181. controller.set('content.databaseType', 'derby');
  182. controller.set('content.reassign.component_name', 'OOZIE_SERVER');
  183. isHaEnabled = false;
  184. controller.removeUnneededTasks();
  185. expect(controller.get('tasks').mapProperty('id')).to.eql([1,3,4,5,6]);
  186. });
  187. it('reassign component is Oozie Server and db type is mysql', function () {
  188. controller.set('content.hasManualSteps', false);
  189. controller.set('content.databaseType', 'mysql');
  190. controller.set('content.reassign.component_name', 'OOZIE_SERVER');
  191. isHaEnabled = false;
  192. controller.removeUnneededTasks();
  193. expect(controller.get('tasks').mapProperty('id')).to.eql([1,2,3,4,5,6,9,10,11,12]);
  194. });
  195. });
  196. describe('#initializeTasks()', function () {
  197. beforeEach(function () {
  198. controller.set('tasks', []);
  199. sinon.stub(controller, 'getHostComponentsNames', Em.K);
  200. sinon.stub(controller, 'removeUnneededTasks', Em.K);
  201. });
  202. afterEach(function () {
  203. controller.removeUnneededTasks.restore();
  204. controller.getHostComponentsNames.restore();
  205. });
  206. it('No commands', function () {
  207. controller.set('commands', []);
  208. controller.set('commandsForDB', []);
  209. controller.initializeTasks();
  210. expect(controller.get('tasks')).to.be.empty;
  211. });
  212. it('One command', function () {
  213. controller.set('commands', ['COMMAND1']);
  214. controller.set('commandsForDB', ['COMMAND1']);
  215. controller.initializeTasks();
  216. expect(controller.get('tasks')[0].get('id')).to.equal(0);
  217. expect(controller.get('tasks')[0].get('command')).to.equal('COMMAND1');
  218. });
  219. });
  220. describe('#hideRollbackButton()', function () {
  221. it('No showRollback command', function () {
  222. controller.set('tasks', [Em.Object.create({
  223. showRollback: false
  224. })]);
  225. controller.hideRollbackButton();
  226. expect(controller.get('tasks')[0].get('showRollback')).to.be.false;
  227. });
  228. it('showRollback command is present', function () {
  229. controller.set('tasks', [Em.Object.create({
  230. showRollback: true
  231. })]);
  232. controller.hideRollbackButton();
  233. expect(controller.get('tasks')[0].get('showRollback')).to.be.false;
  234. });
  235. });
  236. describe('#onComponentsTasksSuccess()', function () {
  237. beforeEach(function () {
  238. sinon.stub(controller, 'onTaskCompleted', Em.K);
  239. });
  240. afterEach(function () {
  241. controller.onTaskCompleted.restore();
  242. });
  243. it('No host-components', function () {
  244. controller.set('multiTaskCounter', 0);
  245. controller.set('hostComponents', []);
  246. controller.onComponentsTasksSuccess();
  247. expect(controller.get('multiTaskCounter')).to.equal(1);
  248. expect(controller.onTaskCompleted.calledOnce).to.be.true;
  249. });
  250. it('One host-component', function () {
  251. controller.set('multiTaskCounter', 0);
  252. controller.set('hostComponents', [
  253. {}
  254. ]);
  255. controller.onComponentsTasksSuccess();
  256. expect(controller.get('multiTaskCounter')).to.equal(1);
  257. expect(controller.onTaskCompleted.calledOnce).to.be.true;
  258. });
  259. it('two host-components', function () {
  260. controller.set('multiTaskCounter', 0);
  261. controller.set('hostComponents', [
  262. {},
  263. {}
  264. ]);
  265. controller.onComponentsTasksSuccess();
  266. expect(controller.get('multiTaskCounter')).to.equal(1);
  267. expect(controller.onTaskCompleted.called).to.be.false;
  268. });
  269. });
  270. describe('#getStopServicesData()', function () {
  271. it('restarting YARN component', function () {
  272. controller.set('content.reassign.component_name', 'RESOURCEMANAGER');
  273. sinon.stub(App.Service, 'find', function () {
  274. return [
  275. {
  276. serviceName: 'HDFS'
  277. },
  278. {
  279. serviceName: 'SERVICE1'
  280. }
  281. ];
  282. });
  283. expect(controller.getStopServicesData()).to.eql({
  284. "ServiceInfo": {
  285. "state": "INSTALLED"
  286. },
  287. "context": "Stop required services",
  288. "urlParams": "ServiceInfo/service_name.in(SERVICE1)"
  289. });
  290. App.Service.find.restore();
  291. });
  292. it('restarting non-YARN component', function () {
  293. controller.set('content.reassign.component_name', 'NAMENODE');
  294. expect(controller.getStopServicesData()).to.eql({
  295. "ServiceInfo": {
  296. "state": "INSTALLED"
  297. },
  298. "context": "Stop all services"
  299. });
  300. });
  301. });
  302. describe('#stopServices()', function () {
  303. it('', function () {
  304. sinon.stub(controller, 'getStopServicesData', Em.K);
  305. controller.stopServices();
  306. expect(App.ajax.send.calledOnce).to.be.true;
  307. expect(controller.getStopServicesData.calledOnce).to.be.true;
  308. controller.getStopServicesData.restore();
  309. });
  310. });
  311. describe('#createHostComponents()', function () {
  312. beforeEach(function () {
  313. sinon.stub(controller, 'createComponent', Em.K);
  314. });
  315. afterEach(function () {
  316. controller.createComponent.restore();
  317. });
  318. it('No host-components', function () {
  319. controller.set('hostComponents', []);
  320. controller.createHostComponents();
  321. expect(controller.get('multiTaskCounter')).to.equal(0);
  322. expect(controller.createComponent.called).to.be.false;
  323. });
  324. it('One host-component', function () {
  325. controller.set('hostComponents', ['COMP1']);
  326. controller.set('content.reassignHosts.target', 'host1');
  327. controller.set('content.reassign.service_id', 'SERVICE1');
  328. controller.createHostComponents();
  329. expect(controller.get('multiTaskCounter')).to.equal(0);
  330. expect(controller.createComponent.calledWith('COMP1', 'host1', 'SERVICE1')).to.be.true;
  331. });
  332. });
  333. describe('#onCreateComponent()', function () {
  334. it('', function () {
  335. sinon.stub(controller, 'onComponentsTasksSuccess', Em.K);
  336. controller.onCreateComponent();
  337. expect(controller.onComponentsTasksSuccess.calledOnce).to.be.true;
  338. controller.onComponentsTasksSuccess.restore();
  339. });
  340. });
  341. describe('#putHostComponentsInMaintenanceMode()', function () {
  342. beforeEach(function(){
  343. sinon.stub(controller, 'onComponentsTasksSuccess', Em.K);
  344. controller.set('content.reassignHosts.source', 'source');
  345. });
  346. afterEach(function(){
  347. controller.onComponentsTasksSuccess.restore();
  348. });
  349. it('No host-components', function () {
  350. controller.set('hostComponents', []);
  351. controller.putHostComponentsInMaintenanceMode();
  352. expect(App.ajax.send.called).to.be.false;
  353. expect(controller.get('multiTaskCounter')).to.equal(0);
  354. });
  355. it('One host-components', function () {
  356. controller.set('hostComponents', [{}]);
  357. controller.putHostComponentsInMaintenanceMode();
  358. expect(App.ajax.send.calledOnce).to.be.true;
  359. expect(controller.get('multiTaskCounter')).to.equal(0);
  360. });
  361. });
  362. describe('#installHostComponents()', function () {
  363. beforeEach(function () {
  364. sinon.stub(controller, 'updateComponent', Em.K);
  365. });
  366. afterEach(function () {
  367. controller.updateComponent.restore();
  368. });
  369. it('No host-components', function () {
  370. controller.set('hostComponents', []);
  371. controller.installHostComponents();
  372. expect(controller.get('multiTaskCounter')).to.equal(0);
  373. expect(controller.updateComponent.called).to.be.false;
  374. });
  375. it('One host-component', function () {
  376. controller.set('hostComponents', ['COMP1']);
  377. controller.set('content.reassignHosts.target', 'host1');
  378. controller.set('content.reassign.service_id', 'SERVICE1');
  379. controller.installHostComponents();
  380. expect(controller.get('multiTaskCounter')).to.equal(0);
  381. expect(controller.updateComponent.calledWith('COMP1', 'host1', 'SERVICE1', 'Install', 1)).to.be.true;
  382. });
  383. });
  384. describe('#reconfigure()', function () {
  385. it('', function () {
  386. sinon.stub(controller, 'loadConfigsTags', Em.K);
  387. controller.reconfigure();
  388. expect(controller.loadConfigsTags.calledOnce).to.be.true;
  389. controller.loadConfigsTags.restore();
  390. });
  391. });
  392. describe('#loadConfigsTags()', function () {
  393. it('', function () {
  394. controller.loadConfigsTags();
  395. expect(App.ajax.send.calledOnce).to.be.true;
  396. });
  397. });
  398. describe('#getConfigUrlParams()', function () {
  399. var testCases = [
  400. {
  401. componentName: 'NAMENODE',
  402. result: [
  403. "(type=hdfs-site&tag=1)",
  404. "(type=core-site&tag=2)"
  405. ]
  406. },
  407. {
  408. componentName: 'SECONDARY_NAMENODE',
  409. result: [
  410. "(type=hdfs-site&tag=1)",
  411. "(type=core-site&tag=2)"
  412. ]
  413. },
  414. {
  415. componentName: 'JOBTRACKER',
  416. result: [
  417. "(type=mapred-site&tag=4)"
  418. ]
  419. },
  420. {
  421. componentName: 'RESOURCEMANAGER',
  422. result: [
  423. "(type=yarn-site&tag=5)"
  424. ]
  425. },
  426. {
  427. componentName: 'APP_TIMELINE_SERVER',
  428. result: [
  429. "(type=yarn-site&tag=5)",
  430. "(type=yarn-env&tag=8)",
  431. ]
  432. },
  433. {
  434. componentName: 'OOZIE_SERVER',
  435. result: [
  436. "(type=oozie-site&tag=6)",
  437. "(type=core-site&tag=2)"
  438. ]
  439. },
  440. {
  441. componentName: 'WEBHCAT_SERVER',
  442. result: [
  443. "(type=webhcat-site&tag=7)"
  444. ]
  445. }
  446. ];
  447. var data = {
  448. Clusters: {
  449. desired_configs: {
  450. 'hdfs-site': {tag: 1},
  451. 'core-site': {tag: 2},
  452. 'hbase-site': {tag: 3},
  453. 'mapred-site': {tag: 4},
  454. 'yarn-site': {tag: 5},
  455. 'oozie-site': {tag: 6},
  456. 'webhcat-site': {tag: 7},
  457. 'yarn-env': {tag: 8}
  458. }
  459. }
  460. };
  461. var services = [];
  462. beforeEach(function () {
  463. sinon.stub(App.Service, 'find', function () {
  464. return services;
  465. })
  466. });
  467. afterEach(function () {
  468. App.Service.find.restore();
  469. });
  470. testCases.forEach(function (test) {
  471. it('get config of ' + test.componentName, function () {
  472. expect(controller.getConfigUrlParams(test.componentName, data)).to.eql(test.result);
  473. })
  474. });
  475. it('get config of NAMENODE when HBASE installed', function () {
  476. services = [
  477. {
  478. serviceName: 'HBASE'
  479. }
  480. ];
  481. expect(controller.getConfigUrlParams('NAMENODE', data)).to.eql([
  482. "(type=hdfs-site&tag=1)",
  483. "(type=core-site&tag=2)",
  484. "(type=hbase-site&tag=3)"
  485. ]);
  486. })
  487. });
  488. describe('#onLoadConfigsTags()', function () {
  489. it('', function () {
  490. sinon.stub(controller, 'getConfigUrlParams', function () {
  491. return [];
  492. });
  493. controller.set('content.reassign.component_name', 'COMP1');
  494. controller.onLoadConfigsTags({});
  495. expect(App.ajax.send.calledOnce).to.be.true;
  496. expect(controller.getConfigUrlParams.calledWith('COMP1', {})).to.be.true;
  497. controller.getConfigUrlParams.restore();
  498. });
  499. });
  500. describe('#onLoadConfigs()', function () {
  501. beforeEach(function () {
  502. sinon.stub(controller, 'setAdditionalConfigs', Em.K);
  503. sinon.stub(controller, 'setSecureConfigs', Em.K);
  504. sinon.stub(controller, 'setSpecificNamenodeConfigs', Em.K);
  505. sinon.stub(controller, 'setSpecificResourceMangerConfigs', Em.K);
  506. sinon.stub(controller, 'getComponentDir', Em.K);
  507. sinon.stub(controller, 'saveClusterStatus', Em.K);
  508. sinon.stub(controller, 'saveConfigsToServer', Em.K);
  509. sinon.stub(controller, 'saveServiceProperties', Em.K);
  510. controller.set('content.reassignHosts.target', 'host1');
  511. });
  512. afterEach(function () {
  513. controller.setAdditionalConfigs.restore();
  514. controller.setSecureConfigs.restore();
  515. controller.setSpecificNamenodeConfigs.restore();
  516. controller.setSpecificResourceMangerConfigs.restore();
  517. controller.getComponentDir.restore();
  518. controller.saveClusterStatus.restore();
  519. controller.saveConfigsToServer.restore();
  520. controller.saveServiceProperties.restore();
  521. });
  522. it('component is not NAMENODE', function () {
  523. controller.set('content.reassign.component_name', 'COMP1');
  524. controller.onLoadConfigs({items: []});
  525. expect(controller.setAdditionalConfigs.calledWith({}, 'COMP1', 'host1')).to.be.true;
  526. expect(controller.setSecureConfigs.calledWith([], {}, 'COMP1')).to.be.true;
  527. expect(controller.setSpecificNamenodeConfigs.called).to.be.false;
  528. expect(controller.getComponentDir.calledWith({}, 'COMP1')).to.be.true;
  529. expect(controller.saveClusterStatus.calledWith([])).to.be.true;
  530. expect(controller.saveConfigsToServer.calledWith({})).to.be.true;
  531. expect(controller.saveServiceProperties.calledWith({})).to.be.true;
  532. });
  533. it('component is NAMENODE, has configs', function () {
  534. controller.set('content.reassign.component_name', 'NAMENODE');
  535. controller.onLoadConfigs({items: [
  536. {
  537. type: 'hdfs-site',
  538. properties: {}
  539. }
  540. ]});
  541. expect(controller.setAdditionalConfigs.calledWith({'hdfs-site': {}}, 'NAMENODE', 'host1')).to.be.true;
  542. expect(controller.setSecureConfigs.calledWith([], {'hdfs-site': {}}, 'NAMENODE')).to.be.true;
  543. expect(controller.setSpecificNamenodeConfigs.calledWith({'hdfs-site': {}}, 'host1')).to.be.true;
  544. expect(controller.getComponentDir.calledWith({'hdfs-site': {}}, 'NAMENODE')).to.be.true;
  545. expect(controller.saveClusterStatus.calledWith([])).to.be.true;
  546. expect(controller.saveConfigsToServer.calledWith({'hdfs-site': {}})).to.be.true;
  547. expect(controller.saveServiceProperties.calledWith({'hdfs-site': {}})).to.be.true;
  548. });
  549. it('component is RESOURCEMANAGER, has configs', function () {
  550. controller.set('content.reassign.component_name', 'RESOURCEMANAGER');
  551. controller.onLoadConfigs({items: [
  552. {
  553. type: 'hdfs-site',
  554. properties: {}
  555. }
  556. ]});
  557. expect(controller.setAdditionalConfigs.calledWith({'hdfs-site': {}}, 'RESOURCEMANAGER', 'host1')).to.be.true;
  558. expect(controller.setSecureConfigs.calledWith([], {'hdfs-site': {}}, 'RESOURCEMANAGER')).to.be.true;
  559. expect(controller.setSpecificResourceMangerConfigs.calledWith({'hdfs-site': {}}, 'host1')).to.be.true;
  560. expect(controller.getComponentDir.calledWith({'hdfs-site': {}}, 'RESOURCEMANAGER')).to.be.true;
  561. expect(controller.saveClusterStatus.calledWith([])).to.be.true;
  562. expect(controller.saveConfigsToServer.calledWith({'hdfs-site': {}})).to.be.true;
  563. expect(controller.saveServiceProperties.calledWith({'hdfs-site': {}})).to.be.true;
  564. });
  565. });
  566. describe('#loadStep()', function () {
  567. var isHaEnabled = true;
  568. beforeEach(function () {
  569. controller.set('content.reassign.service_id', 'service1');
  570. sinon.stub(controller, 'onTaskStatusChange', Em.K);
  571. sinon.stub(controller, 'initializeTasks', Em.K);
  572. sinon.stub(App, 'get', function () {
  573. return isHaEnabled;
  574. });
  575. });
  576. afterEach(function () {
  577. controller.onTaskStatusChange.restore();
  578. controller.initializeTasks.restore();
  579. App.get.restore();
  580. });
  581. it('reassign component is NameNode and HA enabled', function () {
  582. isHaEnabled = true;
  583. controller.set('content.reassign.component_name', 'NAMENODE');
  584. controller.loadStep();
  585. expect(controller.get('hostComponents')).to.eql(['NAMENODE', 'ZKFC']);
  586. expect(controller.get('serviceName')).to.eql(['service1']);
  587. });
  588. it('reassign component is NameNode and HA disabled', function () {
  589. isHaEnabled = false;
  590. controller.set('content.reassign.component_name', 'NAMENODE');
  591. controller.loadStep();
  592. expect(controller.get('hostComponents')).to.eql(['NAMENODE']);
  593. expect(controller.get('serviceName')).to.eql(['service1']);
  594. });
  595. it('reassign component is JOBTRACKER and HA enabled', function () {
  596. isHaEnabled = true;
  597. controller.set('content.reassign.component_name', 'JOBTRACKER');
  598. controller.loadStep();
  599. expect(controller.get('hostComponents')).to.eql(['JOBTRACKER']);
  600. expect(controller.get('serviceName')).to.eql(['service1']);
  601. });
  602. it('reassign component is RESOURCEMANAGER and HA enabled', function () {
  603. isHaEnabled = true;
  604. controller.set('content.reassign.component_name', 'RESOURCEMANAGER');
  605. controller.loadStep();
  606. expect(controller.get('hostComponents')).to.eql(['RESOURCEMANAGER']);
  607. expect(controller.get('serviceName')).to.eql(['service1']);
  608. });
  609. });
  610. describe('#saveConfigsToServer()', function () {
  611. beforeEach(function () {
  612. sinon.stub(controller, 'getServiceConfigData', Em.K);
  613. });
  614. afterEach(function () {
  615. controller.getServiceConfigData.restore();
  616. });
  617. it('', function () {
  618. controller.saveConfigsToServer([1]);
  619. expect(controller.getServiceConfigData.calledWith([1])).to.be.true;
  620. expect(App.ajax.send.calledOnce).to.be.true;
  621. });
  622. });
  623. describe('#setSpecificNamenodeConfigs()', function () {
  624. var isHaEnabled = false;
  625. var service = Em.Object.create();
  626. beforeEach(function () {
  627. sinon.stub(App, 'get', function () {
  628. return isHaEnabled;
  629. });
  630. sinon.stub(App.Service, 'find', function () {
  631. return service;
  632. });
  633. controller.set('content.reassignHosts.source', 'host1');
  634. });
  635. afterEach(function () {
  636. App.get.restore();
  637. App.Service.find.restore();
  638. });
  639. it('HA isn\'t enabled and no HBASE or ACCUMULO service', function () {
  640. isHaEnabled = false;
  641. var configs = {};
  642. controller.setSpecificNamenodeConfigs(configs, 'host1');
  643. expect(configs).to.eql({});
  644. });
  645. it('HA isn\'t enabled and HBASE and ACCUMULO service', function () {
  646. isHaEnabled = false;
  647. service = Em.Object.create({
  648. isLoaded: true
  649. });
  650. var configs = {
  651. 'hbase-site': {
  652. 'hbase.rootdir': 'hdfs://localhost:8020/apps/hbase/data'
  653. },
  654. 'accumulo-site': {
  655. 'instance.volumes': 'hdfs://localhost:8020/apps/accumulo/data'
  656. }
  657. };
  658. controller.setSpecificNamenodeConfigs(configs, 'host1');
  659. expect(configs['hbase-site']['hbase.rootdir']).to.equal('hdfs://host1:8020/apps/hbase/data');
  660. expect(configs['accumulo-site']['instance.volumes']).to.equal('hdfs://host1:8020/apps/accumulo/data');
  661. });
  662. it('HA enabled and namenode 1', function () {
  663. isHaEnabled = true;
  664. var configs = {
  665. 'hdfs-site': {
  666. 'dfs.nameservices': 's',
  667. 'dfs.namenode.http-address.s.nn1': 'host1:50070',
  668. 'dfs.namenode.https-address.s.nn1': '',
  669. 'dfs.namenode.rpc-address.s.nn1': ''
  670. }
  671. };
  672. controller.setSpecificNamenodeConfigs(configs, 'host2');
  673. expect(configs['hdfs-site']).to.eql({
  674. "dfs.nameservices": "s",
  675. "dfs.namenode.http-address.s.nn1": "host2:50070",
  676. "dfs.namenode.https-address.s.nn1": "host2:50470",
  677. "dfs.namenode.rpc-address.s.nn1": "host2:8020"
  678. });
  679. });
  680. it('HA enabled and namenode 2', function () {
  681. isHaEnabled = true;
  682. var configs = {
  683. 'hdfs-site': {
  684. 'dfs.nameservices': 's',
  685. 'dfs.namenode.http-address.s.nn2': 'host2:50070',
  686. 'dfs.namenode.https-address.s.nn2': '',
  687. 'dfs.namenode.rpc-address.s.nn2': ''
  688. }
  689. };
  690. controller.setSpecificNamenodeConfigs(configs, 'host1');
  691. expect(configs['hdfs-site']).to.eql({
  692. "dfs.nameservices": "s",
  693. "dfs.namenode.http-address.s.nn2": "host1:50070",
  694. "dfs.namenode.https-address.s.nn2": "host1:50470",
  695. "dfs.namenode.rpc-address.s.nn2": "host1:8020"
  696. });
  697. });
  698. });
  699. describe('#setSpecificResourceMangerConfigs()', function () {
  700. var isRMHaEnabled = false;
  701. var service = Em.Object.create();
  702. beforeEach(function () {
  703. sinon.stub(App, 'get', function () {
  704. return isRMHaEnabled;
  705. });
  706. controller.set('content.reassignHosts.source', 'host1');
  707. });
  708. afterEach(function () {
  709. App.get.restore();
  710. });
  711. it('HA isn\'t enabled', function () {
  712. isRMHaEnabled = false;
  713. var configs = {};
  714. controller.setSpecificResourceMangerConfigs(configs, 'host1');
  715. expect(configs).to.eql({});
  716. });
  717. it('HA enabled and resource manager 1', function () {
  718. isRMHaEnabled = true;
  719. var configs = {
  720. 'yarn-site': {
  721. 'yarn.resourcemanager.hostname.rm1': 'host1'
  722. }
  723. };
  724. controller.setSpecificResourceMangerConfigs(configs, 'host2');
  725. expect(configs['yarn-site']).to.eql({
  726. 'yarn.resourcemanager.hostname.rm1': 'host2'
  727. });
  728. });
  729. it('HA enabled and resource manager 2', function () {
  730. isRMHaEnabled = true;
  731. var configs = {
  732. 'yarn-site': {
  733. 'yarn.resourcemanager.hostname.rm2': 'host2'
  734. }
  735. };
  736. controller.setSpecificResourceMangerConfigs(configs, 'host1');
  737. expect(configs['yarn-site']).to.eql({
  738. 'yarn.resourcemanager.hostname.rm2': 'host1'
  739. });
  740. });
  741. });
  742. describe('#setSecureConfigs()', function () {
  743. it('undefined component and security disabled', function () {
  744. var secureConfigs = [];
  745. controller.set('content.securityEnabled', false);
  746. controller.set('secureConfigsMap', []);
  747. expect(controller.setSecureConfigs(secureConfigs, {}, 'COMP1')).to.be.false;
  748. expect(secureConfigs).to.eql([]);
  749. });
  750. it('undefined component and security enabled', function () {
  751. var secureConfigs = [];
  752. controller.set('content.securityEnabled', true);
  753. controller.set('secureConfigsMap', []);
  754. expect(controller.setSecureConfigs(secureConfigs, {}, 'COMP1')).to.be.false;
  755. expect(secureConfigs).to.eql([]);
  756. });
  757. it('component exist and security disabled', function () {
  758. var secureConfigs = [];
  759. controller.set('content.securityEnabled', false);
  760. controller.set('secureConfigsMap', [{
  761. componentName: 'COMP1'
  762. }]);
  763. expect(controller.setSecureConfigs(secureConfigs, {}, 'COMP1')).to.be.false;
  764. expect(secureConfigs).to.eql([]);
  765. });
  766. it('component exist and security enabled', function () {
  767. var secureConfigs = [];
  768. var configs = {'s1': {
  769. 'k1': 'kValue',
  770. 'p1': 'pValue'
  771. }};
  772. controller.set('content.securityEnabled', true);
  773. controller.set('secureConfigsMap', [{
  774. componentName: 'COMP1',
  775. configs: [{
  776. site: 's1',
  777. keytab: 'k1',
  778. principal: 'p1'
  779. }]
  780. }]);
  781. expect(controller.setSecureConfigs(secureConfigs, configs, 'COMP1')).to.be.true;
  782. expect(secureConfigs).to.eql([
  783. {
  784. "keytab": "kValue",
  785. "principal": "pValue"
  786. }
  787. ]);
  788. });
  789. });
  790. describe('#getComponentDir()', function () {
  791. var configs = {
  792. 'hdfs-site': {
  793. 'dfs.name.dir': 'case1',
  794. 'dfs.namenode.name.dir': 'case2',
  795. 'dfs.namenode.checkpoint.dir': 'case3'
  796. },
  797. 'core-site': {
  798. 'fs.checkpoint.dir': 'case4'
  799. }
  800. };
  801. it('unknown component name', function () {
  802. expect(controller.getComponentDir(configs, 'COMP1')).to.be.empty;
  803. });
  804. it('NAMENODE component', function () {
  805. expect(controller.getComponentDir(configs, 'NAMENODE')).to.equal('case2');
  806. });
  807. it('SECONDARY_NAMENODE component', function () {
  808. expect(controller.getComponentDir(configs, 'SECONDARY_NAMENODE')).to.equal('case3');
  809. });
  810. });
  811. describe('#saveClusterStatus()', function () {
  812. var mock = {
  813. saveComponentDir: Em.K,
  814. saveSecureConfigs: Em.K
  815. };
  816. beforeEach(function () {
  817. sinon.stub(App.clusterStatus, 'setClusterStatus', Em.K);
  818. sinon.stub(App.router, 'get', function() {
  819. return mock;
  820. });
  821. sinon.spy(mock, 'saveComponentDir');
  822. sinon.spy(mock, 'saveSecureConfigs');
  823. });
  824. afterEach(function () {
  825. App.clusterStatus.setClusterStatus.restore();
  826. App.router.get.restore();
  827. mock.saveSecureConfigs.restore();
  828. mock.saveComponentDir.restore();
  829. });
  830. it('componentDir undefined and secureConfigs is empty', function () {
  831. expect(controller.saveClusterStatus([], null)).to.be.false;
  832. });
  833. it('componentDir defined and secureConfigs is empty', function () {
  834. expect(controller.saveClusterStatus([], 'dir1')).to.be.true;
  835. expect(mock.saveComponentDir.calledWith('dir1')).to.be.true;
  836. expect(mock.saveSecureConfigs.calledWith([])).to.be.true;
  837. });
  838. it('componentDir undefined and secureConfigs has data', function () {
  839. expect(controller.saveClusterStatus([1], null)).to.be.true;
  840. expect(mock.saveComponentDir.calledWith(null)).to.be.true;
  841. expect(mock.saveSecureConfigs.calledWith([1])).to.be.true;
  842. });
  843. it('componentDir defined and secureConfigs has data', function () {
  844. expect(controller.saveClusterStatus([1], 'dir1')).to.be.true;
  845. expect(mock.saveComponentDir.calledWith('dir1')).to.be.true;
  846. expect(mock.saveSecureConfigs.calledWith([1])).to.be.true;
  847. });
  848. });
  849. describe('#onSaveConfigs()', function () {
  850. beforeEach(function () {
  851. sinon.stub(controller, 'onTaskCompleted', Em.K);
  852. });
  853. afterEach(function () {
  854. controller.onTaskCompleted.restore();
  855. });
  856. it('', function () {
  857. controller.onSaveConfigs();
  858. expect(controller.onTaskCompleted.calledOnce).to.be.true;
  859. });
  860. });
  861. describe('#startZooKeeperServers()', function () {
  862. beforeEach(function () {
  863. sinon.stub(controller, 'updateComponent', Em.K);
  864. });
  865. afterEach(function () {
  866. controller.updateComponent.restore();
  867. });
  868. it('', function () {
  869. controller.set('content.masterComponentHosts', [{
  870. component: 'ZOOKEEPER_SERVER',
  871. hostName: 'host1'
  872. }]);
  873. controller.startZooKeeperServers();
  874. expect(controller.updateComponent.calledWith('ZOOKEEPER_SERVER', ['host1'], 'ZOOKEEPER', 'Start')).to.be.true;
  875. });
  876. });
  877. describe('#startNameNode()', function () {
  878. beforeEach(function () {
  879. sinon.stub(controller, 'updateComponent', Em.K);
  880. });
  881. afterEach(function () {
  882. controller.updateComponent.restore();
  883. });
  884. it('reassign host does not match current', function () {
  885. controller.set('content.masterComponentHosts', [{
  886. component: 'NAMENODE',
  887. hostName: 'host1'
  888. }]);
  889. controller.set('content.reassignHosts.source', 'host2');
  890. controller.startNameNode();
  891. expect(controller.updateComponent.calledWith('NAMENODE', ['host1'], 'HDFS', 'Start')).to.be.true;
  892. });
  893. it('reassign host matches current', function () {
  894. controller.set('content.masterComponentHosts', [{
  895. component: 'NAMENODE',
  896. hostName: 'host1'
  897. }]);
  898. controller.set('content.reassignHosts.source', 'host1');
  899. controller.startNameNode();
  900. expect(controller.updateComponent.calledWith('NAMENODE', [], 'HDFS', 'Start')).to.be.true;
  901. });
  902. });
  903. describe('#startServices()', function () {
  904. beforeEach(function () {
  905. sinon.stub(controller, 'getStartServicesData', Em.K);
  906. });
  907. afterEach(function () {
  908. controller.getStartServicesData.restore();
  909. });
  910. it('', function () {
  911. controller.startServices();
  912. expect(controller.getStartServicesData.calledOnce).to.be.true;
  913. expect(App.ajax.send.calledOnce).to.be.true;
  914. });
  915. });
  916. describe('#getStartServicesData()', function () {
  917. beforeEach(function () {
  918. sinon.stub(App.Service, 'find', function () {
  919. return [
  920. {serviceName: 'SERVICE1'},
  921. {serviceName: 'SERVICE2'}
  922. ]
  923. })
  924. });
  925. afterEach(function () {
  926. App.Service.find.restore();
  927. });
  928. it('No unrelated services', function () {
  929. controller.set('unrelatedServicesMap', {
  930. 'COMP1': ['SERVICE1']
  931. });
  932. controller.set('content.reassign.component_name', 'COMP2');
  933. expect(controller.getStartServicesData()).to.eql({
  934. "context": "Start all services",
  935. "ServiceInfo": {
  936. "state": "STARTED"
  937. },
  938. "urlParams": "params/run_smoke_test=true"
  939. });
  940. });
  941. it('Present unrelated services', function () {
  942. controller.set('unrelatedServicesMap', {
  943. 'COMP1': ['SERVICE1']
  944. });
  945. controller.set('content.reassign.component_name', 'COMP1');
  946. expect(controller.getStartServicesData()).to.eql({
  947. "context": "Start required services",
  948. "ServiceInfo": {
  949. "state": "STARTED"
  950. },
  951. "urlParams": "ServiceInfo/service_name.in(SERVICE2)"
  952. });
  953. });
  954. });
  955. describe('#deleteHostComponents()', function () {
  956. it('No host components', function () {
  957. controller.set('hostComponents', []);
  958. controller.set('content.reassignHosts.source', 'host1');
  959. controller.deleteHostComponents();
  960. expect(App.ajax.send.called).to.be.false;
  961. });
  962. it('delete two components', function () {
  963. controller.set('hostComponents', [1, 2]);
  964. controller.set('content.reassignHosts.source', 'host1');
  965. controller.deleteHostComponents();
  966. expect(App.ajax.send.getCall(0).args[0].data).to.eql({
  967. "hostName": "host1",
  968. "componentName": 1
  969. });
  970. expect(App.ajax.send.getCall(1).args[0].data).to.eql({
  971. "hostName": "host1",
  972. "componentName": 2
  973. });
  974. });
  975. });
  976. describe('#onDeleteHostComponentsError()', function () {
  977. beforeEach(function () {
  978. sinon.stub(controller, 'onComponentsTasksSuccess', Em.K);
  979. sinon.stub(controller, 'onTaskError', Em.K);
  980. });
  981. afterEach(function () {
  982. controller.onComponentsTasksSuccess.restore();
  983. controller.onTaskError.restore();
  984. });
  985. it('task success', function () {
  986. var error = {
  987. responseText: 'org.apache.ambari.server.controller.spi.NoSuchResourceException'
  988. }
  989. controller.onDeleteHostComponentsError(error);
  990. expect(controller.onComponentsTasksSuccess.calledOnce).to.be.true;
  991. });
  992. it('unknown error', function () {
  993. var error = {
  994. responseText: ''
  995. }
  996. controller.onDeleteHostComponentsError(error);
  997. expect(controller.onTaskError.calledOnce).to.be.true;
  998. });
  999. });
  1000. describe('#done()', function () {
  1001. beforeEach(function () {
  1002. sinon.stub(controller, 'removeObserver', Em.K);
  1003. sinon.stub(App.router, 'send', Em.K);
  1004. });
  1005. afterEach(function () {
  1006. controller.removeObserver.restore();
  1007. App.router.send.restore();
  1008. });
  1009. it('submit disabled', function () {
  1010. controller.set('isSubmitDisabled', true);
  1011. controller.done();
  1012. expect(App.router.send.called).to.be.false;
  1013. });
  1014. it('submit enabled and does not have manual steps', function () {
  1015. controller.set('isSubmitDisabled', false);
  1016. controller.set('content.hasManualSteps', false);
  1017. controller.done();
  1018. expect(controller.removeObserver.calledWith('tasks.@each.status', controller, 'onTaskStatusChange')).to.be.true;
  1019. expect(App.router.send.calledWith('complete')).to.be.true;
  1020. });
  1021. it('submit enabled and has manual steps', function () {
  1022. controller.set('isSubmitDisabled', false);
  1023. controller.set('content.hasManualSteps', true);
  1024. controller.done();
  1025. expect(controller.removeObserver.calledWith('tasks.@each.status', controller, 'onTaskStatusChange')).to.be.true;
  1026. expect(App.router.send.calledWith('next')).to.be.true;
  1027. });
  1028. });
  1029. describe('#getServiceConfigData()', function () {
  1030. var services = [];
  1031. var stackServices = [];
  1032. beforeEach(function () {
  1033. sinon.stub(App.Service, 'find', function () {
  1034. return services;
  1035. });
  1036. sinon.stub(App.StackService, 'find', function () {
  1037. return stackServices;
  1038. });
  1039. });
  1040. afterEach(function () {
  1041. App.Service.find.restore();
  1042. App.StackService.find.restore();
  1043. });
  1044. it('No services', function () {
  1045. services = [];
  1046. controller.set('content.reassign.component_name', 'COMP1');
  1047. expect(controller.getServiceConfigData([])).to.eql([]);
  1048. });
  1049. it('No services in stackServices', function () {
  1050. services = [Em.Object.create({serviceName: 'S1'})];
  1051. stackServices = [];
  1052. controller.set('content.reassign.component_name', 'COMP1');
  1053. expect(controller.getServiceConfigData([])).to.eql([]);
  1054. });
  1055. it('Services in stackServicesm but configTypesRendered is empty', function () {
  1056. services = [Em.Object.create({serviceName: 'S1'})];
  1057. stackServices = [Em.Object.create({
  1058. serviceName: 'S1',
  1059. configTypesRendered: {}
  1060. })];
  1061. controller.set('content.reassign.component_name', 'COMP1');
  1062. expect(controller.getServiceConfigData([])[0]).to.equal("{\"Clusters\":{\"desired_config\":[]}}");
  1063. });
  1064. it('Services in stackServicesm and configTypesRendered has data, but configs is empty', function () {
  1065. services = [Em.Object.create({serviceName: 'S1'})];
  1066. stackServices = [
  1067. Em.Object.create({
  1068. serviceName: 'S1',
  1069. configTypesRendered: {'type1': {}}
  1070. })
  1071. ];
  1072. controller.set('content.reassign.component_name', 'COMP1');
  1073. expect(controller.getServiceConfigData([])[0]).to.equal("{\"Clusters\":{\"desired_config\":[]}}");
  1074. });
  1075. it('Services in stackServicesm and configTypesRendered has data, and configs present', function () {
  1076. services = [Em.Object.create({serviceName: 'S1'})];
  1077. stackServices = [
  1078. Em.Object.create({
  1079. serviceName: 'S1',
  1080. configTypesRendered: {'type1': {}}
  1081. })
  1082. ];
  1083. var configs = {
  1084. 'type1': {
  1085. 'prop1': 'value1'
  1086. }
  1087. };
  1088. controller.set('content.reassign.component_name', 'COMP1');
  1089. expect(JSON.parse(controller.getServiceConfigData(configs)[0]).Clusters.desired_config.length).to.equal(1);
  1090. });
  1091. });
  1092. describe('#testsMySqlServer()', function () {
  1093. beforeEach(function() {
  1094. sinon.stub(App.HostComponent, 'find', function() {
  1095. return Em.A([
  1096. Em.Object.create({
  1097. 'componentName': 'MYSQL_SERVER',
  1098. 'hostName': 'c6401.ambari.apache.org'
  1099. })
  1100. ]);
  1101. });
  1102. });
  1103. afterEach(function() {
  1104. App.HostComponent.find.restore();
  1105. });
  1106. it('Cleans MySql Server', function () {
  1107. controller.cleanMySqlServer();
  1108. expect(App.ajax.send.calledOnce).to.be.true;
  1109. });
  1110. it('Configures MySql Server', function () {
  1111. controller.configureMySqlServer();
  1112. expect(App.ajax.send.calledOnce).to.be.true;
  1113. });
  1114. });
  1115. });