Repository: ambari
Updated Branches:
  refs/heads/trunk d5d07e767 -> 8ae2c8b7c


AMBARI-14663. Ambari Web UT failure in trunk (App.InstallerStep7Controller) 
(onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8ae2c8b7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8ae2c8b7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8ae2c8b7

Branch: refs/heads/trunk
Commit: 8ae2c8b7c78231a486bdba1bbd7c67e1951521bc
Parents: d5d07e7
Author: Oleg Nechiporenko <onechipore...@apache.org>
Authored: Thu Jan 14 13:07:30 2016 +0200
Committer: Oleg Nechiporenko <onechipore...@apache.org>
Committed: Thu Jan 14 13:07:30 2016 +0200

----------------------------------------------------------------------
 .../test/controllers/wizard/step7_test.js       | 36 ++++++++++++++------
 .../config_recommendation_parser_test.js        | 12 +++----
 .../host_components/install_component_test.js   |  4 +--
 3 files changed, 33 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ae2c8b7/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 d8c4552..b7a48c9 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -108,7 +108,11 @@ function getController() {
 describe('App.InstallerStep7Controller', function () {
 
   beforeEach(function () {
-    sinon.stub(App.ajax, 'send', Em.K);
+    sinon.stub(App.ajax, 'send', function () {
+      return {
+        then: Em.K
+      }
+    });
     sinon.stub(App.config, 'setPreDefinedServiceConfigs', Em.K);
     installerStep7Controller = getController();
   });
@@ -1169,6 +1173,7 @@ describe('App.InstallerStep7Controller', function () {
   });
 
   describe('#updateHawqConfigs', function() {
+    var isSingleNode = false;
     var testHawqSiteConfigs = [
       {
         name: 'hawq_standby_address_host',
@@ -1180,24 +1185,33 @@ 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() {
-      sinon.stub(App, 'get').withArgs('isSingleNode').returns(true);
+      isSingleNode = true;
       var hawqSiteConfigs = testHawqSiteConfigs.slice();
       var updatedHawqSiteConfigs = 
installerStep7Controller.updateHawqConfigs(hawqSiteConfigs);
-      expect(updatedHawqSiteConfigs.length).to.be.eql(oldHawqSiteLength-1);
-      expect(updatedHawqSiteConfigs.findProperty('name', 
'hawq_standby_address_host')).to.be.eql(undefined);
-      expect(updatedHawqSiteConfigs.findProperty('name', 
'hawq_master_address_host').value).to.be.eql('h1');
-      App.get.restore()
+      expect(updatedHawqSiteConfigs.length).to.be.equal(oldHawqSiteLength-1);
+      expect(updatedHawqSiteConfigs.findProperty('name', 
'hawq_standby_address_host')).to.not.exist;
+      expect(updatedHawqSiteConfigs.findProperty('name', 
'hawq_master_address_host').value).to.be.equal('h1');
     });
 
     it('hawq_standby_address_host should not be removed on multi node 
clusters', function() {
-      sinon.stub(App, 'get').withArgs('isSingleNode').returns(false);
+      isSingleNode = false;
       var hawqSiteConfigs = testHawqSiteConfigs.slice();
       var updatedHawqSiteConfigs = 
installerStep7Controller.updateHawqConfigs(hawqSiteConfigs);
-      expect(updatedHawqSiteConfigs.length).to.be.eql(oldHawqSiteLength);
-      expect(updatedHawqSiteConfigs.findProperty('name', 
'hawq_standby_address_host').value).to.be.eql('h2');
-      expect(updatedHawqSiteConfigs.findProperty('name', 
'hawq_master_address_host').value).to.be.eql('h1');
-      App.get.restore();
+      expect(updatedHawqSiteConfigs.length).to.be.equal(oldHawqSiteLength);
+      expect(updatedHawqSiteConfigs.findProperty('name', 
'hawq_standby_address_host').value).to.be.equal('h2');
+      expect(updatedHawqSiteConfigs.findProperty('name', 
'hawq_master_address_host').value).to.be.equal('h1');
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ae2c8b7/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js 
b/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
index 12959f6..e895859 100644
--- a/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
+++ b/ambari-web/test/mixins/common/configs/config_recommendation_parser_test.js
@@ -19,7 +19,7 @@
 var App = require('app');
 
 describe('App.ConfigRecommendationParser', function() {
-  var mixinObject =  Em.Controller.extend(App.ConfigRecommendationParser, {});
+  var mixinObject = Em.Controller.extend(App.ConfigRecommendationParser, {});
   var instanceObject = mixinObject.create({});
 
   var recommendationObject = {
@@ -97,12 +97,12 @@ describe('App.ConfigRecommendationParser', function() {
       });
 
       it('updateBoundariesCallback maximum', function() {
-        expect(instanceObject.updateBoundariesCallback.calledWith({ name: 
'p3',  filename: 'fileName1' },
+        expect(instanceObject.updateBoundariesCallback.calledWith({ name: 
'p3', filename: 'fileName1' },
           'maximum', 100, null)).to.be.true;
       });
 
       it('updateBoundariesCallback minimum', function() {
-        expect(instanceObject.updateBoundariesCallback.calledWith({ name: 
'p3',  filename: 'fileName1' },
+        expect(instanceObject.updateBoundariesCallback.calledWith({ name: 
'p3', filename: 'fileName1' },
           'minimum', 1, null)).to.be.true;
       });
     });
@@ -121,7 +121,7 @@ describe('App.ConfigRecommendationParser', function() {
   });
 
   describe('#addByRecommendations', function(){
-    var recommendationObject = {
+    var _recommendationObject = {
       'file-name': {
         'properties': {
           'p1': 'v1'
@@ -151,7 +151,7 @@ describe('App.ConfigRecommendationParser', function() {
             'name': 'p1',
             'filename': 'file-name'
           }));
-          instanceObject.addByRecommendations(recommendationObject, []);
+          instanceObject.addByRecommendations(_recommendationObject, []);
         });
 
         afterEach(function() {
@@ -316,7 +316,7 @@ describe('App.ConfigRecommendationParser', function() {
       expect(instanceObject._removeConfigByRecommendation.bind(instanceObject, 
null)).to.throw(App.ObjectTypeError);
     });
 
-    it('throws error', function() {
+    it('throws error (2)', function() {
       expect(instanceObject._removeConfigByRecommendation.bind(instanceObject, 
{}, null)).to.throw(App.ArrayTypeError);
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ae2c8b7/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js
----------------------------------------------------------------------
diff --git 
a/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js
 
b/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js
index a6aaa5b..f2e3513 100644
--- 
a/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js
+++ 
b/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js
@@ -56,7 +56,7 @@ describe('App.InstallComponent', function () {
           component: component,
           data: JSON.stringify({
             RequestInfo: {
-              "context": Em.I18n.t('requestInfo.installHostComponent') + " " + 
'c1'
+              "context": Em.I18n.t('requestInfo.installHostComponent') + ' c1'
             },
             Body: {
               host_components: [
@@ -103,7 +103,7 @@ describe('App.InstallComponent', function () {
           componentName: 'C1',
           serviceName: 'S1',
           component: params.component,
-          "context": Em.I18n.t('requestInfo.installNewHostComponent') + " " + 
'c1',
+          "context": Em.I18n.t('requestInfo.installNewHostComponent') + ' c1',
           HostRoles: {
             state: 'INSTALLED'
           },

Reply via email to