Repository: ambari Updated Branches: refs/heads/trunk 65558a5a6 -> 4fbf172c3
AMBARI-14884: Hawq standby host config should be removed on single node cluster during initial cluster installation (bhuvnesh2703 via jaoki) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4fbf172c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4fbf172c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4fbf172c Branch: refs/heads/trunk Commit: 4fbf172c31e65bab503ab8e0acbfefd2b7a3adbe Parents: 65558a5 Author: Jun Aoki <ja...@apache.org> Authored: Wed Feb 3 15:38:40 2016 -0800 Committer: Jun Aoki <ja...@apache.org> Committed: Wed Feb 3 15:38:40 2016 -0800 ---------------------------------------------------------------------- .../app/controllers/wizard/step7_controller.js | 2 +- .../test/controllers/wizard/step7_test.js | 20 ++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/4fbf172c/ambari-web/app/controllers/wizard/step7_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js index f6b6cb3..011833b 100644 --- a/ambari-web/app/controllers/wizard/step7_controller.js +++ b/ambari-web/app/controllers/wizard/step7_controller.js @@ -699,7 +699,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, App.E if (App.get('isHaEnabled')) this.addHawqConfigsOnNnHa(configs); if (App.get('isRMHaEnabled')) this.addHawqConfigsOnRMHa(configs); } - if (App.get('isSingleNode')) this.removeHawqStandbyHostAddressConfig(configs); + if (Object.keys(this.get('content.hosts')).length === 1) this.removeHawqStandbyHostAddressConfig(configs); return configs }, http://git-wip-us.apache.org/repos/asf/ambari/blob/4fbf172c/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 d4dcb24..8a4a96f 100644 --- a/ambari-web/test/controllers/wizard/step7_test.js +++ b/ambari-web/test/controllers/wizard/step7_test.js @@ -1180,8 +1180,10 @@ describe('App.InstallerStep7Controller', function () { }); - describe('#updateHawqConfigs', function() { - var isSingleNode = false; + describe('#removeHawqStandbyHostAddressConfig', function() { + installerStep7Controller = App.WizardStep7Controller.create({ + content: Em.Object.create({}), + }); var testHawqSiteConfigs = [ { name: 'hawq_standby_address_host', @@ -1194,19 +1196,9 @@ describe('App.InstallerStep7Controller', function () { ]; var oldHawqSiteLength = testHawqSiteConfigs.length; - beforeEach(function () { - sinon.stub(App, 'get', function () { - return isSingleNode; - }); - }); - - afterEach(function () { - App.get.restore() - }); - it('hawq_standby_address_host should be removed on single node cluster', function() { - isSingleNode = true; var hawqSiteConfigs = testHawqSiteConfigs.slice(); + installerStep7Controller.set('content.hosts', {'hostname': 'h1'}); var updatedHawqSiteConfigs = installerStep7Controller.updateHawqConfigs(hawqSiteConfigs); expect(updatedHawqSiteConfigs.length).to.be.equal(oldHawqSiteLength-1); expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_standby_address_host')).to.not.exist; @@ -1214,8 +1206,8 @@ describe('App.InstallerStep7Controller', function () { }); it('hawq_standby_address_host should not be removed on multi node clusters', function() { - isSingleNode = false; var hawqSiteConfigs = testHawqSiteConfigs.slice(); + installerStep7Controller.set('content.hosts', Em.A([{'hostname': 'h1'}, {'hostname': 'h2'}])); var updatedHawqSiteConfigs = installerStep7Controller.updateHawqConfigs(hawqSiteConfigs); expect(updatedHawqSiteConfigs.length).to.be.equal(oldHawqSiteLength); expect(updatedHawqSiteConfigs.findProperty('name', 'hawq_standby_address_host').value).to.be.equal('h2');