You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2014/02/26 04:11:08 UTC

git commit: AMBARI-4831: After install fails hitting refresh enables Next button. (jaimin)

Repository: ambari
Updated Branches:
  refs/heads/trunk d5d610905 -> adc3fd05a


AMBARI-4831: After install fails hitting refresh enables Next button. (jaimin)


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

Branch: refs/heads/trunk
Commit: adc3fd05af9538a0ed0c655a5b5f854ee0a413f2
Parents: d5d6109
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Tue Feb 25 19:10:35 2014 -0800
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Tue Feb 25 19:10:41 2014 -0800

----------------------------------------------------------------------
 .../app/controllers/wizard/step9_controller.js  |  2 +-
 ambari-web/test/installer/step9_test.js         | 70 +++++++++++++++++---
 ambari-web/test/views/common/table_view_test.js | 13 ++--
 .../decommissionable_test.js                    |  2 +-
 4 files changed, 68 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/adc3fd05/ambari-web/app/controllers/wizard/step9_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js
index b7ad07b..5554fde 100644
--- a/ambari-web/app/controllers/wizard/step9_controller.js
+++ b/ambari-web/app/controllers/wizard/step9_controller.js
@@ -1130,7 +1130,7 @@ App.WizardStep9Controller = Em.Controller.extend({
       if (!App.testMode) {
         App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus);
       }
-    } else {
+    } else if (this.get('content.cluster.status') === 'PENDING') {
       this.launchStartServices();
     }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/adc3fd05/ambari-web/test/installer/step9_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/installer/step9_test.js b/ambari-web/test/installer/step9_test.js
index c8fdeeb..6c255e2 100644
--- a/ambari-web/test/installer/step9_test.js
+++ b/ambari-web/test/installer/step9_test.js
@@ -953,9 +953,11 @@ describe('App.InstallerStep9Controller', function () {
         m: 'Two hosts. Each host has one task QUEUED. Cluster status is INSTALLED'
       }
     ];
-    tests.forEach(function(test) {
-      it(test.m, function() {
-        var controller = App.WizardStep9Controller.create({hosts: test.hosts, content: {cluster:{status: test.cluster.status}}, finishState: function(){return false;}});
+    tests.forEach(function (test) {
+      it(test.m, function () {
+        var controller = App.WizardStep9Controller.create({hosts: test.hosts, content: {cluster: {status: test.cluster.status}}, finishState: function () {
+          return false;
+        }});
         var logTasksChangesCounter = controller.get('logTasksChangesCounter');
         controller.parseHostInfo(test.polledData);
         expect(controller.get('logTasksChangesCounter')).to.equal(logTasksChangesCounter + 1);
@@ -974,10 +976,10 @@ describe('App.InstallerStep9Controller', function () {
     var hosts = [
       Em.Object.create({name: 'host1', status: 'failed', expectedStatus: 'heartbeat_lost'}),
       Em.Object.create({name: 'host2', status: 'info', expectedStatus: 'heartbeat_lost'}),
-      Em.Object.create({name: 'host3',status: 'warning', expectedStatus: 'warning'}),
-      Em.Object.create({name: 'host4',status: 'info', expectedStatus: 'info'})
+      Em.Object.create({name: 'host3', status: 'warning', expectedStatus: 'warning'}),
+      Em.Object.create({name: 'host4', status: 'info', expectedStatus: 'info'})
     ];
-    var jsonData = {
+    var heartbeatLostData = {
       "items": [
         {
           "Hosts": {
@@ -1059,19 +1061,65 @@ describe('App.InstallerStep9Controller', function () {
       ]
     };
 
-    var controller = App.WizardStep9Controller.create({hosts: hosts,content: {controllerName: 'installerController'}});
+    var noHeartbeatLostData = {
+      "items": [
+        {
+          "Hosts": {
+            "cluster_name": "c1",
+            "host_name": "host1",
+            "host_state": "HEALTHY"
+          },
+          "host_components": [
+            {
+              "HostRoles": {
+                "cluster_name": "c1",
+                "component_name": "NAMENODE",
+                "host_name": "host1",
+                "state": "INSTALL_FAILED"
+              }
+            }
+          ]
+        }
+      ]
+    };
+
+
+    var controller = App.WizardStep9Controller.create({hosts: hosts, content: {controllerName: 'installerController'}});
+
     App.testMode = true;
     // Action
-    controller.isAllComponentsInstalledSuccessCallback(jsonData);
+    controller.isAllComponentsInstalledSuccessCallback(heartbeatLostData);
 
-    // Validation
+
+    // Validation  for the status of all hosts.
     controller.get('hosts').forEach(function (test) {
-      var status = jsonData.items.findProperty('Hosts.host_name',test.get('name')).Hosts.host_state;
-      it('Host "' + test.get('name') + '"' + ' with status "' + status +'" ', function () {
+      var status = heartbeatLostData.items.findProperty('Hosts.host_name', test.get('name')).Hosts.host_state;
+      it('Host "' + test.get('name') + '"' + ' with status "' + status + '" ', function () {
         expect(test.get('status')).to.equal(test.get('expectedStatus'));
       });
     });
 
+
+    var hosts = [Em.Object.create({name: 'host1', status: 'failed'})];
+    // When there is no heartbeat lost for any host and cluster failed install task, Refreshing the page should not launch start all services request.
+    // Below transitions are possibilities in this function
+    // PENDING -> INSTALL or PENDING. This transition happens when install all services request is completed successfully.
+    // INSTALL FAILED -> INSTALL FAILED. No transition should happen when install all services request fails and then user hits refresh
+    // Cluster is not expected to enter this function in other states: INSTALLED, START FAILED, STARTED
+
+    var statuses = ['INSTALL FAILED', 'INSTALLED','START FAILED', 'STARTED'];  // Cluster in any of this states should have no effect on the state from this function
+    statuses.forEach(function (priorStatus) {
+      controller.destroy();
+      controller = App.WizardStep9Controller.create({hosts: hosts, content: {controllerName: 'installerController', cluster: {status: priorStatus}},togglePreviousSteps: function(){}});
+      //controller.set('content.cluster.status',status);
+      // Action
+      controller.isAllComponentsInstalledSuccessCallback(noHeartbeatLostData);
+      // Validation for the cluster state.
+      var actualStatus = controller.get('content.cluster.status');
+      it('Cluster state before entering the function "' + priorStatus + '"', function () {
+        expect(actualStatus).to.equal(priorStatus);
+      });
+    });
   })
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/adc3fd05/ambari-web/test/views/common/table_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/table_view_test.js b/ambari-web/test/views/common/table_view_test.js
index a9f47be..769c6b6 100644
--- a/ambari-web/test/views/common/table_view_test.js
+++ b/ambari-web/test/views/common/table_view_test.js
@@ -20,6 +20,7 @@ var App = require('app');
 require('utils/db');
 require('views/common/filter_view');
 require('views/common/sort_view');
+require('mixins/common/userPref');
 require('views/common/table_view');
 
 describe('App.TableView', function () {
@@ -37,7 +38,7 @@ describe('App.TableView', function () {
   describe('#updatePaging', function() {
 
     beforeEach(function() {
-      view = App.TableView.create({
+      view = App.TableView.create(App.UserPref, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -65,7 +66,7 @@ describe('App.TableView', function () {
   describe('#endIndex', function() {
 
     beforeEach(function() {
-      view = App.TableView.create({
+      view = App.TableView.create(App.UserPref, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -107,7 +108,7 @@ describe('App.TableView', function () {
   describe('#pageContent', function() {
 
     beforeEach(function() {
-      view = App.TableView.create({
+      view = App.TableView.create(App.UserPref, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -152,7 +153,7 @@ describe('App.TableView', function () {
   describe('#filtersUsedCalc', function() {
 
     beforeEach(function() {
-      view = App.TableView.create({
+      view = App.TableView.create(App.UserPref, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -186,7 +187,7 @@ describe('App.TableView', function () {
   describe('#nextPage', function() {
 
     beforeEach(function() {
-      view = App.TableView.create({
+      view = App.TableView.create(App.UserPref, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 1,
@@ -226,7 +227,7 @@ describe('App.TableView', function () {
   describe('#previousPage', function() {
 
     beforeEach(function() {
-      view = App.TableView.create({
+      view = App.TableView.create(App.UserPref, {
         controller: Em.Object.create({}),
         displayLength: 10,
         startIndex: 50,

http://git-wip-us.apache.org/repos/asf/ambari/blob/adc3fd05/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js b/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js
index 17adb70..d574729 100644
--- a/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js
+++ b/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js
@@ -19,7 +19,7 @@
 var App = require('app');
 require('models/host_component');
 require('views/main/host/details/host_component_view');
-require('views/main/host/details/host_component_views/decommissionable');
+require('mixins/main/host/details/host_components/decommissionable');
 
 var hostComponentView;