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 2015/12/18 11:04:21 UTC
[2/3] ambari git commit: AMBARI-14356.
hostWarningPopupBody_view_test.js unit test failing intermittently
(onechiporenko)
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
index a341587..7521d93 100644
--- a/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
@@ -96,7 +96,7 @@ describe('App.ReassignMasterWizardStep2Controller', function () {
});
describe("#mastersToShow", function() {
- it("", function() {
+ it("should be like array with `content.reassign.component_name`", function() {
controller.set('content.reassign.component_name', 'C1');
controller.propertyDidChange('mastersToShow');
expect(controller.get('mastersToShow')).to.eql(['C1']);
@@ -104,7 +104,7 @@ describe('App.ReassignMasterWizardStep2Controller', function () {
});
describe("#mastersToMove", function() {
- it("", function() {
+ it("should be like array with `content.reassign.component_name`", function() {
controller.set('content.reassign.component_name', 'C1');
controller.propertyDidChange('mastersToMove');
expect(controller.get('mastersToMove')).to.eql(['C1']);
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/controllers/main/service/reassign/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step3_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step3_controller_test.js
index 713eaed..e433f47 100644
--- a/ambari-web/test/controllers/main/service/reassign/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step3_controller_test.js
@@ -32,19 +32,21 @@ describe('App.ReassignMasterWizardStep3Controller', function () {
callback();
}
};
- before(function () {
+ beforeEach(function () {
sinon.stub(App, 'get').returns(mock);
sinon.spy(mock, 'getKDCSessionState');
sinon.stub(App.router, 'send', Em.K);
+ controller.submit();
});
- after(function () {
+ afterEach(function () {
App.get.restore();
mock.getKDCSessionState.restore();
App.router.send.restore();
});
- it("", function () {
- controller.submit();
+ it('getKDCSessionState is called once', function () {
expect(mock.getKDCSessionState.calledOnce).to.be.true;
+ });
+ it('User is moved to the next step', function () {
expect(App.router.send.calledWith("next")).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
index fd614a5..3b37770 100644
--- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
@@ -315,7 +315,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
after(function () {
controller.stopServices.restore();
});
- it("", function() {
+ it('stopServices is called with valid list of services', function() {
controller.set('content.reassign.component_name', 'JOBTRACKER');
controller.stopRequiredServices();
expect(controller.stopServices.calledWith(['HDFS', 'ZOOKEEPER', 'HBASE', 'FLUME', 'SQOOP', 'STORM'])).to.be.true;
@@ -334,7 +334,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
controller.getHostComponentsNames.restore();
this.mock.restore();
});
- it('No commands', function () {
+ it('No commands (isComponentWithDB = false)', function () {
controller.set('commands', []);
controller.set('commandsForDB', []);
this.mock.returns(false);
@@ -342,7 +342,8 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
expect(controller.get('tasks')).to.be.empty;
});
- it('No commands', function () {
+
+ it('No commands (isComponentWithDB = true)', function () {
controller.set('commands', []);
controller.set('commandsForDB', []);
this.mock.returns(true);
@@ -350,6 +351,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
expect(controller.get('tasks')).to.be.empty;
});
+
it('One command', function () {
controller.set('commands', ['COMMAND1']);
controller.set('commandsForDB', ['COMMAND1']);
@@ -415,7 +417,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
describe('#stopServices()', function () {
- it('', function () {
+ it('request is sent', function () {
controller.stopServices();
expect(App.ajax.send.calledOnce).to.be.true;
});
@@ -450,11 +452,18 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
describe('#onCreateComponent()', function () {
- it('', function () {
+
+ beforeEach(function () {
sinon.stub(controller, 'onComponentsTasksSuccess', Em.K);
+ });
+
+ afterEach(function () {
+ controller.onComponentsTasksSuccess.restore();
+ });
+
+ it('onComponentsTasksSuccess is called once', function () {
controller.onCreateComponent();
expect(controller.onComponentsTasksSuccess.calledOnce).to.be.true;
- controller.onComponentsTasksSuccess.restore();
});
});
@@ -509,16 +518,23 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
describe('#reconfigure()', function () {
- it('', function () {
+
+ beforeEach(function () {
sinon.stub(controller, 'loadConfigsTags', Em.K);
+ });
+
+ afterEach(function () {
+ controller.loadConfigsTags.restore();
+ });
+
+ it('loadConfigsTags is called once', function () {
controller.reconfigure();
expect(controller.loadConfigsTags.calledOnce).to.be.true;
- controller.loadConfigsTags.restore();
});
});
describe('#loadConfigsTags()', function () {
- it('', function () {
+ it('request is sent', function () {
controller.loadConfigsTags();
expect(App.ajax.send.calledOnce).to.be.true;
});
@@ -663,18 +679,26 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
describe('#onLoadConfigsTags()', function () {
- it('', function () {
+
+ beforeEach(function () {
sinon.stub(controller, 'getConfigUrlParams', function () {
return [];
});
controller.set('content.reassign.component_name', 'COMP1');
-
controller.onLoadConfigsTags({});
- expect(App.ajax.send.calledOnce).to.be.true;
- expect(controller.getConfigUrlParams.calledWith('COMP1', {})).to.be.true;
+ });
+ afterEach(function () {
controller.getConfigUrlParams.restore();
});
+
+ it('request is sent', function () {
+ expect(App.ajax.send.calledOnce).to.be.true;
+ });
+
+ it('getConfigUrlParams is called with correct data', function () {
+ expect(controller.getConfigUrlParams.calledWith('COMP1', {})).to.be.true;
+ });
});
describe('#loadStep()', function () {
@@ -731,25 +755,31 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
describe('#saveConfigsToServer()', function () {
beforeEach(function () {
sinon.stub(controller, 'getServiceConfigData', Em.K);
+ controller.saveConfigsToServer([1]);
});
afterEach(function () {
controller.getServiceConfigData.restore();
});
- it('', function () {
- controller.saveConfigsToServer([1]);
+ it('getServiceConfigData is called with valid data', function () {
expect(controller.getServiceConfigData.calledWith([1])).to.be.true;
+ });
+ it('request is sent', function () {
expect(App.ajax.send.calledOnce).to.be.true;
});
});
describe('#setSecureConfigs()', function () {
+
+ afterEach(function () {
+ Em.tryInvoke(App.get, 'restore');
+ });
+
it('undefined component and security disabled', function () {
var secureConfigs = [];
sinon.stub(App, 'get').withArgs('isKerberosEnabled').returns(false);
controller.set('secureConfigsMap', []);
expect(controller.setSecureConfigs(secureConfigs, {}, 'COMP1')).to.be.false;
expect(secureConfigs).to.eql([]);
- App.get.restore();
});
it('component exist and security disabled', function () {
var secureConfigs = [];
@@ -759,7 +789,6 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
}]);
expect(controller.setSecureConfigs(secureConfigs, {}, 'COMP1')).to.be.false;
expect(secureConfigs).to.eql([]);
- App.get.restore();
});
it('undefined component and security enabled', function () {
var secureConfigs = [];
@@ -767,7 +796,6 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
controller.set('secureConfigsMap', []);
expect(controller.setSecureConfigs(secureConfigs, {}, 'COMP1')).to.be.false;
expect(secureConfigs).to.eql([]);
- App.get.restore();
});
it('component exist and security enabled', function () {
var secureConfigs = [];
@@ -791,7 +819,6 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
"principal": "pValue"
}
]);
- App.get.restore();
});
});
@@ -866,7 +893,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
controller.onTaskCompleted.restore();
});
- it('', function () {
+ it('onTaskCompleted called once', function () {
controller.onSaveConfigs();
expect(controller.onTaskCompleted.calledOnce).to.be.true;
});
@@ -880,7 +907,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
controller.updateComponent.restore();
});
- it('', function () {
+ it('updateComponent called with valid arguments', function () {
controller.set('content.masterComponentHosts', [{
component: 'ZOOKEEPER_SERVER',
hostName: 'host1'
@@ -922,14 +949,14 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
describe('#startServices()', function () {
- before(function () {
+ beforeEach(function () {
sinon.stub(App.router, 'get').returns({"skip.service.checks": "false"});
+ controller.startServices();
});
- after(function () {
+ afterEach(function () {
App.router.get.restore();
});
- it('', function () {
- controller.startServices();
+ it('request is sent', function () {
expect(App.ajax.send.calledOnce).to.be.true;
});
});
@@ -970,14 +997,14 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
it('task success', function () {
var error = {
responseText: 'org.apache.ambari.server.controller.spi.NoSuchResourceException'
- }
+ };
controller.onDeleteHostComponentsError(error);
expect(controller.onComponentsTasksSuccess.calledOnce).to.be.true;
});
it('unknown error', function () {
var error = {
responseText: ''
- }
+ };
controller.onDeleteHostComponentsError(error);
expect(controller.onTaskError.calledOnce).to.be.true;
});
@@ -1041,7 +1068,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
controller.set('content.reassign.component_name', 'COMP1');
expect(controller.getServiceConfigData([])).to.eql([]);
});
- it('Services in stackServicesm but configTypesRendered is empty', function () {
+ it('Services in stackServices, but configTypesRendered is empty', function () {
services = [Em.Object.create({serviceName: 'S1'})];
stackServices = [Em.Object.create({
serviceName: 'S1',
@@ -1050,7 +1077,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
controller.set('content.reassign.component_name', 'COMP1');
expect(controller.getServiceConfigData([])[0]).to.equal("{\"Clusters\":{\"desired_config\":[]}}");
});
- it('Services in stackServicesm and configTypesRendered has data, but configs is empty', function () {
+ it('Services in stackServices, and configTypesRendered has data, but configs is empty', function () {
services = [Em.Object.create({serviceName: 'S1'})];
stackServices = [
Em.Object.create({
@@ -1061,7 +1088,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
controller.set('content.reassign.component_name', 'COMP1');
expect(controller.getServiceConfigData([])[0]).to.equal("{\"Clusters\":{\"desired_config\":[]}}");
});
- it('Services in stackServicesm and configTypesRendered has data, and configs present', function () {
+ it('Services in stackServices, and configTypesRendered has data, and configs present', function () {
services = [Em.Object.create({serviceName: 'S1'})];
stackServices = [
Em.Object.create({
@@ -1200,7 +1227,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
afterEach(function () {
App.HostComponent.find.restore();
});
- it("", function() {
+ it("valid request is sent", function() {
controller.startMySqlServer();
expect(App.ajax.send.calledWith({
name: 'common.host.host_component.update',
@@ -1232,7 +1259,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
afterEach(function () {
App.HostComponent.find.restore();
});
- it("", function() {
+ it("valid request is sent", function() {
controller.set('content', Em.Object.create({
cluster: Em.Object.create({
name: 'cl1'
@@ -1263,13 +1290,17 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
describe("#startNewMySqlServer()", function() {
- it("", function() {
+
+ beforeEach(function () {
controller.set('content', Em.Object.create({
reassignHosts: Em.Object.create({
target: 'host1'
})
}));
controller.startNewMySqlServer();
+ });
+
+ it('valid request is sent', function() {
expect(App.ajax.send.calledWith({
name: 'common.host.host_component.update',
sender: controller,
@@ -1546,12 +1577,6 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
'java.home': 'java.home'
});
sinon.stub(controller, 'getConnectionProperty').returns('prop1');
- });
- afterEach(function () {
- App.router.get.restore();
- controller.getConnectionProperty.restore();
- });
- it("", function () {
controller.set('content.reassignHosts', Em.Object.create({target: 'host1'}));
controller.reopen({
dbType: 'type1',
@@ -1559,10 +1584,17 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
preparedDBProperties: {}
});
controller.prepareDBCheckAction();
- expect(App.ajax.send.getCall(0).args[0].name).to.equal('cluster.custom_action.create');
- expect(App.ajax.send.getCall(0).args[0].success).to.equal('onCreateActionSuccess');
- expect(App.ajax.send.getCall(0).args[0].error).to.equal('onTaskError');
- expect(App.ajax.send.getCall(0).args[0].data).to.eql({
+ });
+ afterEach(function () {
+ App.router.get.restore();
+ controller.getConnectionProperty.restore();
+ });
+ it('valid request is sent', function () {
+ var callArgs = App.ajax.send.getCall(0).args[0];
+ expect(callArgs.name).to.equal('cluster.custom_action.create');
+ expect(callArgs.success).to.equal('onCreateActionSuccess');
+ expect(callArgs.error).to.equal('onTaskError');
+ expect(callArgs.data).to.eql({
requestInfo: {
"context": "Check host",
"action": "check_host",
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
index be3c8fe..9ab1144 100644
--- a/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step6_controller_test.js
@@ -247,7 +247,7 @@ describe('App.ReassignMasterWizardStep6Controller', function () {
afterEach(function () {
controller.startServices.restore();
});
- it("", function () {
+ it("startServices is called with valid arguments", function () {
controller.startAllServices();
expect(controller.startServices.calledWith(true)).to.be.true;
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/controllers/main/service/widgets/create/step1_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/widgets/create/step1_controller_test.js b/ambari-web/test/controllers/main/service/widgets/create/step1_controller_test.js
index 8ceb669..9d1efc0 100644
--- a/ambari-web/test/controllers/main/service/widgets/create/step1_controller_test.js
+++ b/ambari-web/test/controllers/main/service/widgets/create/step1_controller_test.js
@@ -38,15 +38,17 @@ describe('App.WidgetWizardStep1Controller', function () {
});
describe("#chooseOption()", function () {
- before(function () {
+ beforeEach(function () {
sinon.stub(controller, 'next');
+ controller.chooseOption({context: 'type1'});
});
- after(function () {
+ afterEach(function () {
controller.next.restore();
});
- it("", function () {
- controller.chooseOption({context: 'type1'});
+ it('widgetType is valid', function () {
expect(controller.get('widgetType')).to.equal('type1');
+ });
+ it('User is moved to the next step', function () {
expect(controller.next.calledOnce).to.be.true;
});
});
@@ -58,14 +60,14 @@ describe('App.WidgetWizardStep1Controller', function () {
after(function () {
controller.clearStep.restore();
});
- it("", function () {
+ it("clearStep", function () {
controller.loadStep();
expect(controller.clearStep.calledOnce).to.be.true;
});
});
describe("#clearStep()", function () {
- it("", function () {
+ it("widgetType is empty", function () {
controller.clearStep();
expect(controller.get('widgetType')).to.be.empty;
});
@@ -78,7 +80,7 @@ describe('App.WidgetWizardStep1Controller', function () {
after(function () {
App.router.send.restore();
});
- it("", function () {
+ it("user is moved to the next step", function () {
controller.next();
expect(App.router.send.calledWith('next')).to.be.true;
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js b/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js
index 9d3efde..3178ef5 100644
--- a/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js
+++ b/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js
@@ -221,20 +221,28 @@ describe('App.WidgetWizardStep2Controller', function () {
});
describe("#addDataSet()", function () {
- it("", function () {
+
+ beforeEach(function () {
controller.get('dataSets').clear();
controller.addDataSet(null, true);
- expect(controller.get('dataSets').objectAt(0).get('id')).to.equal(1);
- expect(controller.get('dataSets').objectAt(0).get('isRemovable')).to.equal(false);
controller.addDataSet(null);
- expect(controller.get('dataSets').objectAt(1).get('id')).to.equal(2);
- expect(controller.get('dataSets').objectAt(1).get('isRemovable')).to.equal(true);
+ });
+
+ afterEach(function() {
controller.get('dataSets').clear();
});
+
+ it('check id', function () {
+ expect(controller.get('dataSets').mapProperty('id')).to.eql([1, 2]);
+ });
+
+ it('check isRemovable', function () {
+ expect(controller.get('dataSets').mapProperty('isRemovable')).to.eql([false, true]);
+ });
});
describe("#removeDataSet()", function () {
- it("", function () {
+ it('should remove selected dataSet', function () {
var dataSet = Em.Object.create();
controller.get('dataSets').pushObject(dataSet);
controller.removeDataSet({context: dataSet});
@@ -243,20 +251,29 @@ describe('App.WidgetWizardStep2Controller', function () {
});
describe("#addExpression()", function () {
- it("", function () {
+
+ beforeEach(function () {
controller.get('expressions').clear();
controller.addExpression(null, true);
- expect(controller.get('expressions').objectAt(0).get('id')).to.equal(1);
- expect(controller.get('expressions').objectAt(0).get('isRemovable')).to.equal(false);
controller.addExpression(null);
- expect(controller.get('expressions').objectAt(1).get('id')).to.equal(2);
- expect(controller.get('expressions').objectAt(1).get('isRemovable')).to.equal(true);
+ });
+
+ afterEach(function () {
controller.get('expressions').clear();
});
+
+ it('check id', function () {
+ expect(controller.get('expressions').mapProperty('id')).to.eql([1, 2]);;
+ });
+
+ it('check isRemovable', function () {
+ expect(controller.get('expressions').mapProperty('isRemovable')).to.eql([false, true]);
+ });
+
});
describe("#removeExpression()", function () {
- it("", function () {
+ it("should remove selected expression", function () {
var expression = Em.Object.create();
controller.get('expressions').pushObject(expression);
controller.removeExpression({context: expression});
@@ -582,7 +599,7 @@ describe('App.WidgetWizardStep2Controller', function () {
afterEach(function () {
App.router.send.restore();
});
- it("", function () {
+ it("user is moved to the next step", function () {
controller.next();
expect(App.router.send.calledWith('next'));
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js b/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
index 144918e..6f92142 100644
--- a/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/service/widgets/create/step3_controller_test.js
@@ -39,11 +39,6 @@ describe('App.WidgetWizardStep3Controller', function () {
describe("#initPreviewData()", function () {
beforeEach(function () {
sinon.stub(controller, 'addObserver');
- });
- afterEach(function () {
- controller.addObserver.restore();
- });
- it("", function () {
controller.set('content', Em.Object.create({
widgetProperties: 'widgetProperties',
widgetValues: 'widgetValues',
@@ -55,15 +50,36 @@ describe('App.WidgetWizardStep3Controller', function () {
controllerName: 'widgetEditController'
}));
controller.initPreviewData();
+ });
+ afterEach(function () {
+ controller.addObserver.restore();
+ });
+ it('checking observes calls', function () {
controller.get('isSharedCheckboxDisabled') ? expect(controller.addObserver.calledWith('isSharedChecked')).to.be.false:
expect(controller.addObserver.calledWith('isSharedChecked')).to.be.true;
+ });
+ it('check widgetProperties`', function () {
expect(controller.get('widgetProperties')).to.equal('widgetProperties');
+ });
+ it('check widgetValues', function () {
expect(controller.get('widgetValues')).to.equal('widgetValues');
+ });
+ it('check widgetMetrics', function () {
expect(controller.get('widgetMetrics')).to.equal('widgetMetrics');
+ });
+ it('check widgetAuthor', function () {
expect(controller.get('widgetAuthor')).to.equal('widgetAuthor');
+ });
+ it('check widgetName', function () {
expect(controller.get('widgetName')).to.equal('widgetName');
+ });
+ it('check widgetDescription', function () {
expect(controller.get('widgetDescription')).to.equal('widgetDescription');
+ });
+ it('check isSharedChecked', function () {
expect(controller.get('isSharedChecked')).to.be.true;
+ });
+ it('check isSharedCheckboxDisabled', function () {
expect(controller.get('isSharedCheckboxDisabled')).to.be.true;
});
});
@@ -92,7 +108,8 @@ describe('App.WidgetWizardStep3Controller', function () {
});
describe("#collectWidgetData()", function () {
- it("", function () {
+
+ beforeEach(function () {
controller.setProperties({
widgetName: 'widgetName',
content: Em.Object.create({widgetType: 'T1'}),
@@ -103,7 +120,11 @@ describe('App.WidgetWizardStep3Controller', function () {
widgetValues: [{computedValue: 'cv', value: 'v'}],
widgetProperties: 'widgetProperties'
});
- expect(controller.collectWidgetData()).to.eql({
+ });
+
+ it('collected widget data is valid', function () {
+ var widgetData = controller.collectWidgetData();
+ expect(widgetData).to.eql({
"WidgetInfo": {
"widget_name": "widgetName",
"widget_type": "T1",
@@ -111,14 +132,10 @@ describe('App.WidgetWizardStep3Controller', function () {
"scope": "CLUSTER",
"author": "widgetAuthor",
"metrics": [
- {
- "name": "m1"
- }
+ {"name": "m1" }
],
"values": [
- {
- "value": "v"
- }
+ { "value": "v" }
],
"properties": "widgetProperties"
}
@@ -138,7 +155,7 @@ describe('App.WidgetWizardStep3Controller', function () {
App.router.get.restore();
mock.cancel.restore();
});
- it("", function () {
+ it('cancel is called', function () {
controller.cancel();
expect(mock.cancel.calledOnce).to.be.true;
});
@@ -153,6 +170,7 @@ describe('App.WidgetWizardStep3Controller', function () {
sinon.stub(controller, 'collectWidgetData');
sinon.stub(App.router, 'get').returns(mock);
sinon.stub(App.router, 'send');
+ controller.complete();
});
afterEach(function () {
App.router.get.restore();
@@ -160,10 +178,13 @@ describe('App.WidgetWizardStep3Controller', function () {
controller.collectWidgetData.restore();
mock.finishWizard.restore();
});
- it("", function () {
- controller.complete();
+ it('widget data is collected', function () {
expect(controller.collectWidgetData.calledOnce).to.be.true;
+ });
+ it('user is moved to finish the wizard', function () {
expect(App.router.send.calledWith('complete')).to.be.true;
+ });
+ it('finishWizard is called', function () {
expect(mock.finishWizard.calledOnce).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/controllers/wizard/step2_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step2_test.js b/ambari-web/test/controllers/wizard/step2_test.js
index 41782bc..8869444 100644
--- a/ambari-web/test/controllers/wizard/step2_test.js
+++ b/ambari-web/test/controllers/wizard/step2_test.js
@@ -239,7 +239,7 @@ describe('App.WizardStep2Controller', function () {
describe('#sshUserError', function () {
userErrorTests.forEach(function(test) {
- it('', function() {
+ it(JSON.stringify(test), function() {
var controller = App.WizardStep2Controller.create({content: {installOptions: {manualInstall: test.manualInstall, sshUser: test.user}}});
if(Em.isNone(test.e)) {
expect(controller.get('sshUserError')).to.equal(null);
@@ -255,7 +255,7 @@ describe('App.WizardStep2Controller', function () {
describe('#sshPortError', function () {
userErrorTests.forEach(function(test) {
- it('', function() {
+ it(JSON.stringify(test), function() {
var controller = App.WizardStep2Controller.create({content: {installOptions: {manualInstall: test.manualInstall, sshPort: test.sshPort}}});
if(Em.isNone(test.e)) {
expect(controller.get('sshPortError')).to.equal(null);
@@ -574,7 +574,7 @@ describe('App.WizardStep2Controller', function () {
describe('#setAmbariJavaHome', function() {
beforeEach(function() {
- sinon.spy($, 'ajax');
+ sinon.stub($, 'ajax', Em.K);
});
afterEach(function() {
$.ajax.restore();
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/controllers/wizard/step3_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js
index dd1e918..6262678 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -43,12 +43,16 @@ describe('App.WizardStep3Controller', function () {
sinon.stub(App.db, 'getDisplayLength', Em.K);
sinon.stub(App.db, 'getFilterConditions').returns([]);
sinon.stub(App.router, 'send', Em.K);
+ sinon.stub(App.ajax, 'send', function () {
+ return {done: Em.K}
+ });
});
afterEach(function () {
App.db.getDisplayLength.restore();
App.router.send.restore();
App.db.getFilterConditions.restore();
+ App.ajax.send.restore();
});
App.TestAliases.testAsComputedGt(getController(), 'isHostHaveWarnings', 'warnings.length', 0);
@@ -733,14 +737,6 @@ describe('App.WizardStep3Controller', function () {
describe('#doBootstrap()', function () {
- beforeEach(function () {
- sinon.spy(App.ajax, 'send');
- });
-
- afterEach(function () {
- App.ajax.send.restore();
- });
-
it('shouldn\'t do nothing if stopBootstrap is true', function () {
c.set('stopBootstrap', true);
c.doBootstrap();
@@ -783,13 +779,6 @@ describe('App.WizardStep3Controller', function () {
describe('#isHostsRegistered', function () {
- beforeEach(function () {
- sinon.stub(App.ajax, 'send', Em.K);
- });
- afterEach(function () {
- App.ajax.send.restore();
- });
-
it('shouldn\'t do nothing if stopBootstrap is true', function () {
c.set('stopBootstrap', true);
c.isHostsRegistered();
@@ -900,14 +889,6 @@ describe('App.WizardStep3Controller', function () {
describe('#getAllRegisteredHosts', function () {
- beforeEach(function () {
- sinon.spy(App.ajax, 'send');
- });
-
- afterEach(function () {
- App.ajax.send.restore();
- });
-
it('should call App.ajax.send', function () {
c.getAllRegisteredHosts();
expect(App.ajax.send.calledOnce).to.equal(true);
@@ -1012,14 +993,6 @@ describe('App.WizardStep3Controller', function () {
describe('#getHostInfo', function () {
- beforeEach(function () {
- sinon.spy(App.ajax, 'send');
- });
-
- afterEach(function () {
- App.ajax.send.restore();
- });
-
it('should do ajax request', function () {
c.getHostInfo();
expect(App.ajax.send.calledOnce).to.equal(true);
@@ -2662,29 +2635,6 @@ describe('App.WizardStep3Controller', function () {
});
- describe('#getJDKName', function () {
-
- beforeEach(function () {
- sinon.stub($, 'ajax', Em.K);
- sinon.stub(App, 'get', function (k) {
- if ('testMode' === k) return false;
- return Em.get(App, k);
- });
- });
-
- afterEach(function () {
- $.ajax.restore();
- App.get.restore();
- });
-
- it('should do proper request to ambari-server', function () {
- c.getJDKName();
- expect($.ajax.args[0][0].type).to.contain('GET');
- expect($.ajax.args[0][0].url).to.contain('/services/AMBARI/components/AMBARI_SERVER?fields=RootServiceComponents/properties/jdk.name,RootServiceComponents/properties/java.home,RootServiceComponents/properties/jdk_location');
- });
-
- });
-
describe('#getJDKNameSuccessCallback', function () {
it('should set proper data to controller properties', function () {
@@ -2715,7 +2665,6 @@ describe('App.WizardStep3Controller', function () {
describe('#doCheckJDK', function () {
beforeEach(function () {
- sinon.stub($, 'ajax', Em.K);
sinon.stub(App, 'get', function (k) {
if ('testMode' === k) return false;
return Em.get(App, k);
@@ -2723,11 +2672,10 @@ describe('App.WizardStep3Controller', function () {
});
afterEach(function () {
- $.ajax.restore();
App.get.restore();
});
- it('should do proper request to the ambari-server', function () {
+ it('should do request to the ambari-server', function () {
var bootHosts = [
Em.Object.create({name: 'n1', bootStatus: 'REGISTERED'}),
@@ -2741,12 +2689,7 @@ describe('App.WizardStep3Controller', function () {
jdkLocation: jdkLocation
});
c.doCheckJDK();
- var request = $.ajax.args[0][0], data = JSON.parse(request.data);
- expect(request.type).to.equal('POST');
- expect(request.url).to.contain('/requests');
- expect(data.RequestInfo.parameters.java_home).to.equal(javaHome);
- expect(data.RequestInfo.parameters.jdk_location).to.equal(jdkLocation);
- expect(data['Requests/resource_filters'][0].hosts).to.equal('n1,n2');
+ expect(App.ajax.send.calledOnce).to.be.true;
});
});
@@ -2754,7 +2697,6 @@ describe('App.WizardStep3Controller', function () {
describe('#doCheckJDKsuccessCallback', function () {
beforeEach(function () {
- sinon.stub($, 'ajax', Em.K);
sinon.stub(App, 'get', function (k) {
if ('testMode' === k) return false;
return Em.get(App, k);
@@ -2762,7 +2704,6 @@ describe('App.WizardStep3Controller', function () {
});
afterEach(function () {
- $.ajax.restore();
App.get.restore();
});
@@ -2787,7 +2728,7 @@ describe('App.WizardStep3Controller', function () {
expect(c.get('isJDKWarningsLoaded')).to.equal(expected);
});
- it('should do proper request to ambari-server', function () {
+ it('should do request to ambari-server', function () {
var data = null,
jdkRequestIndex = 'jdkRequestIndex',
@@ -2795,8 +2736,7 @@ describe('App.WizardStep3Controller', function () {
c.set('jdkRequestIndex', jdkRequestIndex);
c.set('jdkCategoryWarnings', null);
c.doCheckJDKsuccessCallback(data);
- expect($.ajax.args[0][0].type).to.equal('GET');
- expect($.ajax.args[0][0].url).to.contain(url);
+ expect(App.ajax.send.calledOnce).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/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 fdeaf0d..d4f912d 100644
--- a/ambari-web/test/controllers/wizard/step6_test.js
+++ b/ambari-web/test/controllers/wizard/step6_test.js
@@ -76,6 +76,15 @@ describe('App.WizardStep6Controller', function () {
beforeEach(function () {
controller = getController();
+ sinon.stub(App.ajax, 'send', function () {
+ return {
+ then: Em.K
+ };
+ });
+ });
+
+ afterEach(function () {
+ App.ajax.send.restore();
});
App.TestAliases.testAsComputedEqual(getController(), 'isAddHostWizard', 'content.controllerName', 'addHostController');
@@ -1311,11 +1320,6 @@ describe('App.WizardStep6Controller', function () {
}
];
});
- sinon.stub(App.ajax, 'send', function () {
- return {
- then: Em.K
- };
- });
});
afterEach(function () {
@@ -1326,7 +1330,6 @@ describe('App.WizardStep6Controller', function () {
App.get.restore();
controller.getCurrentMasterSlaveBlueprint.restore();
App.Host.find.restore();
- App.ajax.send.restore();
});
cases.forEach(function (item) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/controllers/wizard/step7_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js
index 334563d..233f785 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -109,12 +109,15 @@ function getController() {
describe('App.InstallerStep7Controller', function () {
beforeEach(function () {
+ sinon.stub(App.ajax, 'send', Em.K);
sinon.stub(App.config, 'setPreDefinedServiceConfigs', Em.K);
installerStep7Controller = getController();
});
afterEach(function() {
+ App.ajax.send.restore();
App.config.setPreDefinedServiceConfigs.restore();
+ installerStep7Controller.destroy();
});
App.TestAliases.testAsComputedAlias(getController(), 'masterComponentHosts', 'content.masterComponentHosts', 'array');
@@ -421,12 +424,6 @@ describe('App.InstallerStep7Controller', function () {
});
describe('#loadInstalledServicesConfigGroups', function () {
- before(function () {
- sinon.stub(App.ajax, 'send', Em.K);
- });
- after(function () {
- App.ajax.send.restore();
- });
it('should do ajax request for each received service name', function () {
var serviceNames = ['s1', 's2', 's3'];
installerStep7Controller.loadInstalledServicesConfigGroups(serviceNames);
@@ -435,12 +432,6 @@ describe('App.InstallerStep7Controller', function () {
});
describe('#getConfigTags', function () {
- before(function () {
- sinon.stub(App.ajax, 'send', Em.K);
- });
- after(function () {
- App.ajax.send.restore();
- });
it('should do ajax-request', function () {
installerStep7Controller.getConfigTags();
expect(App.ajax.send.calledOnce).to.equal(true);
@@ -476,7 +467,8 @@ describe('App.InstallerStep7Controller', function () {
describe('#checkMySQLHost', function () {
it('should send query', function () {
- expect(installerStep7Controller.checkMySQLHost().readyState).to.equal(1);
+ installerStep7Controller.checkMySQLHost();
+ expect(App.ajax.send.calledOnce).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/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 fc52920..fa57fd5 100644
--- a/ambari-web/test/controllers/wizard/step9_test.js
+++ b/ambari-web/test/controllers/wizard/step9_test.js
@@ -649,11 +649,11 @@ describe('App.InstallerStep9Controller', function () {
jsonError: true
}
]);
- tests.forEach(function (test) {
- it('', function () {
- c.reopen({hosts: test.hosts});
- c.hostHasClientsOnly(test.jsonError);
- test.hosts.forEach(function (host) {
+ tests.forEach(function (test, index1) {
+ test.hosts.forEach(function (host, index2) {
+ it('#test ' + index1 + ' #host ' + index2, function () {
+ c.reopen({hosts: test.hosts});
+ c.hostHasClientsOnly(test.jsonError);
expect(c.get('hosts').findProperty('hostName', host.hostName).get('status')).to.equal(host.e.status);
expect(c.get('hosts').findProperty('hostName', host.hostName).get('progress')).to.equal(host.e.progress);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/mixins/common/table_server_view_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/table_server_view_mixin_test.js b/ambari-web/test/mixins/common/table_server_view_mixin_test.js
index b7b8236..b503ddf 100644
--- a/ambari-web/test/mixins/common/table_server_view_mixin_test.js
+++ b/ambari-web/test/mixins/common/table_server_view_mixin_test.js
@@ -217,14 +217,16 @@ describe('App.MainConfigHistoryView', function() {
describe("#updaterSuccessCb()", function () {
beforeEach(function () {
sinon.stub(view, 'propertyDidChange');
+ view.set('filteringComplete', false);
+ view.updaterSuccessCb();
});
afterEach(function () {
view.propertyDidChange.restore();
});
- it("", function () {
- view.set('filteringComplete', false);
- view.updaterSuccessCb();
+ it('pageContent is forced to be recalculated', function () {
expect(view.propertyDidChange.calledWith('pageContent')).to.be.true;
+ });
+ it('filteringComplete is updated', function () {
expect(view.get('filteringComplete')).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/mixins/common/widget_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/widget_mixin_test.js b/ambari-web/test/mixins/common/widget_mixin_test.js
index 9bb7f70..1c965b8 100644
--- a/ambari-web/test/mixins/common/widget_mixin_test.js
+++ b/ambari-web/test/mixins/common/widget_mixin_test.js
@@ -84,87 +84,98 @@ describe('App.WidgetMixin', function () {
});
describe("#getRequestData()", function () {
- var mixinObject = mixinClass.create();
- it("", function () {
- var data = [
- {
- "name": "regionserver.Server.percentFilesLocal",
- "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
- "service_name": "HBASE",
- "component_name": "HBASE_REGIONSERVER"
- },
- {
- "name": "regionserver.Server.percentFilesLocal2",
- "metric_path": "w2",
- "service_name": "HBASE",
- "component_name": "HBASE_REGIONSERVER"
- },
- {
- "name": "regionserver.Server.percentFilesLocal",
- "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
- "service_name": "HBASE",
- "component_name": "HBASE_REGIONSERVER",
- "host_component_criteria": 'c1'
- },
- {
- "name": "regionserver.Server.percentFilesLocal",
- "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
- "service_name": "HDFS",
- "component_name": "DATANODE",
- "host_component_criteria": 'c1'
- }
- ];
+ var data = [
+ {
+ "name": "regionserver.Server.percentFilesLocal",
+ "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
+ "service_name": "HBASE",
+ "component_name": "HBASE_REGIONSERVER"
+ },
+ {
+ "name": "regionserver.Server.percentFilesLocal2",
+ "metric_path": "w2",
+ "service_name": "HBASE",
+ "component_name": "HBASE_REGIONSERVER"
+ },
+ {
+ "name": "regionserver.Server.percentFilesLocal",
+ "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
+ "service_name": "HBASE",
+ "component_name": "HBASE_REGIONSERVER",
+ "host_component_criteria": 'c1'
+ },
+ {
+ "name": "regionserver.Server.percentFilesLocal",
+ "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
+ "service_name": "HDFS",
+ "component_name": "DATANODE",
+ "host_component_criteria": 'c1'
+ }
+ ];
+
+ beforeEach(function () {
+ this.requestData = mixinClass.create().getRequestData(data);
+ });
- expect(JSON.stringify(mixinObject.getRequestData(data))).to.eql(JSON.stringify({
- "HBASE_HBASE_REGIONSERVER": {
- "name": "regionserver.Server.percentFilesLocal",
- "service_name": "HBASE",
- "component_name": "HBASE_REGIONSERVER",
- "metric_paths": [
- {
- "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
- "metric_type": "POINT_IN_TIME",
- "id": "metrics/hbase/regionserver/percentFilesLocal_POINT_IN_TIME",
- "context": {}
+ it('HBASE_HBASE_REGIONSERVER', function () {
+ var HBASE_HBASE_REGIONSERVER = {
+ "name": "regionserver.Server.percentFilesLocal",
+ "service_name": "HBASE",
+ "component_name": "HBASE_REGIONSERVER",
+ "metric_paths": [
+ {
+ "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
+ "metric_type": "POINT_IN_TIME",
+ "id": "metrics/hbase/regionserver/percentFilesLocal_POINT_IN_TIME",
+ "context": {}
},
- {
- "metric_path": "w2",
- "metric_type": "POINT_IN_TIME",
- "id": "w2_POINT_IN_TIME",
- "context": {}
- }
- ]
- },
- "HBASE_HBASE_REGIONSERVER_c1": {
- "name": "regionserver.Server.percentFilesLocal",
- "service_name": "HBASE",
- "component_name": "HBASE_REGIONSERVER",
- "host_component_criteria": "c1",
- "metric_paths": [
- {
- "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
- "metric_type": "POINT_IN_TIME",
- "id": "metrics/hbase/regionserver/percentFilesLocal_POINT_IN_TIME",
- "context": {}
- }
- ]
- },
- "HDFS_DATANODE_c1": {
- "name": "regionserver.Server.percentFilesLocal",
- "service_name": "HDFS",
- "component_name": "DATANODE",
- "host_component_criteria": "c1",
- "metric_paths": [
- {
- "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
- "metric_type": "POINT_IN_TIME",
- "id": "metrics/hbase/regionserver/percentFilesLocal_POINT_IN_TIME",
- "context": {}
+ {
+ "metric_path": "w2",
+ "metric_type": "POINT_IN_TIME",
+ "id": "w2_POINT_IN_TIME",
+ "context": {}
}
]
- }
- }));
+ };
+ expect(JSON.stringify(this.requestData['HBASE_HBASE_REGIONSERVER'])).to.equal(JSON.stringify(HBASE_HBASE_REGIONSERVER));
});
+
+ it('HBASE_HBASE_REGIONSERVER_c1', function () {
+ var HBASE_HBASE_REGIONSERVER_c1 = {
+ "name": "regionserver.Server.percentFilesLocal",
+ "service_name": "HBASE",
+ "component_name": "HBASE_REGIONSERVER",
+ "host_component_criteria": "c1",
+ "metric_paths": [
+ {
+ "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
+ "metric_type": "POINT_IN_TIME",
+ "id": "metrics/hbase/regionserver/percentFilesLocal_POINT_IN_TIME",
+ "context": {}
+ }
+ ]
+ };
+ expect(JSON.stringify(this.requestData['HBASE_HBASE_REGIONSERVER_c1'])).to.equal(JSON.stringify(HBASE_HBASE_REGIONSERVER_c1));
+ });
+
+ it('HDFS_DATANODE_c1', function () {
+ var HDFS_DATANODE_c1 = {
+ "name": "regionserver.Server.percentFilesLocal",
+ "service_name": "HDFS",
+ "component_name": "DATANODE",
+ "host_component_criteria": "c1",
+ "metric_paths": [
+ {
+ "metric_path": "metrics/hbase/regionserver/percentFilesLocal",
+ "metric_type": "POINT_IN_TIME",
+ "id": "metrics/hbase/regionserver/percentFilesLocal_POINT_IN_TIME",
+ "context": {}
+ }
+ ]
+ };
+ expect(JSON.stringify(this.requestData['HDFS_DATANODE_c1'])).to.equal(JSON.stringify(HDFS_DATANODE_c1));
+ });
+
});
describe("#getServiceComponentMetrics()", function () {
@@ -175,7 +186,7 @@ describe('App.WidgetMixin', function () {
after(function () {
App.ajax.send.restore();
});
- it("", function () {
+ it("valid request is sent", function () {
var request = {
service_name: 'S1',
component_name: 'C1',
@@ -209,7 +220,7 @@ describe('App.WidgetMixin', function () {
describe("#getMetricsSuccessCallback()", function () {
var mixinObject = mixinClass.create();
- it("", function () {
+ it("metric is mapped from provided path", function () {
var data = {
metrics: {
"hbase": {
@@ -241,7 +252,7 @@ describe('App.WidgetMixin', function () {
App.ajax.send.restore();
mixinObject.computeHostComponentCriteria.restore();
});
- it("", function () {
+ it("valid request is sent", function () {
var request = {
component_name: 'C1',
metric_paths: [
@@ -344,18 +355,20 @@ describe('App.WidgetMixin', function () {
describe("#cloneWidget()", function () {
var mixinObject = mixinClass.create();
-
+ var popup;
before(function () {
sinon.spy(App, 'showConfirmationPopup');
sinon.stub(mixinObject, 'postWidgetDefinition', Em.K);
+ popup = mixinObject.cloneWidget();
});
after(function () {
App.showConfirmationPopup.restore();
mixinObject.postWidgetDefinition.restore();
});
- it("", function () {
- var popup = mixinObject.cloneWidget();
+ it("popup is shown", function () {
expect(App.showConfirmationPopup.calledOnce).to.be.true;
+ });
+ it('postWidgetDefinition is called', function () {
popup.onPrimary();
expect(mixinObject.postWidgetDefinition.calledOnce).to.be.true;
});
@@ -372,7 +385,7 @@ describe('App.WidgetMixin', function () {
App.ajax.send.restore();
mixinObject.collectWidgetData.restore();
});
- it("", function () {
+ it("valid request is sent", function () {
mixinObject.postWidgetDefinition();
expect(App.ajax.send.getCall(0).args[0]).to.eql({
name: 'widgets.wizard.add',
@@ -415,7 +428,9 @@ describe('App.WidgetLoadAggregator', function () {
});
describe("#groupRequests()", function () {
- it("", function () {
+ var result;
+
+ beforeEach(function () {
var requests = [
{
startCallName: 'n1',
@@ -466,15 +481,31 @@ describe('App.WidgetLoadAggregator', function () {
})
}
];
- var result = aggregator.groupRequests(requests);
+ result = aggregator.groupRequests(requests);
+ });
+ it("result['n1_C1'].subRequests.length", function () {
expect(result['n1_C1'].subRequests.length).to.equal(1);
+ });
+ it("result['n1_C1'].data.metric_paths.length", function () {
expect(result['n1_C1'].data.metric_paths.length).to.equal(1);
+ });
+ it("result['n1_C1_graph'].subRequests.length", function () {
expect(result['n1_C1_graph'].subRequests.length).to.equal(1);
+ });
+ it("result['n1_C1_graph'].data.metric_paths.length", function () {
expect(result['n1_C1_graph'].data.metric_paths.length).to.equal(1);
+ });
+ it("result['n2_C1'].subRequests.length", function () {
expect(result['n2_C1'].subRequests.length).to.equal(1);
+ });
+ it("result['n2_C1'].data.metric_paths.length", function () {
expect(result['n2_C1'].data.metric_paths.length).to.equal(1);
+ });
+ it("result['n1_C2'].subRequests.length", function () {
expect(result['n1_C2'].subRequests.length).to.equal(1);
+ });
+ it("result['n1_C2'].data.metric_paths.length", function () {
expect(result['n1_C2'].data.metric_paths.length).to.equal(1);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/models/host_component_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/host_component_test.js b/ambari-web/test/models/host_component_test.js
index ef68fb6..4266c3c 100644
--- a/ambari-web/test/models/host_component_test.js
+++ b/ambari-web/test/models/host_component_test.js
@@ -36,53 +36,88 @@ describe('App.HostComponent', function() {
});
describe('#isClient', function() {
- it('', function() {
+
+ beforeEach(function () {
sinon.stub(App.get('components.clients'), 'contains', Em.K);
hc.propertyDidChange('isClient');
hc.get('isClient');
- expect(App.get('components.clients').contains.calledWith('COMP1')).to.be.true;
+ });
+
+ afterEach(function () {
App.get('components.clients').contains.restore();
});
+
+ it('components.clients is called with correct data', function() {
+ expect(App.get('components.clients').contains.calledWith('COMP1')).to.be.true;
+ });
});
describe('#displayName', function() {
- it('', function() {
+
+ beforeEach(function () {
sinon.stub(App.format, 'role', Em.K);
hc.propertyDidChange('displayName');
hc.get('displayName');
- expect(App.format.role.calledWith('COMP1')).to.be.true;
+ });
+
+ afterEach(function () {
App.format.role.restore();
});
+
+ it('App.format.role is called with correct data', function() {
+ expect(App.format.role.calledWith('COMP1')).to.be.true;
+ });
});
describe('#isMaster', function() {
- it('', function() {
+
+ beforeEach(function () {
sinon.stub(App.get('components.masters'), 'contains', Em.K);
hc.propertyDidChange('isMaster');
hc.get('isMaster');
- expect(App.get('components.masters').contains.calledWith('COMP1')).to.be.true;
+ });
+
+ afterEach(function () {
App.get('components.masters').contains.restore();
});
+
+ it('components.masters is called with correct data', function() {
+ expect(App.get('components.masters').contains.calledWith('COMP1')).to.be.true;
+ });
});
describe('#isSlave', function() {
- it('', function() {
+
+ beforeEach(function () {
sinon.stub(App.get('components.slaves'), 'contains', Em.K);
hc.propertyDidChange('isSlave');
hc.get('isSlave');
- expect(App.get('components.slaves').contains.calledWith('COMP1')).to.be.true;
+ });
+
+ afterEach(function () {
App.get('components.slaves').contains.restore();
});
+
+ it('components.slaves is called with correct data', function() {
+ expect(App.get('components.slaves').contains.calledWith('COMP1')).to.be.true;
+ });
});
describe('#isDeletable', function() {
- it('', function() {
+
+ beforeEach(function () {
sinon.stub(App.get('components.deletable'), 'contains', Em.K);
hc.propertyDidChange('isDeletable');
hc.get('isDeletable');
- expect(App.get('components.deletable').contains.calledWith('COMP1')).to.be.true;
+ });
+
+ afterEach(function () {
App.get('components.deletable').contains.restore();
});
+
+ it('components.deletable is called with correct data', function() {
+ expect(App.get('components.deletable').contains.calledWith('COMP1')).to.be.true;
+ });
});
App.TestAliases.testAsComputedIfThenElse(hc, 'passiveTooltip', 'isActive', '', Em.I18n.t('hosts.component.passive.mode'));
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/models/host_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/host_test.js b/ambari-web/test/models/host_test.js
index 9642c41..cbeca12 100644
--- a/ambari-web/test/models/host_test.js
+++ b/ambari-web/test/models/host_test.js
@@ -264,7 +264,7 @@ describe('App.Host', function () {
});
describe('#disksMounted', function () {
- it('', function () {
+ it('depends on diskInfo count', function () {
host1.set('diskInfo', [
{}
]);
@@ -274,7 +274,7 @@ describe('App.Host', function () {
});
describe('#coresFormatted', function () {
- it('', function () {
+ it('depends on cpu, cpuPhysical', function () {
host1.set('cpu', 1);
host1.set('cpuPhysical', 2);
host1.propertyDidChange('coresFormatted');
@@ -298,7 +298,7 @@ describe('App.Host', function () {
});
describe('#diskUsage', function () {
- it('', function () {
+ it('depends on diskTotal, diskUsed', function () {
host1.reopen({
diskUsed: 10
});
@@ -309,13 +309,20 @@ describe('App.Host', function () {
});
describe('#memoryFormatted', function () {
- it('', function () {
- host1.set('memory', 1024);
+
+ beforeEach(function () {
sinon.stub(misc, 'formatBandwidth', Em.K);
+ });
+
+ afterEach(function () {
+ misc.formatBandwidth.restore();
+ });
+
+ it('depends on memory', function () {
+ host1.set('memory', 1024);
host1.propertyDidChange('memoryFormatted');
host1.get('memoryFormatted');
expect(misc.formatBandwidth.calledWith(1048576)).to.be.true;
- misc.formatBandwidth.restore()
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/router_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/router_test.js b/ambari-web/test/router_test.js
index 864cff9..456200f 100644
--- a/ambari-web/test/router_test.js
+++ b/ambari-web/test/router_test.js
@@ -377,7 +377,7 @@ describe('App.Router', function () {
afterEach(function () {
App.ajax.send.restore();
});
- it("", function () {
+ it("valid request is sent", function () {
router.transitionToAdminView();
expect(App.ajax.send.calledWith({
name: 'ambari.service.load_server_version',
@@ -427,7 +427,7 @@ describe('App.Router', function () {
router.transitionTo.restore();
mock.loadAmbariViews.restore();
});
- it("", function () {
+ it("transitionTo called with corrent route", function () {
router.transitionToViews();
expect(mock.loadAmbariViews.calledOnce).to.be.true;
expect(router.transitionTo.calledWith('main.views.index')).to.be.true;
@@ -441,7 +441,7 @@ describe('App.Router', function () {
afterEach(function () {
router.transitionToViews.restore();
});
- it("", function () {
+ it("transitionToViews called once", function () {
router.adminViewInfoErrorCallback();
expect(router.transitionToViews.calledOnce).to.be.true;
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/utils/helper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/helper_test.js b/ambari-web/test/utils/helper_test.js
index 0b4ac90..173ea5f 100644
--- a/ambari-web/test/utils/helper_test.js
+++ b/ambari-web/test/utils/helper_test.js
@@ -432,6 +432,9 @@ describe('utils/helper', function() {
});
describe("#role()", function() {
+ before(function () {
+ App.format.stackRolesMap = {};
+ });
beforeEach(function () {
sinon.stub(App.StackService, 'find').returns([Em.Object.create({
id: 'S1',
@@ -440,16 +443,19 @@ describe('utils/helper', function() {
sinon.stub(App.StackServiceComponent, 'find').returns([Em.Object.create({
id: 'C1',
displayName: 'c1'
- })])
+ })]);
});
afterEach(function () {
App.StackService.find.restore();
App.StackServiceComponent.find.restore();
});
- it("", function() {
- App.format.stackRolesMap = {};
+ it("S1 -> s1", function() {
expect(App.format.role('S1')).to.equal('s1');
+ });
+ it("C1 -> c1", function() {
expect(App.format.role('C1')).to.equal('c1');
+ });
+ it("stackRolesMap is not empty", function() {
expect(App.format.stackRolesMap).to.not.be.empty;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/utils/load_timer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/load_timer_test.js b/ambari-web/test/utils/load_timer_test.js
index 5955fc7..4e84134 100644
--- a/ambari-web/test/utils/load_timer_test.js
+++ b/ambari-web/test/utils/load_timer_test.js
@@ -36,14 +36,14 @@ describe('App.loadTimer', function () {
});
describe("#start()", function() {
- it("", function() {
+ it("time should be cached", function() {
App.loadTimer.start('test');
expect(App.loadTimer.get('timeStampCache')['test']).to.be.an('number');
});
});
describe("#finish()", function() {
- it("", function() {
+ it("timeStampCache is empty", function() {
App.loadTimer.start('test');
expect(App.loadTimer.finish('test')).to.be.not.empty;
expect(App.loadTimer.get('timeStampCache')).to.be.empty;
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/views/common/chart/linear_time_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/chart/linear_time_test.js b/ambari-web/test/views/common/chart/linear_time_test.js
index 1d4e7f4..1d07dbe 100644
--- a/ambari-web/test/views/common/chart/linear_time_test.js
+++ b/ambari-web/test/views/common/chart/linear_time_test.js
@@ -381,7 +381,8 @@ describe('App.ChartLinearTimeView.LoadAggregator', function () {
});
describe("#groupRequests()", function () {
- it("", function () {
+ var result;
+ beforeEach(function () {
var requests = [
{
name: 'r1',
@@ -399,11 +400,18 @@ describe('App.ChartLinearTimeView.LoadAggregator', function () {
fields: ['f3', 'f4']
}
];
- var result = aggregator.groupRequests(requests);
-
+ result = aggregator.groupRequests(requests);
+ });
+ it("result['r1'].subRequests.length", function () {
expect(result['r1'].subRequests.length).to.equal(1);
+ });
+ it("result['r1'].fields.length", function () {
expect(result['r1'].fields.length).to.equal(1);
+ });
+ it("result['r2'].subRequests.length", function () {
expect(result['r2'].subRequests.length).to.equal(2);
+ });
+ it("result['r2'].fields.length", function () {
expect(result['r2'].fields.length).to.equal(3);
});
});
@@ -428,7 +436,7 @@ describe('App.ChartLinearTimeView.LoadAggregator', function () {
App.ajax.send.restore();
aggregator.formatRequestData.restore();
});
- it("", function () {
+ it("valid request is sent", function () {
var context = Em.Object.create({content: {hostName: 'host1'}});
var requests = {
'r1': {
@@ -458,7 +466,7 @@ describe('App.ChartLinearTimeView.LoadAggregator', function () {
App.dateTime.restore();
});
- it("", function () {
+ it("data is formed", function () {
var context = Em.Object.create({timeUnitSeconds: 3600});
var request = {
name: 'r1',
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/views/common/configs/config_history_flow_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/config_history_flow_test.js b/ambari-web/test/views/common/configs/config_history_flow_test.js
index ab3383e..667c7a4 100644
--- a/ambari-web/test/views/common/configs/config_history_flow_test.js
+++ b/ambari-web/test/views/common/configs/config_history_flow_test.js
@@ -236,16 +236,26 @@ describe.skip('App.ConfigHistoryFlowView', function () {
});
describe('#openFullList()', function () {
- it('', function () {
- var event = {
+ var event;
+ beforeEach(function () {
+ event = {
stopPropagation: Em.K
};
sinon.spy(event, 'stopPropagation');
view.openFullList(event);
- expect(event.stopPropagation.calledOnce).to.be.true;
- expect(view.get('showFullList')).to.be.true;
+ });
+
+ afterEach(function () {
event.stopPropagation.restore();
});
+
+ it('stopPropagation is called once', function () {
+ expect(event.stopPropagation.calledOnce).to.be.true;
+ });
+
+ it('stopPropagation is true', function () {
+ expect(view.get('stopPropagation')).to.be.true;
+ });
});
describe('#hideFullList()', function () {
@@ -279,12 +289,19 @@ describe.skip('App.ConfigHistoryFlowView', function () {
});
describe('#didInsertElement()', function () {
- it('', function () {
+
+ beforeEach(function () {
sinon.stub(App, 'tooltip');
view.didInsertElement();
- expect(App.tooltip.calledOnce).to.be.true;
+ });
+
+ afterEach(function () {
App.tooltip.restore();
});
+
+ it('App.tooltip is called on�e', function () {
+ expect(App.tooltip.calledOnce).to.be.true;
+ });
});
describe('#willInsertElement()', function () {
@@ -561,28 +578,37 @@ describe.skip('App.ConfigHistoryFlowView', function () {
});
describe('#sendRevertCall()', function () {
- it('', function () {
+
+ beforeEach(function () {
sinon.stub(App.ajax, 'send', Em.K);
view.sendRevertCall(Em.Object.create());
+ });
- expect(App.ajax.send.calledOnce).to.be.true;
+ afterEach(function () {
App.ajax.send.restore();
});
+
+ it('request is sent', function () {
+ expect(App.ajax.send.calledOnce).to.be.true;
+ });
});
describe('#sendRevertCallSuccess()', function () {
beforeEach(function () {
sinon.spy(view.get('controller'), 'loadStep');
sinon.stub(App.router.get('updateController'), 'updateComponentConfig', Em.K);
+ view.sendRevertCallSuccess();
});
afterEach(function () {
view.get('controller').loadStep.restore();
App.router.get('updateController').updateComponentConfig.restore();
});
- it('', function () {
- view.sendRevertCallSuccess();
+ it('loadStep is called', function () {
expect(view.get('controller').loadStep.calledOnce).to.be.true;
+ });
+
+ it('updateComponentConfig is called', function () {
expect(App.router.get('updateController').updateComponentConfig.calledOnce).to.be.true;
});
});
@@ -629,29 +655,47 @@ describe.skip('App.ConfigHistoryFlowView', function () {
});
describe('#shiftBack()', function () {
- it('', function () {
+
+ beforeEach(function () {
sinon.stub(view, 'decrementProperty', Em.K);
sinon.stub(view, 'adjustFlowView', Em.K);
view.shiftBack();
+ });
- expect(view.decrementProperty.calledWith('startIndex')).to.be.true;
- expect(view.adjustFlowView.calledOnce).to.be.true;
+ afterEach(function () {
view.adjustFlowView.restore();
view.decrementProperty.restore();
});
+
+ it('decrementProperty is called with correct data', function () {
+ expect(view.decrementProperty.calledWith('startIndex')).to.be.true;
+ });
+
+ it('adjustFlowView is called once', function () {
+ expect(view.adjustFlowView.calledOnce).to.be.true;
+ });
});
describe('#shiftForward()', function () {
- it('', function () {
+
+ beforeEach(function () {
sinon.stub(view, 'incrementProperty', Em.K);
sinon.stub(view, 'adjustFlowView', Em.K);
view.shiftForward();
+ });
- expect(view.incrementProperty.calledWith('startIndex')).to.be.true;
- expect(view.adjustFlowView.calledOnce).to.be.true;
+ afterEach(function () {
view.adjustFlowView.restore();
view.incrementProperty.restore();
});
+
+ it('startIndex++', function () {
+ expect(view.incrementProperty.calledWith('startIndex')).to.be.true;
+ });
+
+ it('adjustFlowView is called once', function () {
+ expect(view.adjustFlowView.calledOnce).to.be.true;
+ });
});
describe('#adjustFlowView()', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js b/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
index 90c7fa0..04564a3 100644
--- a/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
+++ b/ambari-web/test/views/common/configs/widgets/time_interval_spinner_view_test.js
@@ -237,7 +237,7 @@ describe('App.TimeIntervalSpinnerView', function () {
}
}
]).forEach(function (test) {
- it('', function () {
+ it(test.e.warn + ' ' + test.e.warnMessage, function () {
view.set('config', test.config);
view.prepareContent();
view.checkErrors();
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/views/common/progress_bar_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/progress_bar_view_test.js b/ambari-web/test/views/common/progress_bar_view_test.js
index 14654fb..1895056 100644
--- a/ambari-web/test/views/common/progress_bar_view_test.js
+++ b/ambari-web/test/views/common/progress_bar_view_test.js
@@ -22,7 +22,7 @@ describe('App.ProgressBarView', function () {
var view = App.ProgressBarView.create();
describe("#progressWidth", function () {
- it("", function () {
+ it("depends on `progress`", function () {
view.set('progress', 1);
view.propertyDidChange('progressWidth');
expect(view.get('progressWidth')).to.equal('width:1%;');
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/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 53c64ec..1c985a1 100644
--- a/ambari-web/test/views/common/quick_link_view_test.js
+++ b/ambari-web/test/views/common/quick_link_view_test.js
@@ -45,7 +45,7 @@ describe('App.QuickViewLinks', function () {
afterEach(function () {
App.router.get.restore();
});
- it("", function () {
+ it("ambariProperties are updated", function () {
expect(quickViewLinks.get('ambariProperties')).to.eql({p: 1});
});
});
@@ -59,22 +59,32 @@ describe('App.QuickViewLinks', function () {
App.router.get.restore();
quickViewLinks.loadQuickLinksConfigurations.restore();
});
- it("", function () {
+ it("loadQuickLinksConfigurations is called once", function () {
quickViewLinks.didInsertElement();
expect(quickViewLinks.loadQuickLinksConfigurations.calledOnce).to.be.true;
});
});
describe("#willDestroyElement()", function () {
- it("", function () {
+
+ beforeEach(function () {
quickViewLinks.setProperties({
configProperties: [{}],
actualTags: [""],
quickLinks: [{}]
});
quickViewLinks.willDestroyElement();
+ });
+
+ it("configProperties empty", function () {
expect(quickViewLinks.get('configProperties')).to.be.empty;
+ });
+
+ it("actualTags empty", function () {
expect(quickViewLinks.get('actualTags')).to.be.empty;
+ });
+
+ it("quickLinks empty", function () {
expect(quickViewLinks.get('quickLinks')).to.be.empty;
});
});
@@ -128,13 +138,6 @@ describe('App.QuickViewLinks', function () {
}
});
sinon.stub(quickViewLinks, 'getQuickLinksHosts');
- });
- afterEach(function () {
- quickViewLinks.setConfigProperties.restore();
- quickViewLinks.getQuickLinksHosts.restore();
-
- });
- it("", function () {
var data = {
Clusters: {
desired_configs: {
@@ -145,11 +148,21 @@ describe('App.QuickViewLinks', function () {
}
};
quickViewLinks.loadTagsSuccess(data);
+ });
+ afterEach(function () {
+ quickViewLinks.setConfigProperties.restore();
+ quickViewLinks.getQuickLinksHosts.restore();
+ });
+ it("actualTags is valid", function () {
expect(quickViewLinks.get('actualTags')[0]).to.eql(Em.Object.create({
siteName: 'site1',
tagName: 'tag1'
}));
+ });
+ it("setConfigProperties is called once", function () {
expect(quickViewLinks.setConfigProperties.calledOnce).to.be.true;
+ });
+ it("getQuickLinksHosts is called once", function () {
expect(quickViewLinks.getQuickLinksHosts.calledOnce).to.be.true;
});
});
@@ -273,7 +286,7 @@ describe('App.QuickViewLinks', function () {
mock.getConfigsByTags.restore();
App.router.get.restore();
});
- it("", function () {
+ it("getConfigsByTags called with correct data", function () {
quickViewLinks.set('actualTags', [{siteName: 'hdfs-site'}]);
quickViewLinks.set('requiredSiteNames', ['hdfs-site']);
quickViewLinks.setConfigProperties();
@@ -282,7 +295,7 @@ describe('App.QuickViewLinks', function () {
});
describe("#setEmptyLinks()", function () {
- it("", function () {
+ it("empty links are set", function () {
quickViewLinks.setEmptyLinks();
expect(quickViewLinks.get('quickLinks')).to.eql([{
label: quickViewLinks.t('quick.links.error.label'),
@@ -293,7 +306,7 @@ describe('App.QuickViewLinks', function () {
});
describe("#processOozieHosts()", function () {
- it("", function () {
+ it("host status is valid", function () {
quickViewLinks.set('content.hostComponents', [Em.Object.create({
componentName: 'OOZIE_SERVER',
workStatus: 'STARTED',
@@ -450,7 +463,7 @@ describe('App.QuickViewLinks', function () {
afterEach(function () {
quickViewLinks.getPublicHostName.restore();
});
- it("", function () {
+ it("public_name from getPublicHostName", function () {
quickViewLinks.set('content.hostComponents', [Em.Object.create({
componentName: 'C1',
hostName: 'host1'
@@ -474,9 +487,9 @@ describe('App.QuickViewLinks', function () {
protocol:{
type:"https",
checks:[
- {property:"yarn.http.policy",
- desired:"HTTPS_ONLY",
- site:"yarn-site"}
+ {property:"yarn.http.policy",
+ desired:"HTTPS_ONLY",
+ site:"yarn-site"}
]
}
},
@@ -492,9 +505,9 @@ describe('App.QuickViewLinks', function () {
protocol:{
type:"http",
checks:[
- {property:"yarn.http.policy",
- desired:"HTTP_ONLY",
- site:"yarn-site"}
+ {property:"yarn.http.policy",
+ desired:"HTTP_ONLY",
+ site:"yarn-site"}
]
}
},
@@ -510,9 +523,9 @@ describe('App.QuickViewLinks', function () {
protocol:{
type:"https",
checks:[
- {property:"yarn.http.policy",
- desired:"HTTPS_ONLY",
- site:"yarn-site"}
+ {property:"yarn.http.policy",
+ desired:"HTTPS_ONLY",
+ site:"yarn-site"}
]
}
},
@@ -528,9 +541,9 @@ describe('App.QuickViewLinks', function () {
protocol:{
type:"http",
checks:[
- {property:"yarn.http.policy",
- desired:"HTTP_ONLY",
- site:"yarn-site"}
+ {property:"yarn.http.policy",
+ desired:"HTTP_ONLY",
+ site:"yarn-site"}
]
}
},
@@ -546,9 +559,9 @@ describe('App.QuickViewLinks', function () {
protocol:{
type:"HTTP_ONLY",
checks:[
- {property:"yarn.http.policy",
- desired:"HTTPS_ONLY",
- site:"yarn-site"}
+ {property:"yarn.http.policy",
+ desired:"HTTPS_ONLY",
+ site:"yarn-site"}
]
}
},
@@ -564,9 +577,9 @@ describe('App.QuickViewLinks', function () {
protocol:{
type:"HTTPS_ONLY",
checks:[
- {property:"yarn.http.policy",
- desired:"HTTPS_ONLY",
- site:"yarn-site"}
+ {property:"yarn.http.policy",
+ desired:"HTTPS_ONLY",
+ site:"yarn-site"}
]
}
},
@@ -584,9 +597,9 @@ describe('App.QuickViewLinks', function () {
protocol:{
type:"https",
checks:[
- {property:"myservice.http.policy",
- desired:"HTTPS_ONLY",
- site:"myservice-site"}
+ {property:"myservice.http.policy",
+ desired:"HTTPS_ONLY",
+ site:"myservice-site"}
]
}
},
@@ -603,23 +616,23 @@ describe('App.QuickViewLinks', function () {
protocol:{
type:"https",
checks:
- [
- {
- "property":"oozie.https.port",
- "desired":"EXIST",
- "site":"oozie-site"
- },
- {
- "property":"oozie.https.keystore.file",
- "desired":"EXIST",
- "site":"oozie-site"
- },
- {
- "property":"oozie.https.keystore.pass",
- "desired":"EXIST",
- "site":"oozie-site"
- }
- ]
+ [
+ {
+ "property":"oozie.https.port",
+ "desired":"EXIST",
+ "site":"oozie-site"
+ },
+ {
+ "property":"oozie.https.keystore.file",
+ "desired":"EXIST",
+ "site":"oozie-site"
+ },
+ {
+ "property":"oozie.https.keystore.pass",
+ "desired":"EXIST",
+ "site":"oozie-site"
+ }
+ ]
}
},
m: "https for oozie (checks for https passed)",
@@ -634,23 +647,23 @@ describe('App.QuickViewLinks', function () {
protocol:{
type:"https",
checks:
- [
- {
- "property":"oozie.https.port",
- "desired":"EXIST",
- "site":"oozie-site"
- },
- {
- "property":"oozie.https.keystore.file",
- "desired":"EXIST",
- "site":"oozie-site"
- },
- {
- "property":"oozie.https.keystore.pass",
- "desired":"EXIST",
- "site":"oozie-site"
- }
- ]
+ [
+ {
+ "property":"oozie.https.port",
+ "desired":"EXIST",
+ "site":"oozie-site"
+ },
+ {
+ "property":"oozie.https.keystore.file",
+ "desired":"EXIST",
+ "site":"oozie-site"
+ },
+ {
+ "property":"oozie.https.keystore.pass",
+ "desired":"EXIST",
+ "site":"oozie-site"
+ }
+ ]
}
},
m: "http for oozie (checks for https did not pass)",
@@ -664,13 +677,13 @@ describe('App.QuickViewLinks', function () {
protocol:{
type:"https",
checks:
- [
- {
- "property":"http.enabled",
- "desired":"false",
- "site":"ranger-site"
- }
- ]
+ [
+ {
+ "property":"http.enabled",
+ "desired":"false",
+ "site":"ranger-site"
+ }
+ ]
}
},
m: "https for ranger (HDP2.2, checks passed)",
@@ -683,13 +696,13 @@ describe('App.QuickViewLinks', function () {
protocol:{
type:"https",
checks:
- [
- {
- "property":"http.enabled",
- "desired":"false",
- "site":"ranger-site"
- }
- ]
+ [
+ {
+ "property":"http.enabled",
+ "desired":"false",
+ "site":"ranger-site"
+ }
+ ]
}
},
m: "http for ranger (HDP2.2, checks for https did not pass)",
@@ -699,28 +712,28 @@ describe('App.QuickViewLinks', function () {
{
serviceName: "RANGER",
configProperties:
- [
- {
- type: 'ranger-admin-site',
- properties: {'ranger.service.http.enabled': 'false', 'ranger.service.https.attrib.ssl.enabled': 'true'}
- },
- ],
+ [
+ {
+ type: 'ranger-admin-site',
+ properties: {'ranger.service.http.enabled': 'false', 'ranger.service.https.attrib.ssl.enabled': 'true'}
+ },
+ ],
quickLinksConfig: {
protocol:{
type:"https",
checks:
- [
- {
- "property":"ranger.service.http.enabled",
- "desired":"false",
- "site":"ranger-admin-site"
- },
- {
- "property":"ranger.service.https.attrib.ssl.enabled",
- "desired":"true",
- "site":"ranger-admin-site"
- }
- ]
+ [
+ {
+ "property":"ranger.service.http.enabled",
+ "desired":"false",
+ "site":"ranger-admin-site"
+ },
+ {
+ "property":"ranger.service.https.attrib.ssl.enabled",
+ "desired":"true",
+ "site":"ranger-admin-site"
+ }
+ ]
}
},
@@ -730,28 +743,28 @@ describe('App.QuickViewLinks', function () {
{
serviceName: "RANGER",
configProperties:
- [
- {
- type: 'ranger-admin-site',
- properties: {'ranger.service.http.enabled': 'true', 'ranger.service.https.attrib.ssl.enabled': 'false'}
- },
- ],
+ [
+ {
+ type: 'ranger-admin-site',
+ properties: {'ranger.service.http.enabled': 'true', 'ranger.service.https.attrib.ssl.enabled': 'false'}
+ },
+ ],
quickLinksConfig: {
protocol:{
type:"https",
checks:
- [
- {
- "property":"ranger.service.http.enabled",
- "desired":"false",
- "site":"ranger-admin-site"
- },
- {
- "property":"ranger.service.https.attrib.ssl.enabled",
- "desired":"true",
- "site":"ranger-admin-site"
- }
- ]
+ [
+ {
+ "property":"ranger.service.http.enabled",
+ "desired":"false",
+ "site":"ranger-admin-site"
+ },
+ {
+ "property":"ranger.service.https.attrib.ssl.enabled",
+ "desired":"true",
+ "site":"ranger-admin-site"
+ }
+ ]
}
},
m: "http for ranger (HDP2.3, checks for https did not pass)",
@@ -780,13 +793,13 @@ describe('App.QuickViewLinks', function () {
'site':'yarn-site'
},
'configProperties':
- [
- {
- 'type': 'yarn-site',
- 'properties': {'yarn.timeline-service.webapp.address': 'c6401.ambari.apache.org:8188'}
- },
- ],
- 'result': '8188',
+ [
+ {
+ 'type': 'yarn-site',
+ 'properties': {'yarn.timeline-service.webapp.address': 'c6401.ambari.apache.org:8188'}
+ },
+ ],
+ 'result': '8188'
}),
Em.Object.create({
@@ -800,13 +813,13 @@ describe('App.QuickViewLinks', function () {
'site':'yarn-site'
},
'configProperties':
- [
- {
- 'type': 'yarn-site',
- 'properties': {'yarn.timeline-service.webapp.https.address': 'c6401.ambari.apache.org:8090'}
- },
- ],
- 'result': '8090',
+ [
+ {
+ 'type': 'yarn-site',
+ 'properties': {'yarn.timeline-service.webapp.https.address': 'c6401.ambari.apache.org:8090'}
+ },
+ ],
+ 'result': '8090'
})
];
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/views/main/admin/highAvailability/nameNode/step3_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/highAvailability/nameNode/step3_view_test.js b/ambari-web/test/views/main/admin/highAvailability/nameNode/step3_view_test.js
index a8870e2..8e42df0 100644
--- a/ambari-web/test/views/main/admin/highAvailability/nameNode/step3_view_test.js
+++ b/ambari-web/test/views/main/admin/highAvailability/nameNode/step3_view_test.js
@@ -42,7 +42,7 @@ describe('App.HighAvailabilityWizardStep3View', function () {
});
describe("#curNameNode", function() {
- it("", function() {
+ it("curNameNode is get from `masterComponentHosts`", function() {
view.set('controller.content.masterComponentHosts', [{
component: 'NAMENODE',
isInstalled: true,
@@ -54,7 +54,7 @@ describe('App.HighAvailabilityWizardStep3View', function () {
});
describe("#addNameNode", function() {
- it("", function() {
+ it("addNameNode is get from `masterComponentHosts`", function() {
view.set('controller.content.masterComponentHosts', [{
component: 'NAMENODE',
isInstalled: false,
@@ -66,7 +66,7 @@ describe('App.HighAvailabilityWizardStep3View', function () {
});
describe("#secondaryNameNode", function() {
- it("", function() {
+ it("secondaryNameNode is get from `masterComponentHosts`", function() {
view.set('controller.content.masterComponentHosts', [{
component: 'SECONDARY_NAMENODE',
hostName: 'host1'
@@ -77,7 +77,7 @@ describe('App.HighAvailabilityWizardStep3View', function () {
});
describe("#journalNodes", function() {
- it("", function() {
+ it("journalNodes is get from `masterComponentHosts`", function() {
view.set('controller.content.masterComponentHosts', [{
component: 'JOURNALNODE',
hostName: 'host1'
http://git-wip-us.apache.org/repos/asf/ambari/blob/1901b395/ambari-web/test/views/main/admin/highAvailability/nameNode/step4_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/highAvailability/nameNode/step4_view_test.js b/ambari-web/test/views/main/admin/highAvailability/nameNode/step4_view_test.js
index c3202f6..b65894e 100644
--- a/ambari-web/test/views/main/admin/highAvailability/nameNode/step4_view_test.js
+++ b/ambari-web/test/views/main/admin/highAvailability/nameNode/step4_view_test.js
@@ -42,7 +42,7 @@ describe('App.HighAvailabilityWizardStep4View', function () {
});
describe("#step4BodyText", function() {
- it("", function() {
+ it("formatted with dependent data", function() {
view.set('controller.content.masterComponentHosts', [{
component: 'NAMENODE',
isInstalled: true,