|
@@ -75,25 +75,34 @@ describe('App.MainHostDetailsController', function () {
|
|
});
|
|
});
|
|
|
|
|
|
describe('#stopComponent()', function () {
|
|
describe('#stopComponent()', function () {
|
|
|
|
+
|
|
|
|
+ beforeEach(function () {
|
|
|
|
+ sinon.stub(App, 'showConfirmationPopup', function (callback) {
|
|
|
|
+ callback();
|
|
|
|
+ });
|
|
|
|
+ sinon.stub(controller, 'checkNnLastCheckpointTime', function (callback) {
|
|
|
|
+ callback();
|
|
|
|
+ });
|
|
|
|
+ sinon.stub(controller, 'sendComponentCommand');
|
|
|
|
+ });
|
|
|
|
+ afterEach(function () {
|
|
|
|
+ App.showConfirmationPopup.restore();
|
|
|
|
+ controller.sendComponentCommand.restore();
|
|
|
|
+ controller.checkNnLastCheckpointTime.restore();
|
|
|
|
+ });
|
|
|
|
+
|
|
it('call sendComponentCommand', function () {
|
|
it('call sendComponentCommand', function () {
|
|
var event = {
|
|
var event = {
|
|
context: Em.Object.create({
|
|
context: Em.Object.create({
|
|
displayName: 'comp'
|
|
displayName: 'comp'
|
|
})
|
|
})
|
|
};
|
|
};
|
|
- sinon.stub(App, 'showConfirmationPopup', function (callback) {
|
|
|
|
- callback();
|
|
|
|
- });
|
|
|
|
- sinon.stub(controller, 'sendComponentCommand');
|
|
|
|
controller.stopComponent(event);
|
|
controller.stopComponent(event);
|
|
expect(App.showConfirmationPopup.calledOnce).to.be.true;
|
|
expect(App.showConfirmationPopup.calledOnce).to.be.true;
|
|
expect(controller.sendComponentCommand.calledWith(Em.Object.create({
|
|
expect(controller.sendComponentCommand.calledWith(Em.Object.create({
|
|
displayName: 'comp'
|
|
displayName: 'comp'
|
|
- })), Em.I18n.t('requestInfo.stopHostComponent') + " comp", App.HostComponentStatus.started).to.be.true;
|
|
|
|
- App.showConfirmationPopup.restore();
|
|
|
|
- controller.sendComponentCommand.restore();
|
|
|
|
|
|
+ })), Em.I18n.t('requestInfo.stopHostComponent') + " comp", App.HostComponentStatus.stopped).to.be.true;
|
|
});
|
|
});
|
|
-
|
|
|
|
it('stop NN, should check last NN checkpoint before stop', function () {
|
|
it('stop NN, should check last NN checkpoint before stop', function () {
|
|
var event = {
|
|
var event = {
|
|
context: Em.Object.create({
|
|
context: Em.Object.create({
|
|
@@ -101,12 +110,24 @@ describe('App.MainHostDetailsController', function () {
|
|
componentName: 'NAMENODE'
|
|
componentName: 'NAMENODE'
|
|
})
|
|
})
|
|
};
|
|
};
|
|
- sinon.stub(controller, 'checkNnLastCheckpointTime', function() {
|
|
|
|
- return true;
|
|
|
|
- });
|
|
|
|
controller.stopComponent(event);
|
|
controller.stopComponent(event);
|
|
- expect(controller.checkNnLastCheckpointTime.calledOnce).to.equal(true);
|
|
|
|
- controller.checkNnLastCheckpointTime.restore();
|
|
|
|
|
|
+ expect(controller.checkNnLastCheckpointTime.calledOnce).to.be.true;
|
|
|
|
+ expect(App.showConfirmationPopup.calledOnce).to.be.true;
|
|
|
|
+ expect(controller.sendComponentCommand.calledWith(event.context, Em.I18n.t('requestInfo.stopHostComponent') + " NameNode", App.HostComponentStatus.stopped)).to.be.true;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe("#pullNnCheckPointTime()", function() {
|
|
|
|
+ it("", function() {
|
|
|
|
+ controller.pullNnCheckPointTime('host1');
|
|
|
|
+ expect(App.ajax.send.calledWith({
|
|
|
|
+ name: 'common.host_component.getNnCheckPointTime',
|
|
|
|
+ sender: controller,
|
|
|
|
+ data: {
|
|
|
|
+ host: 'host1'
|
|
|
|
+ },
|
|
|
|
+ success: 'parseNnCheckPointTime'
|
|
|
|
+ })).to.be.true;
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
@@ -361,7 +382,7 @@ describe('App.MainHostDetailsController', function () {
|
|
});
|
|
});
|
|
|
|
|
|
afterEach(function () {
|
|
afterEach(function () {
|
|
- window.$.restore();
|
|
|
|
|
|
+ jQueryMock.restore();
|
|
App.ModalPopup.show.restore();
|
|
App.ModalPopup.show.restore();
|
|
controller._doDeleteHostComponent.restore();
|
|
controller._doDeleteHostComponent.restore();
|
|
});
|
|
});
|
|
@@ -443,11 +464,14 @@ describe('App.MainHostDetailsController', function () {
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
sinon.spy(App, "showConfirmationPopup");
|
|
sinon.spy(App, "showConfirmationPopup");
|
|
sinon.stub(batchUtils, "restartHostComponents", Em.K);
|
|
sinon.stub(batchUtils, "restartHostComponents", Em.K);
|
|
|
|
+ sinon.stub(controller, 'checkNnLastCheckpointTime', function(callback) {
|
|
|
|
+ callback();
|
|
|
|
+ });
|
|
});
|
|
});
|
|
-
|
|
|
|
afterEach(function () {
|
|
afterEach(function () {
|
|
App.showConfirmationPopup.restore();
|
|
App.showConfirmationPopup.restore();
|
|
batchUtils.restartHostComponents.restore();
|
|
batchUtils.restartHostComponents.restore();
|
|
|
|
+ controller.checkNnLastCheckpointTime.restore();
|
|
});
|
|
});
|
|
|
|
|
|
it('popup should be displayed', function () {
|
|
it('popup should be displayed', function () {
|
|
@@ -464,12 +488,9 @@ describe('App.MainHostDetailsController', function () {
|
|
componentName: 'NAMENODE'
|
|
componentName: 'NAMENODE'
|
|
})
|
|
})
|
|
};
|
|
};
|
|
- sinon.stub(controller, 'checkNnLastCheckpointTime', function() {
|
|
|
|
- return true;
|
|
|
|
- });
|
|
|
|
controller.restartComponent(event);
|
|
controller.restartComponent(event);
|
|
expect(controller.checkNnLastCheckpointTime.calledOnce).to.equal(true);
|
|
expect(controller.checkNnLastCheckpointTime.calledOnce).to.equal(true);
|
|
- controller.checkNnLastCheckpointTime.restore();
|
|
|
|
|
|
+ expect(App.showConfirmationPopup.calledOnce).to.be.true;
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
@@ -568,18 +589,202 @@ describe('App.MainHostDetailsController', function () {
|
|
});
|
|
});
|
|
|
|
|
|
beforeEach(function () {
|
|
beforeEach(function () {
|
|
- sinon.stub(controller, 'showAddComponentPopup', Em.K);
|
|
|
|
|
|
+ sinon.spy(controller, 'showAddComponentPopup');
|
|
|
|
+ sinon.stub(controller, 'installHostComponentCall', Em.K);
|
|
});
|
|
});
|
|
|
|
|
|
afterEach(function () {
|
|
afterEach(function () {
|
|
controller.showAddComponentPopup.restore();
|
|
controller.showAddComponentPopup.restore();
|
|
|
|
+ controller.installHostComponentCall.restore();
|
|
});
|
|
});
|
|
|
|
|
|
it('any CLIENT component', function () {
|
|
it('any CLIENT component', function () {
|
|
|
|
+ controller.set('content.hostName', 'host1');
|
|
var popup = controller.addClientComponent(component);
|
|
var popup = controller.addClientComponent(component);
|
|
expect(controller.showAddComponentPopup.calledOnce).to.be.true;
|
|
expect(controller.showAddComponentPopup.calledOnce).to.be.true;
|
|
|
|
+ popup.onPrimary();
|
|
|
|
+ expect(controller.installHostComponentCall.calledWith('host1', component)).to.be.true;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe("#loadOozieConfigs()", function() {
|
|
|
|
+ it("", function() {
|
|
|
|
+ controller.loadOozieConfigs({Clusters: {
|
|
|
|
+ desired_configs: {
|
|
|
|
+ 'oozie-env': {
|
|
|
|
+ tag: 'tag'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }});
|
|
|
|
+ expect(App.ajax.send.calledWith({
|
|
|
|
+ name: 'admin.get.all_configurations',
|
|
|
|
+ sender: controller,
|
|
|
|
+ data: {
|
|
|
|
+ urlParams: '(type=oozie-env&tag=tag)'
|
|
|
|
+ },
|
|
|
|
+ success: 'onLoadOozieConfigs',
|
|
|
|
+ error: 'onLoadConfigsErrorCallback'
|
|
|
|
+ })).to.be.true;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe("#loadStormConfigs()", function() {
|
|
|
|
+ it("", function() {
|
|
|
|
+ controller.loadStormConfigs({Clusters: {
|
|
|
|
+ desired_configs: {
|
|
|
|
+ 'storm-site': {
|
|
|
|
+ tag: 'tag'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }});
|
|
|
|
+ expect(App.ajax.send.calledWith({
|
|
|
|
+ name: 'admin.get.all_configurations',
|
|
|
|
+ sender: controller,
|
|
|
|
+ data: {
|
|
|
|
+ urlParams: '(type=storm-site&tag=tag)'
|
|
|
|
+ },
|
|
|
|
+ success: 'onLoadStormConfigs'
|
|
|
|
+ })).to.be.true;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe("#onLoadStormConfigs()", function() {
|
|
|
|
+ beforeEach(function () {
|
|
|
|
+ sinon.stub(controller, 'getStormNimbusHosts').returns("host1");
|
|
|
|
+ sinon.stub(controller, 'updateZkConfigs', Em.K);
|
|
|
|
+ sinon.stub(controller, 'saveConfigsBatch', Em.K);
|
|
|
|
+ });
|
|
|
|
+ afterEach(function () {
|
|
|
|
+ controller.getStormNimbusHosts.restore();
|
|
|
|
+ controller.updateZkConfigs.restore();
|
|
|
|
+ controller.saveConfigsBatch.restore();
|
|
|
|
+ });
|
|
|
|
+ it("", function() {
|
|
|
|
+ var data = {items: [
|
|
|
|
+ {
|
|
|
|
+ type: 'storm-site',
|
|
|
|
+ properties: {
|
|
|
|
+ 'nimbus.seeds': ''
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ]};
|
|
|
|
+ controller.set('nimbusHost', 'host2');
|
|
|
|
+ controller.onLoadStormConfigs(data);
|
|
|
|
+ expect(controller.updateZkConfigs.calledWith({'storm-site': {
|
|
|
|
+ 'nimbus.seeds': "'host1'"
|
|
|
|
+ }})).to.be.true;
|
|
|
|
+ expect(controller.saveConfigsBatch.calledWith([
|
|
|
|
+ {
|
|
|
|
+ properties: {
|
|
|
|
+ 'storm-site': {
|
|
|
|
+ 'nimbus.seeds': "'host1'"
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ properties_attributes: {
|
|
|
|
+ 'storm-site': {}
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ], 'NIMBUS', 'host2')).to.be.true;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe("#loadHiveConfigs()", function() {
|
|
|
|
+ it("", function() {
|
|
|
|
+ controller.loadHiveConfigs({Clusters: {
|
|
|
|
+ desired_configs: {
|
|
|
|
+ 'hive-site': {
|
|
|
|
+ tag: 'tag'
|
|
|
|
+ },
|
|
|
|
+ 'webhcat-site': {
|
|
|
|
+ tag: 'tag'
|
|
|
|
+ },
|
|
|
|
+ 'hive-env': {
|
|
|
|
+ tag: 'tag'
|
|
|
|
+ },
|
|
|
|
+ 'core-site': {
|
|
|
|
+ tag: 'tag'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }});
|
|
|
|
+ expect(App.ajax.send.calledWith({
|
|
|
|
+ name: 'admin.get.all_configurations',
|
|
|
|
+ sender: controller,
|
|
|
|
+ data: {
|
|
|
|
+ urlParams: '(type=hive-site&tag=tag)|(type=webhcat-site&tag=tag)|(type=hive-env&tag=tag)|(type=core-site&tag=tag)'
|
|
|
|
+ },
|
|
|
|
+ success: 'onLoadHiveConfigs'
|
|
|
|
+ })).to.be.true;
|
|
});
|
|
});
|
|
|
|
+ });
|
|
|
|
|
|
|
|
+ describe("#loadRangerConfigs()", function() {
|
|
|
|
+ it("", function() {
|
|
|
|
+ controller.loadRangerConfigs({Clusters: {
|
|
|
|
+ desired_configs: {
|
|
|
|
+ 'hdfs-site': {
|
|
|
|
+ tag: 'tag'
|
|
|
|
+ },
|
|
|
|
+ 'kms-env': {
|
|
|
|
+ tag: 'tag'
|
|
|
|
+ },
|
|
|
|
+ 'core-site': {
|
|
|
|
+ tag: 'tag'
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }});
|
|
|
|
+ expect(App.ajax.send.calledWith({
|
|
|
|
+ name: 'admin.get.all_configurations',
|
|
|
|
+ sender: controller,
|
|
|
|
+ data: {
|
|
|
|
+ urlParams: '(type=core-site&tag=tag)|(type=hdfs-site&tag=tag)|(type=kms-env&tag=tag)'
|
|
|
|
+ },
|
|
|
|
+ success: 'onLoadRangerConfigs'
|
|
|
|
+ })).to.be.true;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe("#getRangerKMSServerHosts()", function() {
|
|
|
|
+ beforeEach(function(){
|
|
|
|
+ sinon.stub(App.HostComponent, 'find').returns([{
|
|
|
|
+ componentName: 'RANGER_KMS_SERVER',
|
|
|
|
+ hostName: 'host1'
|
|
|
|
+ }]);
|
|
|
|
+ });
|
|
|
|
+ afterEach(function(){
|
|
|
|
+ App.HostComponent.find.restore();
|
|
|
|
+ });
|
|
|
|
+ it("", function() {
|
|
|
|
+ controller.set('rangerKMSServerHost', 'host2');
|
|
|
|
+ controller.set('content.hostName', 'host1');
|
|
|
|
+ controller.set('deleteRangerKMSServer', true);
|
|
|
|
+ controller.set('fromDeleteHost', true);
|
|
|
|
+ expect(controller.getRangerKMSServerHosts()).to.eql(['host2']);
|
|
|
|
+ expect(controller.get('rangerKMSServerHost')).to.be.empty;
|
|
|
|
+ expect(controller.get('deleteRangerKMSServer')).to.be.false;
|
|
|
|
+ expect(controller.get('fromDeleteHost')).to.be.false;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe("#getStormNimbusHosts()", function() {
|
|
|
|
+ beforeEach(function(){
|
|
|
|
+ sinon.stub(App.HostComponent, 'find').returns([{
|
|
|
|
+ componentName: 'NIMBUS',
|
|
|
|
+ hostName: 'host1'
|
|
|
|
+ }]);
|
|
|
|
+ });
|
|
|
|
+ afterEach(function(){
|
|
|
|
+ App.HostComponent.find.restore();
|
|
|
|
+ });
|
|
|
|
+ it("", function() {
|
|
|
|
+ controller.set('nimbusHost', 'host2');
|
|
|
|
+ controller.set('content.hostName', 'host1');
|
|
|
|
+ controller.set('deleteNimbusHost', true);
|
|
|
|
+ controller.set('fromDeleteHost', true);
|
|
|
|
+ expect(controller.getStormNimbusHosts()).to.eql(['host2']);
|
|
|
|
+ expect(controller.get('nimbusHost')).to.be.empty;
|
|
|
|
+ expect(controller.get('deleteNimbusHost')).to.be.false;
|
|
|
|
+ expect(controller.get('fromDeleteHost')).to.be.false;
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
|
|
describe('#showAddComponentPopup()', function () {
|
|
describe('#showAddComponentPopup()', function () {
|
|
@@ -913,6 +1118,15 @@ describe('App.MainHostDetailsController', function () {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+ it('accumulo-site is present', function () {
|
|
|
|
+ var configs = {'accumulo-site': {}};
|
|
|
|
+ expect(controller.setZKConfigs(configs, 'host1:2181', [])).to.be.true;
|
|
|
|
+ expect(configs).to.eql({
|
|
|
|
+ "accumulo-site": {
|
|
|
|
+ "instance.zookeeper.host": 'host1:2181'
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
it('webhcat-site is present', function () {
|
|
it('webhcat-site is present', function () {
|
|
var configs = {'webhcat-site': {}};
|
|
var configs = {'webhcat-site': {}};
|
|
expect(controller.setZKConfigs(configs, 'host1:2181', [])).to.be.true;
|
|
expect(controller.setZKConfigs(configs, 'host1:2181', [])).to.be.true;
|
|
@@ -1359,6 +1573,7 @@ describe('App.MainHostDetailsController', function () {
|
|
sinon.stub(controller, "doStopAllComponents", Em.K);
|
|
sinon.stub(controller, "doStopAllComponents", Em.K);
|
|
sinon.stub(controller, "doRestartAllComponents", Em.K);
|
|
sinon.stub(controller, "doRestartAllComponents", Em.K);
|
|
sinon.stub(controller, "onOffPassiveModeForHost", Em.K);
|
|
sinon.stub(controller, "onOffPassiveModeForHost", Em.K);
|
|
|
|
+ sinon.stub(controller, "setRackIdForHost", Em.K);
|
|
});
|
|
});
|
|
|
|
|
|
afterEach(function () {
|
|
afterEach(function () {
|
|
@@ -1367,6 +1582,7 @@ describe('App.MainHostDetailsController', function () {
|
|
controller.doStopAllComponents.restore();
|
|
controller.doStopAllComponents.restore();
|
|
controller.doRestartAllComponents.restore();
|
|
controller.doRestartAllComponents.restore();
|
|
controller.onOffPassiveModeForHost.restore();
|
|
controller.onOffPassiveModeForHost.restore();
|
|
|
|
+ controller.setRackIdForHost.restore();
|
|
});
|
|
});
|
|
|
|
|
|
it('"deleteHost" action', function () {
|
|
it('"deleteHost" action', function () {
|
|
@@ -1422,6 +1638,27 @@ describe('App.MainHostDetailsController', function () {
|
|
controller.doAction(option);
|
|
controller.doAction(option);
|
|
expect(controller.onOffPassiveModeForHost.calledWith({action: "onOffPassiveModeForHost"})).to.be.true;
|
|
expect(controller.onOffPassiveModeForHost.calledWith({action: "onOffPassiveModeForHost"})).to.be.true;
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ it('"setRackId" action', function () {
|
|
|
|
+ var option = {context: {action: "setRackId"}};
|
|
|
|
+ controller.doAction(option);
|
|
|
|
+ expect(controller.setRackIdForHost.calledOnce).to.be.true;
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ describe("#setRackIdForHost()", function() {
|
|
|
|
+ beforeEach(function(){
|
|
|
|
+ sinon.stub(hostsManagement, 'setRackInfo', Em.K);
|
|
|
|
+ });
|
|
|
|
+ afterEach(function() {
|
|
|
|
+ hostsManagement.setRackInfo.restore();
|
|
|
|
+ });
|
|
|
|
+ it("", function() {
|
|
|
|
+ controller.set('content.rack', 'rack');
|
|
|
|
+ controller.set('content.hostName', 'host1');
|
|
|
|
+ controller.setRackIdForHost();
|
|
|
|
+ expect(hostsManagement.setRackInfo.calledWith({message: Em.I18n.t('hosts.host.details.setRackId')}, [{hostName: 'host1'}], 'rack')).to.be.true;
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
|
|
describe('#onOffPassiveModeForHost()', function () {
|
|
describe('#onOffPassiveModeForHost()', function () {
|
|
@@ -2118,23 +2355,23 @@ describe('App.MainHostDetailsController', function () {
|
|
sinon.stub(controller, 'isServiceMetricsLoaded', function (callback) {
|
|
sinon.stub(controller, 'isServiceMetricsLoaded', function (callback) {
|
|
callback();
|
|
callback();
|
|
});
|
|
});
|
|
|
|
+ sinon.stub(controller, 'loadConfigs', Em.K);
|
|
});
|
|
});
|
|
|
|
|
|
afterEach(function () {
|
|
afterEach(function () {
|
|
controller.removeHostComponentModel.restore();
|
|
controller.removeHostComponentModel.restore();
|
|
controller.isServiceMetricsLoaded.restore();
|
|
controller.isServiceMetricsLoaded.restore();
|
|
|
|
+ controller.loadConfigs.restore();
|
|
});
|
|
});
|
|
|
|
|
|
it('ZOOKEEPER_SERVER component', function () {
|
|
it('ZOOKEEPER_SERVER component', function () {
|
|
var data = {
|
|
var data = {
|
|
componentName: 'ZOOKEEPER_SERVER'
|
|
componentName: 'ZOOKEEPER_SERVER'
|
|
};
|
|
};
|
|
- sinon.stub(controller, 'loadConfigs', Em.K);
|
|
|
|
controller._doDeleteHostComponentSuccessCallback({}, {}, data);
|
|
controller._doDeleteHostComponentSuccessCallback({}, {}, data);
|
|
expect(controller.get('_deletedHostComponentResult')).to.be.null;
|
|
expect(controller.get('_deletedHostComponentResult')).to.be.null;
|
|
expect(controller.get('fromDeleteZkServer')).to.be.true;
|
|
expect(controller.get('fromDeleteZkServer')).to.be.true;
|
|
expect(controller.loadConfigs.calledOnce).to.be.true;
|
|
expect(controller.loadConfigs.calledOnce).to.be.true;
|
|
- controller.loadConfigs.restore();
|
|
|
|
});
|
|
});
|
|
it('Not ZOOKEEPER_SERVER component', function () {
|
|
it('Not ZOOKEEPER_SERVER component', function () {
|
|
var data = {
|
|
var data = {
|
|
@@ -2153,6 +2390,33 @@ describe('App.MainHostDetailsController', function () {
|
|
controller._doDeleteHostComponentSuccessCallback({}, {}, data);
|
|
controller._doDeleteHostComponentSuccessCallback({}, {}, data);
|
|
expect(controller.removeHostComponentModel.calledWith('COMPONENT', 'h1')).to.be.true;
|
|
expect(controller.removeHostComponentModel.calledWith('COMPONENT', 'h1')).to.be.true;
|
|
});
|
|
});
|
|
|
|
+ it('HIVE_METASTORE component', function () {
|
|
|
|
+ var data = {
|
|
|
|
+ componentName: 'HIVE_METASTORE'
|
|
|
|
+ };
|
|
|
|
+ controller._doDeleteHostComponentSuccessCallback({}, {}, data);
|
|
|
|
+ expect(controller.get('_deletedHostComponentResult')).to.be.null;
|
|
|
|
+ expect(controller.get('deleteHiveMetaStore')).to.be.true;
|
|
|
|
+ expect(controller.loadConfigs.calledWith('loadHiveConfigs')).to.be.true;
|
|
|
|
+ });
|
|
|
|
+ it('NIMBUS component', function () {
|
|
|
|
+ var data = {
|
|
|
|
+ componentName: 'NIMBUS'
|
|
|
|
+ };
|
|
|
|
+ controller._doDeleteHostComponentSuccessCallback({}, {}, data);
|
|
|
|
+ expect(controller.get('_deletedHostComponentResult')).to.be.null;
|
|
|
|
+ expect(controller.get('deleteNimbusHost')).to.be.true;
|
|
|
|
+ expect(controller.loadConfigs.calledWith('loadStormConfigs')).to.be.true;
|
|
|
|
+ });
|
|
|
|
+ it('RANGER_KMS_SERVER component', function () {
|
|
|
|
+ var data = {
|
|
|
|
+ componentName: 'RANGER_KMS_SERVER'
|
|
|
|
+ };
|
|
|
|
+ controller._doDeleteHostComponentSuccessCallback({}, {}, data);
|
|
|
|
+ expect(controller.get('_deletedHostComponentResult')).to.be.null;
|
|
|
|
+ expect(controller.get('deleteRangerKMSServer')).to.be.true;
|
|
|
|
+ expect(controller.loadConfigs.calledWith('loadRangerConfigs')).to.be.true;
|
|
|
|
+ });
|
|
});
|
|
});
|
|
|
|
|
|
describe('#upgradeComponentSuccessCallback()', function () {
|
|
describe('#upgradeComponentSuccessCallback()', function () {
|
|
@@ -3023,4 +3287,48 @@ describe('App.MainHostDetailsController', function () {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
+
|
|
|
|
+ describe("#checkComponentDependencies()", function() {
|
|
|
|
+
|
|
|
|
+ beforeEach(function () {
|
|
|
|
+ this.mock = sinon.stub(App.StackServiceComponent, 'find');
|
|
|
|
+ sinon.stub(App.HostComponent, 'find').returns([{
|
|
|
|
+ hostName: 'host1',
|
|
|
|
+ componentName: 'C1'
|
|
|
|
+ }]);
|
|
|
|
+ });
|
|
|
|
+ afterEach(function () {
|
|
|
|
+ this.mock.restore();
|
|
|
|
+ App.HostComponent.find.restore();
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ it("no dependencies", function () {
|
|
|
|
+ var opt = {scope: '*'};
|
|
|
|
+ this.mock.returns(Em.Object.create({
|
|
|
|
+ dependencies: []
|
|
|
|
+ }));
|
|
|
|
+ expect(controller.checkComponentDependencies('C1', opt)).to.be.empty;
|
|
|
|
+ });
|
|
|
|
+ it("dependecies already installed", function () {
|
|
|
|
+ var opt = {scope: '*', installedComponents: ['C2']};
|
|
|
|
+ this.mock.returns(Em.Object.create({
|
|
|
|
+ dependencies: [{componentName: 'C2'}]
|
|
|
|
+ }));
|
|
|
|
+ expect(controller.checkComponentDependencies('C1', opt)).to.be.empty;
|
|
|
|
+ });
|
|
|
|
+ it("dependecies should be added", function () {
|
|
|
|
+ var opt = {scope: '*', installedComponents: ['C2']};
|
|
|
|
+ this.mock.returns(Em.Object.create({
|
|
|
|
+ dependencies: [{componentName: 'C3'}]
|
|
|
|
+ }));
|
|
|
|
+ expect(controller.checkComponentDependencies('C1', opt)).to.eql(['C3']);
|
|
|
|
+ });
|
|
|
|
+ it("scope is host", function () {
|
|
|
|
+ var opt = {scope: 'host', hostName: 'host1'};
|
|
|
|
+ this.mock.returns(Em.Object.create({
|
|
|
|
+ dependencies: [{componentName: 'C3', scope: 'host'}]
|
|
|
|
+ }));
|
|
|
|
+ expect(controller.checkComponentDependencies('C1', opt)).to.eql(['C3']);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
});
|
|
});
|