You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2014/07/23 15:09:24 UTC
git commit: AMBARI-6579. Fix "Skipped" tests. (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 2c53202d2 -> e77681411
AMBARI-6579. Fix "Skipped" tests. (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e7768141
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e7768141
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e7768141
Branch: refs/heads/trunk
Commit: e7768141150396f95c74d38068355c07bbca564d
Parents: 2c53202
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Wed Jul 23 16:07:17 2014 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Wed Jul 23 16:07:17 2014 +0300
----------------------------------------------------------------------
.../main/admin/security/add/step2_test.js | 50 +--
.../heatmap_metric_yarn_ResourceUsed_test.js | 120 +++---
ambari-web/test/controllers/main/host_test.js | 190 +---------
.../test/controllers/wizard/step4_test.js | 3 +-
.../test/controllers/wizard/step6_test.js | 376 -------------------
.../test/utils/batch_scheduled_requests_test.js | 8 +-
.../common/configs/services_config_test.js | 17 +-
ambari-web/test/views/main/host/summary_test.js | 14 +-
8 files changed, 84 insertions(+), 694 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/e7768141/ambari-web/test/controllers/main/admin/security/add/step2_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/security/add/step2_test.js b/ambari-web/test/controllers/main/admin/security/add/step2_test.js
index bd36c3c..42d63fe 100644
--- a/ambari-web/test/controllers/main/admin/security/add/step2_test.js
+++ b/ambari-web/test/controllers/main/admin/security/add/step2_test.js
@@ -275,7 +275,7 @@ describe('App.MainAdminSecurityAddStep2Controller', function () {
});
});
- describe.skip('#setHostsToConfig()', function () {
+ describe('#setHostsToConfig()', function () {
it('service is null', function () {
expect(controller.setHostsToConfig(null)).to.be.false;
});
@@ -318,7 +318,7 @@ describe('App.MainAdminSecurityAddStep2Controller', function () {
});
});
- describe.skip('#setHostToPrincipal()', function () {
+ describe('#setHostToPrincipal()', function () {
it('service is null', function () {
expect(controller.setHostToPrincipal(null)).to.be.false;
});
@@ -541,52 +541,6 @@ describe('App.MainAdminSecurityAddStep2Controller', function () {
});
});
- describe.skip('#addSlaveHostToGlobals()', function () {
- it('slaveComponentMap is empty', function () {
- sinon.stub(controller, 'setHostsToConfig', Em.K);
- controller.set('slaveComponentMap', []);
- controller.addSlaveHostToGlobals();
- expect(controller.setHostsToConfig.called).to.be.false;
- controller.setHostsToConfig.restore();
- });
- it('Correct data', function () {
- sinon.stub(controller, 'setHostsToConfig', Em.K);
- controller.set('slaveComponentMap', [
- {
- serviceName: 'HDFS',
- configName: 'datanode_hosts',
- component: 'DATANODE'
- }
- ]);
- controller.addSlaveHostToGlobals();
- expect(controller.setHostsToConfig.calledWith('HDFS', 'datanode_hosts', ['DATANODE'])).to.be.true;
- controller.setHostsToConfig.restore();
- });
- });
-
- describe.skip('#addMasterHostToGlobals()', function () {
- it('masterComponentMap is empty', function () {
- sinon.stub(controller, 'setHostsToConfig', Em.K);
- controller.set('masterComponentMap', []);
- controller.addMasterHostToGlobals();
- expect(controller.setHostsToConfig.called).to.be.false;
- controller.setHostsToConfig.restore();
- });
- it('Correct data', function () {
- sinon.stub(controller, 'setHostsToConfig', Em.K);
- controller.set('masterComponentMap', [
- {
- serviceName: 'HDFS',
- configName: 'datanode_hosts',
- components: ['DATANODE']
- }
- ]);
- controller.addMasterHostToGlobals();
- expect(controller.setHostsToConfig.calledWith('HDFS', 'datanode_hosts', ['DATANODE'])).to.be.true;
- controller.setHostsToConfig.restore();
- });
- });
-
describe('#addHostPrincipals()', function () {
it('hostToPrincipalMap is empty', function () {
sinon.stub(controller, 'setHostToPrincipal', Em.K);
http://git-wip-us.apache.org/repos/asf/ambari/blob/e7768141/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_yarn_ResourceUsed_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_yarn_ResourceUsed_test.js b/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_yarn_ResourceUsed_test.js
index c988326..4d8a847 100644
--- a/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_yarn_ResourceUsed_test.js
+++ b/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_yarn_ResourceUsed_test.js
@@ -21,7 +21,7 @@ require('controllers/main/charts/heatmap_metrics/heatmap_metric');
require('controllers/main/charts/heatmap_metrics/heatmap_metric_yarn');
require('controllers/main/charts/heatmap_metrics/heatmap_metric_yarn_ResourceUsed');
-describe.skip('App.MainChartHeatmapYarnResourceUsedMetric', function () {
+describe('App.MainChartHeatmapYarnResourceUsedMetric', function () {
var mainChartHeatmapYarnResourceUsedMetric = App.MainChartHeatmapYarnResourceUsedMetric.create({});
@@ -30,94 +30,92 @@ describe.skip('App.MainChartHeatmapYarnResourceUsedMetric', function () {
{
m: 'Correct JSON #1',
i: {
- "ServiceComponentInfo" : {
- "rm_metrics" : {
- "cluster" : {
- "nodeManagers" : "[{\"HostName\":\"dev01.hortonworks.com\",\"Rack\":\"/default-rack\",\"State\":\"RUNNING\",\"NodeId\":\"dev01.hortonworks.com:45454\",\"NodeHTTPAddress\":\"dev01.hortonworks.com:8042\",\"LastHealthUpdate\":1375869232870,\"HealthReport\":\"\",\"NumContainers\":0,\"UsedMemoryMB\":10,\"AvailableMemoryMB\":100}]"
+ ServiceComponentInfo: {
+ cluster_name: "c1",
+ component_name: "NODEMANAGER",
+ service_name: "YARN"
+ },
+ host_components: [{
+ HostRoles: {
+ cluster_name: "c1",
+ component_name: "NODEMANAGER",
+ host_name: "host1"
+ },
+ metrics: {
+ yarn: {
+ AllocatedGB: 0,
+ AvailableGB: 2
}
}
- }
+ }]
},
e: {
length: 1,
- val: '10.0',
- host: 'dev01.hortonworks.com'
+ val: '0.0',
+ host: 'host1'
}
},
{
m: 'Correct JSON #2',
i: {
- "ServiceComponentInfo" : {
- "rm_metrics" : {
- "cluster" : {
- "nodeManagers" : "[{\"HostName\":\"dev01.hortonworks.com\",\"Rack\":\"/default-rack\",\"State\":\"RUNNING\",\"NodeId\":\"dev01.hortonworks.com:45454\",\"NodeHTTPAddress\":\"dev01.hortonworks.com:8042\",\"LastHealthUpdate\":1375869232870,\"HealthReport\":\"\",\"NumContainers\":0,\"UsedMemoryMB\":0,\"AvailableMemoryMB\":100}]"
+ ServiceComponentInfo: {
+ cluster_name: "c1",
+ component_name: "NODEMANAGER",
+ service_name: "YARN"
+ },
+ host_components: [{
+ HostRoles: {
+ cluster_name: "c1",
+ component_name: "NODEMANAGER",
+ host_name: "host1"
+ },
+ metrics: {
+ yarn: {
+ AllocatedGB: 1,
+ AvailableGB: 2
}
}
- }
+ }]
},
e: {
length: 1,
- val: '0.0',
- host: 'dev01.hortonworks.com'
- }
- },
- {
- m: 'JSON without "cluster"',
- i: {
- "ServiceComponentInfo" : {
- "rm_metrics" : {
- }
- }
- },
- e: {
- length: 0,
- val: null,
- host: null
+ val: '33.3',
+ host: 'host1'
}
},
{
- m: 'JSON without "nodeManagers"',
+ m: 'Correct JSON #3',
i: {
- "ServiceComponentInfo" : {
- "rm_metrics" : {
- "cluster" : {
+ ServiceComponentInfo: {
+ cluster_name: "c1",
+ component_name: "NODEMANAGER",
+ service_name: "YARN"
+ },
+ host_components: [{
+ HostRoles: {
+ cluster_name: "c1",
+ component_name: "NODEMANAGER",
+ host_name: "host1"
+ },
+ metrics: {
+ yarn: {
+ AllocatedGB: 0,
+ AvailableGB: 0
}
}
- }
+ }]
},
e: {
- length: 0,
- val: null,
- host: null
- }
- },
- {
- m: 'Correct JSON #3 (with two nodeManagers)',
- i: {
- "ServiceComponentInfo" : {
- "rm_metrics" : {
- "cluster" : {
- "nodeManagers" : "[{\"HostName\":\"dev01.hortonworks.com\",\"Rack\":\"/default-rack\",\"State\":\"RUNNING\",\"NodeId\":\"dev01.hortonworks.com:45454\",\"NodeHTTPAddress\":\"dev01.hortonworks.com:8042\",\"LastHealthUpdate\":1375869232870,\"HealthReport\":\"\",\"NumContainers\":0,\"UsedMemoryMB\":0,\"AvailableMemoryMB\":100}, {\"HostName\":\"dev02.hortonworks.com\",\"Rack\":\"/default-rack\",\"State\":\"RUNNING\",\"NodeId\":\"dev02.hortonworks.com:45454\",\"NodeHTTPAddress\":\"dev01.hortonworks.com:8042\",\"LastHealthUpdate\":1375869232870,\"HealthReport\":\"\",\"NumContainers\":0,\"UsedMemoryMB\":100,\"AvailableMemoryMB\":100}]"
- }
- }
- }
- },
- e: {
- length: 2,
- val: '100.0',
- host: 'dev02.hortonworks.com'
+ length: 1,
+ val: 'Unknown',
+ host: 'host1'
}
}
];
tests.forEach(function(test) {
it(test.m, function () {
- var result = mainChartHeatmapYarnResourceUsedMetric.metricMapper(test.i);
- var length = 0;
- for(var p in result) {
- if (result.hasOwnProperty(p)) {
- length++;
- }
- }
+ var result = mainChartHeatmapYarnResourceUsedMetric.metricMapper(test.i),
+ length = Em.keys(result).length;
expect(length).to.equal(test.e.length);
if (test.e.host) {
expect(result.hasOwnProperty(test.e.host)).to.equal(true);
http://git-wip-us.apache.org/repos/asf/ambari/blob/e7768141/ambari-web/test/controllers/main/host_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host_test.js b/ambari-web/test/controllers/main/host_test.js
index 71401f7..6e05766 100644
--- a/ambari-web/test/controllers/main/host_test.js
+++ b/ambari-web/test/controllers/main/host_test.js
@@ -27,23 +27,16 @@ describe('MainHostController', function () {
var hostController;
// @todo add unit tests after bulk ops reimplementing
- describe.skip('#bulkOperation', function() {
+ describe('#bulkOperation', function() {
beforeEach(function() {
- hostController = App.MainHostController.create({
- bulkOperationForHostsRestart: function(){},
- bulkOperationForHosts: function(){},
- bulkOperationForHostComponentsRestart: function(){},
- bulkOperationForHostComponentsDecommission: function(){},
- bulkOperationForHostComponents: function(){},
- bulkOperationForHostsPassiveState: function(){}
- });
- sinon.spy(hostController, 'bulkOperationForHostsRestart');
- sinon.spy(hostController, 'bulkOperationForHosts');
- sinon.spy(hostController, 'bulkOperationForHostComponentsRestart');
- sinon.spy(hostController, 'bulkOperationForHostComponentsDecommission');
- sinon.spy(hostController, 'bulkOperationForHostComponents');
- sinon.spy(hostController, 'bulkOperationForHostsPassiveState');
+ hostController = App.MainHostController.create({});
+ sinon.stub(hostController, 'bulkOperationForHostsRestart', Em.K);
+ sinon.stub(hostController, 'bulkOperationForHosts', Em.K);
+ sinon.stub(hostController, 'bulkOperationForHostComponentsRestart', Em.K);
+ sinon.stub(hostController, 'bulkOperationForHostComponentsDecommission', Em.K);
+ sinon.stub(hostController, 'bulkOperationForHostComponents', Em.K);
+ sinon.stub(hostController, 'bulkOperationForHostsPassiveState', Em.K);
});
afterEach(function() {
@@ -135,173 +128,6 @@ describe('MainHostController', function () {
});
- // @todo add unit tests after bulk ops reimplementing
- describe.skip('#bulkOperationForHosts', function() {
-
- beforeEach(function(){
- hostController = App.MainHostController.create({});
- sinon.spy($, 'ajax');
- });
-
- afterEach(function() {
- $.ajax.restore();
- });
-
- var tests = [
- {
- operationData: {},
- hosts: [],
- m: 'no hosts',
- e: false
- },
- {
- operationData: {
- actionToCheck: 'STARTED'
- },
- hosts: [
- Em.Object.create({
- hostComponents: Em.A([
- Em.Object.create({isMaster: true, isSlave: false, host: {hostName:'host1'}, workStatus: 'STARTED', componentName: 'NAMENODE', passiveState: 'OFF'}),
- Em.Object.create({isMaster: false, isSlave: true, host: {hostName:'host1'}, workStatus: 'STARTED', componentName: 'DATANODE', passiveState: 'OFF'})
- ])
- })
- ],
- m: '1 host. components are in proper state',
- e: true
- },
- {
- operationData: {
- actionToCheck: 'INSTALLED'
- },
- hosts: [
- Em.Object.create({
- hostComponents: Em.A([
- Em.Object.create({isMaster: true, isSlave: false, host: {hostName:'host1'}, workStatus: 'STARTED', componentName: 'NAMENODE', passiveState: 'OFF'}),
- Em.Object.create({isMaster: false, isSlave: true, host: {hostName:'host1'}, workStatus: 'STARTED', componentName: 'DATANODE', passiveState: 'OFF'})
- ])
- })
- ],
- m: '1 host. components are not in proper state',
- e: false
- },
- {
- operationData: {
- actionToCheck: 'INSTALLED'
- },
- hosts: [
- Em.Object.create({
- hostComponents: Em.A([
- Em.Object.create({isMaster: true, isSlave: false, host: {hostName:'host1'}, workStatus: 'INSTALLED', componentName: 'NAMENODE', passiveState: 'OFF'}),
- Em.Object.create({isMaster: false, isSlave: true, host: {hostName:'host1'}, workStatus: 'STARTED', componentName: 'DATANODE', passiveState: 'OFF'})
- ])
- })
- ],
- m: '1 host. some components are in proper state',
- e: true
- }
- ];
-
- tests.forEach(function(test) {
- it(test.m, function() {
- hostController.bulkOperationForHosts(test.operationData, test.hosts);
- expect($.ajax.called).to.equal(test.e);
- });
- });
-
- });
-
- // @todo add unit tests after bulk ops reimplementing
- describe.skip('#bulkOperationForHostsRestart', function() {
-
- beforeEach(function(){
- hostController = App.MainHostController.create({});
- sinon.spy($, 'ajax');
- });
-
- afterEach(function() {
- $.ajax.restore();
- });
-
- var tests = Em.A([
- {
- hosts: Em.A([]),
- m: 'No hosts',
- e: false
- },
- {
- hosts: Em.A([
- Em.Object.create({
- hostComponents: Em.A([Em.Object.create({passiveState: 'OFF'}), Em.Object.create({passiveState: 'OFF'})])
- })
- ]),
- m: 'One host',
- e: true
- }
- ]);
-
- tests.forEach(function(test) {
- it(test.m, function() {
- hostController.bulkOperationForHostsRestart({}, test.hosts);
- expect($.ajax.calledOnce).to.equal(test.e)
- });
- });
-
- });
-
- // @todo add unit tests after bulk ops reimplementing
- describe.skip('#bulkOperationForHostsPassiveState', function() {
-
- beforeEach(function(){
- hostController = App.MainHostController.create({});
- sinon.spy($, 'ajax');
- });
-
- afterEach(function() {
- $.ajax.restore();
- });
-
- var tests = [
- {
- hosts: Em.A([]),
- operationData: {},
- m: 'No hosts',
- e: false
- },
- {
- hosts: Em.A([
- Em.Object.create({
- passiveState: 'OFF'
- })
- ]),
- operationData: {
- state: 'OFF'
- },
- m: 'One host, but in state that should get',
- e: false
- },
- {
- hosts: Em.A([
- Em.Object.create({
- passiveState: 'OFF'
- })
- ]),
- operationData: {
- state: 'ON'
- },
- m: 'One host with proper state',
- e: true
- }
- ];
-
- tests.forEach(function(test) {
- it(test.m, function() {
- hostController.bulkOperationForHostsPassiveState(test.operationData, test.hosts);
- expect($.ajax.calledOnce).to.equal(test.e)
- });
- });
-
- });
-
describe('#getRegExp()', function() {
before(function() {
hostController = App.MainHostController.create({});
http://git-wip-us.apache.org/repos/asf/ambari/blob/e7768141/ambari-web/test/controllers/wizard/step4_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step4_test.js b/ambari-web/test/controllers/wizard/step4_test.js
index 78fecd4..811c0f7 100644
--- a/ambari-web/test/controllers/wizard/step4_test.js
+++ b/ambari-web/test/controllers/wizard/step4_test.js
@@ -30,7 +30,7 @@ describe('App.WizardStep4Controller', function () {
var controller = App.WizardStep4Controller.create();
services.forEach(function(serviceName, index){
controller.pushObject(Ember.Object.create({
- 'serviceName':serviceName, 'isSelected': true, 'canBeSelected': true, 'isInstalled': false, 'isDisabled': 'HDFS' === serviceName, isDFS: 'HDFS' === serviceName
+ 'serviceName':serviceName, 'isSelected': true, 'isHiddenOnSelectServicePage': false, 'isInstalled': false, 'isDisabled': 'HDFS' === serviceName, isDFS: 'HDFS' === serviceName
}));
});
@@ -47,6 +47,7 @@ describe('App.WizardStep4Controller', function () {
describe('#isAll', function () {
it('should return true if all services are selected', function () {
+ controller.setEach('isInstalled', false);
controller.findProperty('serviceName', 'HDFS').set('isSelected', true);
expect(controller.get('isAll')).to.equal(true);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/e7768141/ambari-web/test/controllers/wizard/step6_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js
index 98a40a1..e67add8 100644
--- a/ambari-web/test/controllers/wizard/step6_test.js
+++ b/ambari-web/test/controllers/wizard/step6_test.js
@@ -559,380 +559,4 @@ describe('App.WizardStep6Controller', function () {
});
});
- describe.skip('#renderSlaves', function () {
- Em.A([
- {
- controllerName: 'addServiceController',
- slaveComponents: [],
- hostsObj: [
- Em.Object.create({
- checkboxes: Em.A([
- Em.Object.create({isInstalled: false, title: 'Client'}),
- Em.Object.create({isInstalled: false, title: ''}),
- Em.Object.create({isInstalled: false, title: ''})
- ]),
- hasMaster: true
- })
- ],
- m: 'host with masters, empty slaveComponents, controllerName - addServiceController',
- e: [
- [false, false, false]
- ]
- },
- {
- controllerName: 'addServiceController',
- slaveComponents: [],
- hostsObj: [
- Em.Object.create({
- checkboxes: Em.A([
- Em.Object.create({isInstalled: false, title: 'Client'}),
- Em.Object.create({isInstalled: false, title: ''}),
- Em.Object.create({isInstalled: false, title: ''})
- ]),
- hasMaster: false
- })
- ],
- m: 'host without masters, empty slaveComponents, controllerName - addServiceController',
- e: [
- [false, true, true]
- ]
- },
- {
- controllerName: 'addServiceController',
- slaveComponents: [],
- services: [
- Em.Object.create({serviceName: 'HDFS', isSelected: true})
- ],
- hostsObj: [
- Em.Object.create({
- checkboxes: Em.A([
- Em.Object.create({isInstalled: false, title: 'Client'}),
- Em.Object.create({isInstalled: false, title: 'DataNode', checked: true}),
- Em.Object.create({isInstalled: false, title: ''})
- ]),
- hasMaster: false
- })
- ],
- m: 'host without masters, empty slaveComponents, controllerName - addServiceController, one datanode checked',
- e: [
- [true, true, true]
- ]
- },
- {
- controllerName: 'addServiceController',
- slaveComponents: [],
- services: [
- Em.Object.create({serviceName: 'HDFS', isSelected: true})
- ],
- hostsObj: [
- Em.Object.create({
- checkboxes: Em.A([
- Em.Object.create({isInstalled: false, title: 'Client'}),
- Em.Object.create({isInstalled: false, title: 'DataNode', checked: false}),
- Em.Object.create({isInstalled: false, title: ''})
- ]),
- hasMaster: true
- })
- ],
- m: 'host with masters, empty slaveComponents, controllerName - addServiceController, one datanode not checked',
- e: [
- [false, false, false]
- ]
- },
- {
- controllerName: 'installerController',
- slaveComponents: [],
- services: [
- Em.Object.create({serviceName: 'HDFS', isSelected: true})
- ],
- hostsObj: [
- Em.Object.create({
- checkboxes: Em.A([
- Em.Object.create({isInstalled: false, title: 'Client'}),
- Em.Object.create({isInstalled: false, title: 'DataNode', checked: true}),
- Em.Object.create({isInstalled: false, title: ''})
- ]),
- hasMaster: true
- })
- ],
- m: 'host with masters, empty slaveComponents, controllerName - installerController, one datanode checked',
- e: [
- [true, true, true]
- ]
- },
- {
- controllerName: 'installerController',
- slaveComponents: [],
- services: [
- Em.Object.create({serviceName: 'HDFS', isSelected: true})
- ],
- hostsObj: [
- Em.Object.create({
- checkboxes: Em.A([
- Em.Object.create({isInstalled: false, title: 'Client'}),
- Em.Object.create({isInstalled: false, title: 'DataNode', checked: false}),
- Em.Object.create({isInstalled: false, title: ''})
- ]),
- hasMaster: true
- }),
- Em.Object.create({
- checkboxes: Em.A([
- Em.Object.create({isInstalled: false, title: 'Client'}),
- Em.Object.create({isInstalled: false, title: 'DataNode', checked: true}),
- Em.Object.create({isInstalled: false, title: ''})
- ]),
- hasMaster: true
- })
- ],
- m: 'hosts with masters, empty slaveComponents, controllerName - installerController, one datanode checked',
- e: [
- [false, false, false],
- [true, true, true]
- ]
- },
- {
- controllerName: 'installerController',
- slaveComponents: [],
- services: [
- Em.Object.create({serviceName: 'HDFS', isSelected: true})
- ],
- hostsObj: [
- Em.Object.create({
- checkboxes: Em.A([
- Em.Object.create({isInstalled: false, title: 'Client'}),
- Em.Object.create({isInstalled: false, title: 'DataNode', checked: false}),
- Em.Object.create({isInstalled: false, title: ''})
- ]),
- hasMaster: true
- }),
- Em.Object.create({
- checkboxes: Em.A([
- Em.Object.create({isInstalled: false, title: 'Client'}),
- Em.Object.create({isInstalled: false, title: 'DataNode', checked: true}),
- Em.Object.create({isInstalled: false, title: ''})
- ]),
- hasMaster: false
- })
- ],
- m: 'some hosts with masters, empty slaveComponents, controllerName - installerController, one datanode checked',
- e: [
- [false, false, false],
- [true, true, true]
- ]
- }
- ]).forEach(function (test) {
- it(test.m, function () {
- controller.set('content.slaveComponents', test.slaveComponents);
- controller.set('content.controllerName', test.controllerName);
- if (test.services) {
- controller.set('content.services', test.services);
- }
- controller.set('isMasters', false);
- controller.loadStep();
- var r = controller.renderSlaves(test.hostsObj);
- expect(r.map(function (i) {
- return i.get('checkboxes').map(function (j) {
- return j.get('checked');
- });
- })).to.eql(test.e);
- });
- });
-
- Em.A([
- {
- slaveComponents: [
- {componentName: 'c1', hosts: [
- {hostName: 'h1', isInstalled: false},
- {hostName: 'h2', isInstalled: false}
- ]},
- {componentName: 'c2', hosts: [
- {hostName: 'h1', isInstalled: false},
- {hostName: 'h2', isInstalled: false}
- ]}
- ],
- headers: [
- Em.Object.create({name: 'c1', label: 'C1'}),
- Em.Object.create({name: 'c2', label: 'C2'})
- ],
- hostsObj: [
- Em.Object.create({
- hostName: 'h1',
- checkboxes: [
- Em.Object.create({
- title: 'C1',
- checked: false,
- isInstalled: false
- }),
- Em.Object.create({
- title: 'C2',
- checked: false,
- isInstalled: false
- })
- ]
- }),
- Em.Object.create({
- hostName: 'h2',
- checkboxes: [
- Em.Object.create({
- title: 'C1',
- checked: false,
- isInstalled: false
- }),
- Em.Object.create({
- title: 'C2',
- checked: false,
- isInstalled: false
- })
- ]
- })
- ],
- m: 'all Checked, nothing installed before',
- e: {
- checked: [
- [true, true],
- [true, true]
- ],
- isInstalled: [
- [false, false],
- [false, false]
- ]
- }
- },
- {
- slaveComponents: [
- {componentName: 'c1', hosts: [
- {hostName: 'h1', isInstalled: true},
- {hostName: 'h2', isInstalled: true}
- ]},
- {componentName: 'c2', hosts: [
- {hostName: 'h1', isInstalled: true},
- {hostName: 'h2', isInstalled: true}
- ]}
- ],
- headers: [
- Em.Object.create({name: 'c1', label: 'C1'}),
- Em.Object.create({name: 'c2', label: 'C2'})
- ],
- hostsObj: [
- Em.Object.create({
- hostName: 'h1',
- checkboxes: [
- Em.Object.create({
- title: 'C1',
- checked: false,
- isInstalled: false
- }),
- Em.Object.create({
- title: 'C2',
- checked: false,
- isInstalled: false
- })
- ]
- }),
- Em.Object.create({
- hostName: 'h2',
- checkboxes: [
- Em.Object.create({
- title: 'C1',
- checked: false,
- isInstalled: false
- }),
- Em.Object.create({
- title: 'C2',
- checked: false,
- isInstalled: false
- })
- ]
- })
- ],
- m: 'all Checked, all installed before',
- e: {
- checked: [
- [true, true],
- [true, true]
- ],
- isInstalled: [
- [true, true],
- [true, true]
- ]
- }
- },
- {
- slaveComponents: [
- {componentName: 'c1', hosts: [
- {hostName: 'h1', isInstalled: true}
- ]},
- {componentName: 'c2', hosts: [
- {hostName: 'h2', isInstalled: true}
- ]}
- ],
- headers: [
- Em.Object.create({name: 'c1', label: 'C1'}),
- Em.Object.create({name: 'c2', label: 'C2'})
- ],
- hostsObj: [
- Em.Object.create({
- hostName: 'h1',
- checkboxes: [
- Em.Object.create({
- title: 'C1',
- checked: false,
- isInstalled: false
- }),
- Em.Object.create({
- title: 'C2',
- checked: false,
- isInstalled: false
- })
- ]
- }),
- Em.Object.create({
- hostName: 'h2',
- checkboxes: [
- Em.Object.create({
- title: 'C1',
- checked: false,
- isInstalled: false
- }),
- Em.Object.create({
- title: 'C2',
- checked: false,
- isInstalled: false
- })
- ]
- })
- ],
- m: 'some Checked, some installed before',
- e: {
- checked: [
- [true, false],
- [false, true]
- ],
- isInstalled: [
- [true, false],
- [false, true]
- ]
- }
- }
- ]).forEach(function (test) {
- it(test.m, function () {
- controller.set('content.slaveComponentHosts', test.slaveComponents);
- controller.set('headers', test.headers);
- var r = controller.renderSlaves(test.hostsObj);
- var checked = r.map(function (i) {
- return i.get('checkboxes').map(function (j) {
- return j.get('checked')
- })
- });
- var isInstalled = r.map(function (i) {
- return i.get('checkboxes').map(function (j) {
- return j.get('isInstalled')
- })
- });
- expect(checked).to.eql(test.e.checked);
- expect(isInstalled).to.eql(test.e.isInstalled);
- });
- });
- });
-
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/e7768141/ambari-web/test/utils/batch_scheduled_requests_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/batch_scheduled_requests_test.js b/ambari-web/test/utils/batch_scheduled_requests_test.js
index f15aa0e..8407fcf 100644
--- a/ambari-web/test/utils/batch_scheduled_requests_test.js
+++ b/ambari-web/test/utils/batch_scheduled_requests_test.js
@@ -94,16 +94,22 @@ describe('batch_scheduled_requests', function() {
});
});
- describe.skip('#launchHostComponentRollingRestart', function() {
+ describe('#launchHostComponentRollingRestart', function() {
beforeEach(function() {
sinon.spy(batchUtils, 'showRollingRestartPopup');
sinon.spy(batchUtils, 'showWarningRollingRestartPopup');
+ sinon.stub(App, 'get', function(k) {
+ if ('components.rollinRestartAllowed' === k)
+ return ['DATANODE', 'TASKTRACKER', 'NODEMANAGER', 'HBASE_REGIONSERVER', 'SUPERVISOR'];
+ return Em.get(App, k);
+ });
});
afterEach(function() {
batchUtils.showRollingRestartPopup.restore();
batchUtils.showWarningRollingRestartPopup.restore();
+ App.get.restore();
});
var tests = Em.A([
http://git-wip-us.apache.org/repos/asf/ambari/blob/e7768141/ambari-web/test/views/common/configs/services_config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/services_config_test.js b/ambari-web/test/views/common/configs/services_config_test.js
index 6329bea..b78a872 100644
--- a/ambari-web/test/views/common/configs/services_config_test.js
+++ b/ambari-web/test/views/common/configs/services_config_test.js
@@ -63,24 +63,9 @@ describe('App.ServiceConfigView', function () {
App.ServiceConfigCategory.create({ name: 'category3', siteFileName: 'xml', canAddProperty: false})
]
}
- },
- {
- title: 'selectedConfigGroup is not default group',
- result: {
- 'category1': false,
- 'category2': false
- },
- selectedConfigGroup: {},
- selectedService: {
- serviceName: 'TEST',
- configCategories: [
- App.ServiceConfigCategory.create({ name: 'category1', siteFileName: 'xml', canAddProperty: true}),
- App.ServiceConfigCategory.create({ name: 'category2', siteFileName: 'xml', canAddProperty: false})
- ]
- }
}
];
- describe.skip('#checkCanEdit', function () {
+ describe('#checkCanEdit', function () {
testCases.forEach(function (test) {
it(test.title, function () {
controller.set('selectedService', test.selectedService);
http://git-wip-us.apache.org/repos/asf/ambari/blob/e7768141/ambari-web/test/views/main/host/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/summary_test.js b/ambari-web/test/views/main/host/summary_test.js
index 09544ab..b5637db 100644
--- a/ambari-web/test/views/main/host/summary_test.js
+++ b/ambari-web/test/views/main/host/summary_test.js
@@ -272,17 +272,11 @@ describe('App.MainHostSummaryView', function() {
});
- describe.skip('#addableComponents', function() {
+ describe('#addableComponents', function() {
+
var tests = Em.A([
{
- content: Em.Object.create({
- hostComponents: Em.A([])
- }),
- services: ['HDFS', 'YARN', 'MAPREDUCE2'],
- e: ['DATANODE', 'NODEMANAGER', 'CLIENTS'],
- m: 'no components on host (impossible IRL, but should be tested)'
- },
- {
+ installableClientComponents: [{}, {}],
content: Em.Object.create({
hostComponents: Em.A([
Em.Object.create({
@@ -298,6 +292,7 @@ describe('App.MainHostSummaryView', function() {
m: 'some components are already installed'
},
{
+ installableClientComponents: [],
content: Em.Object.create({
hostComponents: Em.A([
Em.Object.create({
@@ -322,6 +317,7 @@ describe('App.MainHostSummaryView', function() {
tests.forEach(function(test) {
it(test.m, function() {
+ mainHostSummaryView.reopen({installableClientComponents: test.installableClientComponents});
mainHostSummaryView.set('content', test.content);
mainHostSummaryView.set('installedServices', test.services);
expect(mainHostSummaryView.get('addableComponents').mapProperty('componentName')).to.eql(test.e);