installer_test.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 App = require('app');
  19. require('models/cluster');
  20. require('controllers/wizard');
  21. require('controllers/installer');
  22. describe('App.InstallerController', function () {
  23. var installerController = App.InstallerController.create();
  24. describe('#loadStacksVersionsSuccessCallback', function() {
  25. beforeEach(function () {
  26. sinon.stub(App.store, 'commit', Em.K);
  27. });
  28. afterEach(function () {
  29. App.store.commit.restore();
  30. });
  31. it ('Correct data', function() {
  32. installerController.loadStacksVersionsSuccessCallback(require('test/stack'));
  33. expect(installerController.get('content.stacks.length')).to.equal(2);
  34. expect(installerController.get('content.stacks').everyProperty('isSelected')).to.equal(false);
  35. expect(installerController.get('content.stacks').mapProperty('id')).to.eql(['HDP-2.1','HDP-1.3']);
  36. });
  37. });
  38. describe('#getServerVersionSuccessCallback', function () {
  39. var cases = [
  40. {
  41. osType: 'redhat5',
  42. expected: false
  43. },
  44. {
  45. osType: 'redhat6',
  46. expected: true
  47. },
  48. {
  49. osType: 'suse11',
  50. expected: false
  51. }
  52. ],
  53. title = 'App.isManagedMySQLForHiveEnabled should be {0} for {1}';
  54. cases.forEach(function (item) {
  55. it(title.format(item.expected, item.osType), function () {
  56. installerController.getServerVersionSuccessCallback({
  57. 'RootServiceComponents': {
  58. 'component_version': '',
  59. 'properties': {
  60. 'server.os_type': item.osType
  61. }
  62. }
  63. });
  64. expect(App.get('isManagedMySQLForHiveEnabled')).to.equal(item.expected);
  65. });
  66. });
  67. });
  68. });