Bläddra i källkod

AMBARI-14884: Hawq standby host config should be removed on single node cluster during initial cluster installation (bhuvnesh2703 via jaoki)

Jun Aoki 9 år sedan
förälder
incheckning
4fbf172c31

+ 1 - 1
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
   },
 

+ 6 - 14
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');