AMBARI-22161. Unable to ignore service check failures during Upgrade (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a9d26986 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a9d26986 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a9d26986 Branch: refs/heads/branch-feature-AMBARI-14714 Commit: a9d26986d615cee43de6bddca12fd0a23b6526b8 Parents: 388cb41 Author: Alex Antonenko <aantone...@hortonworks.com> Authored: Fri Oct 6 17:10:48 2017 +0300 Committer: Alex Antonenko <aantone...@hortonworks.com> Committed: Fri Oct 6 17:10:48 2017 +0300 ---------------------------------------------------------------------- .../admin/stack_upgrade/upgrade_wizard_view.js | 2 +- .../stack_upgrade/upgrade_wizard_view_test.js | 28 +++++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/a9d26986/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js index e1689c2..87e2adf 100644 --- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js +++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_wizard_view.js @@ -126,7 +126,7 @@ App.upgradeWizardView = Em.View.extend({ var associatedVersion = this.get('controller.upgradeData.Upgrade.associated_version'); var version = associatedVersion && App.RepositoryVersion.find().findProperty('repositoryVersion', associatedVersion); var isPatchOrMaint = version && ( version.get('isPatch') || version.get('isMaint') ); - return failedItem && failedItem.get('skippable') && !isPatchOrMaint; + return failedItem && failedItem.get('skippable') && !(this.get('isFinalizeItem') && isPatchOrMaint); }.property('failedItem'), /** http://git-wip-us.apache.org/repos/asf/ambari/blob/a9d26986/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js index 0107975..a739838 100644 --- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js +++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js @@ -919,20 +919,36 @@ describe('App.upgradeWizardView', function () { beforeEach(function () { view.reopen({'failedItem': Em.Object.create({skippable: true}) }); view.set('controller.upgradeData.Upgrade', {associated_version: '2.1.1'}); + var findResult = [Em.Object.create({repositoryVersion: '2.1.1', isPatch: true})]; + sinon.stub(App.RepositoryVersion, 'find', function(){ + return findResult; + }); + }); + + afterEach(function () { + App.RepositoryVersion.find.restore(); }) it("Should return true if can not find upgrade", function () { view.propertyDidChange('canSkipFailedItem'); - expect(view.get('canSkipFailedItem')).to.be.true + expect(view.get('canSkipFailedItem')).to.be.true; }); - it("Should return false if upgrade is patch or maint", function () { - var findResult = [Em.Object.create({repositoryVersion: '2.1.1', isPatch: true})]; - sinon.stub(App.RepositoryVersion, 'find', function(){ - return findResult; + it("Should return false if upgrade is patch or maint and item is final", function () { + view.reopen({ + isFinalizeItem: true }); view.propertyDidChange('canSkipFailedItem'); expect(view.get('canSkipFailedItem')).to.be.false; - App.RepositoryVersion.find.restore(); + }); + + it("Should return true if upgrade is patch or maint and item is not final", function () { + + view.reopen({ + isFinalizeItem: false + }); + view.propertyDidChange('canSkipFailedItem'); + + expect(view.get('canSkipFailedItem')).to.be.true; }); });