Updated Branches: refs/heads/trunk aafadc5d5 -> 6f17e44c0
AMBARI-4171. Fix UI Unit tests. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/6f17e44c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6f17e44c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6f17e44c Branch: refs/heads/trunk Commit: 6f17e44c05f4cdc0462e3c686214251610597cc2 Parents: aafadc5 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Wed Dec 25 15:24:28 2013 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Wed Dec 25 15:24:28 2013 +0200 ---------------------------------------------------------------------- .../main/admin/security/add/step4_test.js | 1 + ambari-web/test/installer/step3_test.js | 88 -------------------- ambari-web/test/installer/step4_test.js | 17 ++-- .../test/views/common/quick_link_view_test.js | 42 +++++----- .../widgets/node_managers_live_test.js | 5 +- 5 files changed, 37 insertions(+), 116 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/6f17e44c/ambari-web/test/controllers/main/admin/security/add/step4_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/security/add/step4_test.js b/ambari-web/test/controllers/main/admin/security/add/step4_test.js index 0096bfb..ecc3316 100644 --- a/ambari-web/test/controllers/main/admin/security/add/step4_test.js +++ b/ambari-web/test/controllers/main/admin/security/add/step4_test.js @@ -18,6 +18,7 @@ var App = require('app'); +require('controllers/main/admin/security/security_progress_controller'); require('controllers/main/admin/security/add/step4'); require('utils/polling'); require('models/cluster_states'); http://git-wip-us.apache.org/repos/asf/ambari/blob/6f17e44c/ambari-web/test/installer/step3_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/installer/step3_test.js b/ambari-web/test/installer/step3_test.js index d351c9e..071f0d3 100644 --- a/ambari-web/test/installer/step3_test.js +++ b/ambari-web/test/installer/step3_test.js @@ -121,12 +121,6 @@ describe('App.WizardStep3Controller', function () { Em.Object.create({name:'wst3_host2', bootStatus: 'REGISTERING', isChecked: false}) ], m: 'One registered, one registering', - allHostsComplete: { - e: false - }, - isInstallInProgress: { - e: true - }, visibleHosts: { RUNNING: { e: 0 @@ -151,12 +145,6 @@ describe('App.WizardStep3Controller', function () { Em.Object.create({name:'wst3_host2', bootStatus: 'REGISTERED', isChecked: false}) ], m: 'Two registered', - allHostsComplete: { - e: true - }, - isInstallInProgress: { - e: false - }, visibleHosts: { RUNNING: { e: 0 @@ -181,12 +169,6 @@ describe('App.WizardStep3Controller', function () { Em.Object.create({name:'wst3_host2', bootStatus: 'REGISTERED', isChecked: false}) ], m: 'One registered, one failed', - allHostsComplete: { - e: true - }, - isInstallInProgress: { - e: false - }, visibleHosts: { RUNNING: { e: 0 @@ -211,12 +193,6 @@ describe('App.WizardStep3Controller', function () { Em.Object.create({name:'wst3_host2', bootStatus: 'FAILED', isChecked: false}) ], m: 'Two failed', - allHostsComplete: { - e: true - }, - isInstallInProgress: { - e: false - }, visibleHosts: { RUNNING: { e: 0 @@ -241,12 +217,6 @@ describe('App.WizardStep3Controller', function () { Em.Object.create({name:'wst3_host2', bootStatus: 'REGISTERING', isChecked: false}) ], m: 'Two registering', - allHostsComplete: { - e: false - }, - isInstallInProgress: { - e: true - }, visibleHosts: { RUNNING: { e: 0 @@ -267,28 +237,6 @@ describe('App.WizardStep3Controller', function () { } ]; - describe('#allHostsComplete', function() { - tests.forEach(function(test) { - var controller = App.WizardStep3Controller.create({ - bootHosts: test.bootHosts - }); - it(test.m, function() { - expect(controller.get('allHostsComplete')).to.equal(test.allHostsComplete.e); - }); - }); - }); - - describe('#isInstallInProgress', function() { - tests.forEach(function(test) { - var controller = App.WizardStep3Controller.create({ - bootHosts: test.bootHosts - }); - it(test.m, function() { - expect(controller.get('isInstallInProgress')).to.equal(test.isInstallInProgress.e); - }); - }); - }); - describe('#registrationTimeoutSecs', function() { it('Manual install', function() { var controller = App.WizardStep3Controller.create({ @@ -312,30 +260,6 @@ describe('App.WizardStep3Controller', function () { }); }); - describe('#visibleHosts', function() { - var c = ['RUNNING', 'REGISTERING', 'REGISTERED', 'FAILED']; - tests.forEach(function(test) { - describe(test.m, function() { - c.forEach(function(_c) { - var controller = App.WizardStep3Controller.create({ - hosts: test.bootHosts - }); - controller.set('category', {hostsBootStatus: _c}); - it(_c, function() { - expect(controller.get('visibleHosts').length).to.equal(test.visibleHosts[_c].e); - }); - }); - var controller = App.WizardStep3Controller.create({ - hosts: test.bootHosts - }); - controller.set('category', false); - it('ALL', function() { - expect(controller.get('visibleHosts').length).to.equal(test.bootHosts.length); - }); - }); - }); - }); - describe('#isHostHaveWarnings', function() { var tests = [ { @@ -358,18 +282,6 @@ describe('App.WizardStep3Controller', function () { }); }); - describe('#onAllChecked', function() { - tests.forEach(function(test) { - var controller = App.WizardStep3Controller.create({ - hosts: test.bootHosts - }); - controller.set('allChecked', true); - it(test.m, function() { - expect(controller.get('visibleHosts').getEach('isChecked')).to.eql(test.onAllChecked.e); - }); - }); - }); - describe('#noHostsSelected', function() { tests.forEach(function(test) { it(test.m + ' - nothing checked', function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/6f17e44c/ambari-web/test/installer/step4_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/installer/step4_test.js b/ambari-web/test/installer/step4_test.js index c70b45a4..fa1334d 100644 --- a/ambari-web/test/installer/step4_test.js +++ b/ambari-web/test/installer/step4_test.js @@ -68,13 +68,18 @@ describe('App.WizardStep4Controller', function () { }); }); + var ajax_send; describe('#checkDependencies()', function () { - /*it('should set ZooKeeper isSelected property like in HBase', function () { - controller.setEach('isSelected', false); - controller.findProperty('serviceName', 'HBASE').set('isSelected', true); - controller.checkDependencies(); - expect(controller.findProperty('serviceName', 'ZOOKEEPER').get('isSelected')).to.equal(true); - });*/ + + beforeEach(function() { + ajax_send = App.ajax.send; + App.ajax.send = function() {}; + }); + + afterEach(function() { + App.ajax.send = ajax_send; + }); + it('should set ZooKeeper, HCatalog, WebHCatalog isSelected property like in Hive', function () { controller.setEach('isSelected', false); controller.findProperty('serviceName', 'HIVE').set('isSelected', true); http://git-wip-us.apache.org/repos/asf/ambari/blob/6f17e44c/ambari-web/test/views/common/quick_link_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/quick_link_view_test.js b/ambari-web/test/views/common/quick_link_view_test.js index f17e1b8..1729189 100644 --- a/ambari-web/test/views/common/quick_link_view_test.js +++ b/ambari-web/test/views/common/quick_link_view_test.js @@ -25,35 +25,37 @@ describe('App.QuickViewLinks', function () { describe('#setPort', function () { var testData = [ - { - 'service_id': 'HDFS', - 'protocol': 'https', - 'version': '2.0.6', - 'result': '' - }, - { + Em.Object.create({ 'service_id': 'YARN', 'protocol': 'http', - 'version': '2.0.6', - 'result': '8088' - }, - { + 'result': '8088', + 'default_http_port': '8088', + 'default_https_port': '8090', + 'regex': '\\w*:(\\d+)' + }), + Em.Object.create({ 'service_id': 'YARN', 'protocol': 'https', - 'version': '2.0.5', - 'result': '8088' - }, - { + 'https_config': 'https_config', + 'result': '8090', + 'default_http_port': '8088', + 'default_https_port': '8090', + 'regex': '\\w*:(\\d+)' + }), + Em.Object.create({ 'service_id': 'YARN', 'protocol': 'https', - 'version': '2.0.6', - 'result': '8090' - }, + 'https_config': 'https_config', + 'result': '8090', + 'default_http_port': '8088', + 'default_https_port': '8090', + 'regex': '\\w*:(\\d+)' + }) ]; testData.forEach(function(item) { - it('should return empty string if service_id is not YARN, 8090 if protocol is https and stack version higher than 2.0.5, http otherwise', function () { - expect(quickViewLinks.setPort(item.service_id, item.protocol, item.version)).to.equal(item.result); + it(item.service_id + ' ' + item.protocol, function () { + expect(quickViewLinks.setPort(item, item.protocol, item.version)).to.equal(item.result); }) },this); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/6f17e44c/ambari-web/test/views/main/dashboard/widgets/node_managers_live_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/dashboard/widgets/node_managers_live_test.js b/ambari-web/test/views/main/dashboard/widgets/node_managers_live_test.js index ae15127..2edfe8e 100644 --- a/ambari-web/test/views/main/dashboard/widgets/node_managers_live_test.js +++ b/ambari-web/test/views/main/dashboard/widgets/node_managers_live_test.js @@ -71,8 +71,9 @@ describe('App.NodeManagersLiveView', function() { ]; tests.forEach(function(test) { - describe('nodeManagerNodes length - ' + test.model.nodeManagerNodes.length + ' | nodeManagerLiveNodes length' + test.model.nodeManagerLiveNodes.length, function() { - var nodeManagersLiveView = App.NodeManagersLiveView.create({model_type:null, model: test.model}); + describe('nodeManagerNodes length - ' + test.model.nodeManagerNodes.length + ' | nodeManagerLiveNodes length - ' + test.model.nodeManagerLiveNodes.length, function() { + var AppNodeManagersLiveView = App.NodeManagersLiveView.extend({nodeManagersLive: test.model.nodeManagerLiveNodes}); + var nodeManagersLiveView = AppNodeManagersLiveView.create({model_type:null, model: test.model}); it('content', function() { expect(nodeManagersLiveView.get('content')).to.equal(test.e.content); });