浏览代码

Revert "AMBARI-19165. Ambari-web unit tests cannot be run in Mac OS Sierra. (jaimin)"

This reverts commit 3eb3dd34060a5a900136ecdd85ea2a1cc164f4ef.
Jaimin Jetly 8 年之前
父节点
当前提交
ef0486611c

+ 0 - 1
ambari-web/app/assets/test/test.html

@@ -41,7 +41,6 @@
 <script>
     $.mocho = true;
     $.hostName = 'localhost:3333';
-    window.initMochaPhantomJS && window.initMochaPhantomJS();
     mocha.ui('bdd');
     mocha.reporter('html');
     expect = chai.expect;

+ 7 - 8
ambari-web/package.json

@@ -19,26 +19,25 @@
     "cssstyle": "0.2.3"
   },
   "devDependencies": {
-    "phantomjs": "~2.1.0",
-    "mocha":"2.5.3",
-    "mocha-phantomjs": "~4.1.0",
-    "mocha-phantomjs-core": "~2.1.0",
-    "chai":"3.4.2",
+    "phantomjs": "^1.9.2",
+    "mocha":"1.9.0",
+    "mocha-phantomjs": "~3.1.6",
+    "chai":"~1.9.0",
     "sinon":"=1.7.3",
-    "sinon-chai":"~2.8.0",
+    "sinon-chai":"~2.5.0",
     "express":"2.5.8",
     "karma": ">=0.11.14",
     "karma-mocha": "0.1.1",
     "karma-chai": "~0.1.0",
     "karma-sinon": "~1.0.2",
-    "karma-phantomjs-launcher": "1.0.2",
+    "karma-phantomjs-launcher": "0.1.3",
     "karma-coverage": "~0.2.0",
     "karma-commonjs-require": "~0.0.1",
     "karma-ember-precompile-brunch": "^0.0.1"
   },
   "scripts": {
     "start": "brunch watch --server",
-    "test": "mocha-phantomjs -R min -p ./node_modules/.bin/phantomjs public/test/test.html"
+    "test": "mocha-phantomjs -R min public/test/test.html"
   },
   "engines": {
     "node": "^4.0.0"

+ 1 - 2
ambari-web/test/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller_test.js

@@ -82,7 +82,6 @@ describe('App.AddHawqStandbyWizardStep3Controller', function () {
 
     var cases = [
         {
-          'title': 'should set properties from load config success callback',
           'items': [
             {
               'type': 'hawq-site',
@@ -171,7 +170,7 @@ describe('App.AddHawqStandbyWizardStep3Controller', function () {
             newHawqStandby: 'h1'
           }
         })
-      });
+      })
       controller.setDynamicConfigValues(configs, data);
     });
 

+ 2 - 3
ambari-web/test/controllers/wizard/step9_test.js

@@ -629,7 +629,7 @@ describe('App.InstallerStep9Controller', function () {
       },
       {
         expected: [],
-        message: 'should return server info',
+        text: 'should return server info',
         controllerName: 'addServiceController',
         services: Em.A([
           Em.Object.create({
@@ -646,7 +646,7 @@ describe('App.InstallerStep9Controller', function () {
       },
       {
         expected: [],
-        message: 'should return default data',
+        text: 'should return default data',
         controllerName: 'addHostContro',
         hosts: Em.A([
           Em.Object.create({
@@ -1687,7 +1687,6 @@ describe('App.InstallerStep9Controller', function () {
     });
     Em.A([
         {
-          m: 'Launch start service after install services completed',
           jsonData: {Requests: {id: 2}},
           e: {
             hostHasClientsOnly: false,

+ 19 - 0
ambari-web/test/utils/configs/config_initializer_test.js

@@ -950,4 +950,23 @@ describe('App.ConfigInitializer', function () {
     });
 
   });
+
+  describe('winReplacersMap', function () {
+
+    var winReplacersMap = App.ConfigInitializer.get('winReplacersMap');
+    var winReplacerNames = Em.keys(winReplacersMap).map(function (key) {
+      return winReplacersMap[key];
+    });
+
+    it('should contains only unique methods', function () {
+      expect(winReplacerNames.length).to.equal(winReplacerNames.uniq().length);
+    });
+
+    winReplacerNames.forEach(function (name) {
+      it(name, function () {
+        expect(App.ConfigInitializer[name]).to.be.a.function;
+      });
+    });
+  });
+
 });

+ 9 - 9
ambari-web/test/utils/date/date_test.js

@@ -22,13 +22,13 @@ var date = require('utils/date/date');
 describe('date', function () {
 
   var incorrectTests = Em.A([
-    {m: 'null', t: null},
-    {m: 'empty', t: ''},
-    {m: 'false', t: false},
-    {m:'[]' , t: []},
-    {m: '{}', t: {}},
-    {m: 'undefined', t: undefined},
-    {m: 'empty function', t: function(){}}
+    {t: null},
+    {t: ''},
+    {t: false},
+    {t: []},
+    {t: {}},
+    {t: undefined},
+    {t: function(){}}
   ]);
 
   describe('#dateFormatZeroFirst()', function() {
@@ -88,7 +88,7 @@ describe('date', function () {
 
     describe('Correct data', function(){
       tests.forEach(function(test) {
-        it(test.i, function() {
+        it(test.t, function() {
           expect(date.timingFormat(test.i)).to.equal(test.e);
         });
       });
@@ -96,7 +96,7 @@ describe('date', function () {
 
     describe('Incorrect data', function(){
       incorrectTests.forEach(function(test) {
-        it(test.m, function() {
+        it(test.t, function() {
           expect(date.timingFormat(test.t)).to.equal(null);
         });
       });

+ 1 - 1
ambari-web/test/utils/date/timezone_test.js

@@ -97,7 +97,7 @@ describe('timezoneUtils', function () {
     var result = timezoneUtils.getAllTimezoneNames();
 
     it('timezone names are parsed', function () {
-      expect(result).to.have.length.above(0);
+      expect(this.result).to.have.length.above(0);
     });
 
     describe('Etc/* are excluded', function () {

+ 23 - 0
ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js

@@ -636,6 +636,29 @@ describe('App.SliderConfigWidgetView', function () {
       expect(viewInt.get('issueMessage')).to.equal('');
     });
 
+    describe('llap_queue_capacity property', function() {
+      beforeEach(function() {
+        viewInt.set('config.name', 'llap_queue_capacity');
+      });
+      it('should validate and warn about llap issue when value is 100%', function() {
+        viewInt.set('config.stackConfigProperty.valueAttributes.maximum', 100);
+        viewInt.set('config.value', '100');
+        viewInt.set('config.errorMessage', '');
+        viewInt.set('config.warnMessage', '');
+        viewInt.set('config.widgetType', 'slider');
+        assert.isTrue(viewInt.isValueCompatibleWithWidget(), 'value should be compatible with widget');
+        assert.equal(viewInt.get('config.warnMessage'), Em.I18n.t('config.warnMessage.llap_queue_capacity.max'), 'warn message validation');
+      });
+
+      it('should pass validation because llap < 100', function() {
+        viewInt.set('config.stackConfigProperty.valueAttributes.maximum', 100);
+        viewInt.set('config.value', '99');
+        viewInt.set('config.errorMessage', '');
+        viewInt.set('config.warnMessage', '');
+        assert.isTrue(viewInt.isValueCompatibleWithWidget(), 'value should be compatible with widget');
+        assert.equal(viewInt.get('config.warnMessage'), '', 'warn message validation');
+      });
+    });
   });
 
   describe('#formatTickLabel', function () {