Repository: ambari Updated Branches: refs/heads/trunk ac5215815 -> 1a4e7a760
AMBARI-16670: PXF start and service check operations should consider all PXF agents status (Goutam Tadi via mithmatt) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1a4e7a76 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1a4e7a76 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1a4e7a76 Branch: refs/heads/trunk Commit: 1a4e7a760ae2eadf3c6604a73cff6c06c89e6192 Parents: ac52158 Author: Matt <mmat...@pivotal.io> Authored: Sun May 22 13:25:22 2016 -0700 Committer: Matt <mmat...@pivotal.io> Committed: Sun May 22 13:25:22 2016 -0700 ---------------------------------------------------------------------- ambari-web/app/controllers/main/service/item.js | 11 ++++ ambari-web/app/models/host_component.js | 3 +- .../test/controllers/main/service/item_test.js | 61 ++++++++++++++++++-- ambari-web/test/views/main/service/item_test.js | 3 +- 4 files changed, 70 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/1a4e7a76/ambari-web/app/controllers/main/service/item.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js index 77584ba..8396a48 100644 --- a/ambari-web/app/controllers/main/service/item.js +++ b/ambari-web/app/controllers/main/service/item.js @@ -1060,9 +1060,20 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow if (this.get('content.serviceName') == 'HAWQ' && this.get('content.hostComponents').filterProperty('componentName', 'HAWQMASTER').someProperty('workStatus', App.HostComponentStatus.started)) { return false; } + if (this.get('content.serviceName') == 'PXF' && App.HostComponent.find().filterProperty('componentName', 'PXF').someProperty('workStatus', App.HostComponentStatus.started)) { + return false; + } return (this.get('content.healthStatus') != 'green'); }.property('content.healthStatus','isPending', 'App.isHaEnabled'), + isSmokeTestDisabled: function () { + if (this.get('isClientsOnlyService')) return false; + // Disable PXF service check if at least one PXF is down + if (this.get('content.serviceName') === 'PXF') + return App.HostComponent.find().filterProperty('componentName', 'PXF').someProperty('workStatus','INSTALLED'); + return this.get('isStopDisabled'); + }.property('content.serviceName'), + /** * Determine if service has than one service client components */ http://git-wip-us.apache.org/repos/asf/ambari/blob/1a4e7a76/ambari-web/app/models/host_component.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js index 569879f..973b809 100644 --- a/ambari-web/app/models/host_component.js +++ b/ambari-web/app/models/host_component.js @@ -278,6 +278,7 @@ App.HostComponentActionMap = { var HS = ctx.get('controller.content.hostComponents').findProperty('componentName', 'HAWQSTANDBY'); var HMComponent = App.MasterComponent.find('HAWQMASTER'); var HSComponent = App.MasterComponent.find('HAWQSTANDBY'); + return { RESTART_ALL: { action: 'restartAllHostComponents', @@ -290,7 +291,7 @@ App.HostComponentActionMap = { action: 'runSmokeTest', label: Em.I18n.t('services.service.actions.run.smoke'), cssClass: 'icon-thumbs-up-alt', - disabled: ctx.get('controller.isClientsOnlyService') ? false : ctx.get('controller.isStopDisabled') + disabled: ctx.get('controller.isSmokeTestDisabled') }, REFRESH_CONFIGS: { action: 'refreshConfigs', http://git-wip-us.apache.org/repos/asf/ambari/blob/1a4e7a76/ambari-web/test/controllers/main/service/item_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js index 0830d63..cfaf321 100644 --- a/ambari-web/test/controllers/main/service/item_test.js +++ b/ambari-web/test/controllers/main/service/item_test.js @@ -404,7 +404,7 @@ describe('App.MainServiceItemController', function () { }); describe("modal messages", function() { - + beforeEach(function () { sinon.stub(App.StackService, 'find').returns([ Em.Object.create({ @@ -412,7 +412,7 @@ describe('App.MainServiceItemController', function () { displayName: 'HDFS', isInstalled: true, isSelected: true, - requiredServices:["ZOOKEEPER"] + requiredServices:["ZOOKEEPER"] }), Em.Object.create({ serviceName: 'HIVE', @@ -443,7 +443,7 @@ describe('App.MainServiceItemController', function () { }) ]); }); - + it ("should confirm stop if serviceHealth is INSTALLED", function() { mainServiceItemController.startStopPopup(event, "INSTALLED"); expect(Em.I18n.t.calledWith('services.service.stop.confirmMsg')).to.be.ok; @@ -455,14 +455,14 @@ describe('App.MainServiceItemController', function () { expect(Em.I18n.t.calledWith('services.service.start.confirmMsg')).to.be.ok; expect(Em.I18n.t.calledWith('services.service.start.confirmButton')).to.be.ok; }); - + it ("should not display a dependent list if it is to start a service", function() { var _mainServiceItemController = App.MainServiceItemController.create( {content: {serviceName: "HDFS", passiveState:'OFF'}}); _mainServiceItemController.startStopPopup(event, ""); expect(Em.I18n.t.calledWith('services.service.stop.warningMsg.dependent.services')).to.not.be.ok; }); - + describe ("should display dependent list if other services depend on the one to be stopped", function() { beforeEach(function () { var _mainServiceItemController = App.MainServiceItemController.create( @@ -510,7 +510,7 @@ describe('App.MainServiceItemController', function () { expect(this.fullMsg).to.be.equal(this.msg + " " + this.dependencies); }); }); - + afterEach(function () { App.StackService.find.restore(); }); @@ -1007,6 +1007,55 @@ describe('App.MainServiceItemController', function () { }); }); + describe("#isPXFStopDisabled", function () { + + var hostComponentStub; + + before(function () { + hostComponentStub = sinon.stub(App.HostComponent.find(), 'filterProperty'); + }); + after(function () { + hostComponentStub.restore(); + }); + + var tests = [ + { + content: { + serviceName: 'PXF', + }, + isPending: false, + pxfWorkstatus: [{"workStatus": "STARTED"}, {"workStatus": "STARTED"}], + disabled: false, + m: "Enabled because all agents are started." + }, + { + content: { + serviceName: 'PXF', + }, + isPending: false, + pxfWorkstatus: [{"workStatus": "INSTALLED"}, {"workStatus": "STARTED"}], + disabled: false, + m: "Enabled because atleast one agent is started." + }, + { + content: { + serviceName: 'PXF', + }, + isPending: false, + pxfWorkstatus: [{"workStatus": "INSTALLED"}, {"workStatus": "INSTALLED"}], + disabled: true, + m: "Disabled because all PXF agents are down." + } + ]; + tests.forEach(function (test) { + it(test.m, function () { + hostComponentStub.withArgs('componentName', 'PXF').returns(test.pxfWorkstatus); + var mainServiceItemController = App.MainServiceItemController.create({content: test.content, isPending: test.isPending}); + expect(mainServiceItemController.get('isStopDisabled')).to.equal(test.disabled); + }); + }); + }); + describe("#runRebalancer", function () { beforeEach(function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/1a4e7a76/ambari-web/test/views/main/service/item_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/service/item_test.js b/ambari-web/test/views/main/service/item_test.js index f612f2d..ecfa7de 100644 --- a/ambari-web/test/views/main/service/item_test.js +++ b/ambari-web/test/views/main/service/item_test.js @@ -550,7 +550,8 @@ describe('App.MainServiceItemView', function () { }), isSeveralClients: false, clientComponents: [], - isStopDisabled: false + isStopDisabled: false, + isSmokeTestDisabled: false }), mastersExcludedCommands: mastersExcludedCommands, hasConfigTab: hasConfigTab