Repository: ambari Updated Branches: refs/heads/branch-2.5 3eb3dd340 -> ef0486611
Revert "AMBARI-19165. Ambari-web unit tests cannot be run in Mac OS Sierra. (jaimin)" This reverts commit 3eb3dd34060a5a900136ecdd85ea2a1cc164f4ef. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ef048661 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ef048661 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ef048661 Branch: refs/heads/branch-2.5 Commit: ef0486611c584cbea1817eb78ea1fb61cf891052 Parents: 3eb3dd3 Author: Jaimin Jetly <[email protected]> Authored: Mon Dec 12 17:28:12 2016 -0800 Committer: Jaimin Jetly <[email protected]> Committed: Mon Dec 12 17:28:12 2016 -0800 ---------------------------------------------------------------------- ambari-web/app/assets/test/test.html | 1 - ambari-web/package.json | 15 ++++++------- .../hawq/addStandby/step3_controller_test.js | 3 +-- .../test/controllers/wizard/step9_test.js | 5 ++--- .../utils/configs/config_initializer_test.js | 19 ++++++++++++++++ ambari-web/test/utils/date/date_test.js | 18 +++++++-------- ambari-web/test/utils/date/timezone_test.js | 2 +- .../widgets/slider_config_widget_view_test.js | 23 ++++++++++++++++++++ 8 files changed, 62 insertions(+), 24 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ef048661/ambari-web/app/assets/test/test.html ---------------------------------------------------------------------- diff --git a/ambari-web/app/assets/test/test.html b/ambari-web/app/assets/test/test.html index 7b01f57..d8ee080 100644 --- a/ambari-web/app/assets/test/test.html +++ b/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; http://git-wip-us.apache.org/repos/asf/ambari/blob/ef048661/ambari-web/package.json ---------------------------------------------------------------------- diff --git a/ambari-web/package.json b/ambari-web/package.json index ea84abf..ad0bce4 100644 --- a/ambari-web/package.json +++ b/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" http://git-wip-us.apache.org/repos/asf/ambari/blob/ef048661/ambari-web/test/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller_test.js index 2180248..bd6a67a 100644 --- a/ambari-web/test/controllers/main/admin/highAvailability/hawq/addStandby/step3_controller_test.js +++ b/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); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/ef048661/ambari-web/test/controllers/wizard/step9_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step9_test.js b/ambari-web/test/controllers/wizard/step9_test.js index 71b4915..b0c4c20 100644 --- a/ambari-web/test/controllers/wizard/step9_test.js +++ b/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, http://git-wip-us.apache.org/repos/asf/ambari/blob/ef048661/ambari-web/test/utils/configs/config_initializer_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/configs/config_initializer_test.js b/ambari-web/test/utils/configs/config_initializer_test.js index ceed065..d348055 100644 --- a/ambari-web/test/utils/configs/config_initializer_test.js +++ b/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; + }); + }); + }); + }); http://git-wip-us.apache.org/repos/asf/ambari/blob/ef048661/ambari-web/test/utils/date/date_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/date/date_test.js b/ambari-web/test/utils/date/date_test.js index c82a02e..3d61c90 100644 --- a/ambari-web/test/utils/date/date_test.js +++ b/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); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/ef048661/ambari-web/test/utils/date/timezone_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/date/timezone_test.js b/ambari-web/test/utils/date/timezone_test.js index 37a8c8c..da89586 100644 --- a/ambari-web/test/utils/date/timezone_test.js +++ b/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 () { http://git-wip-us.apache.org/repos/asf/ambari/blob/ef048661/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js index 5cc055c..a6b25ce 100644 --- a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js +++ b/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 () {
