ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject ambari git commit: AMBARI-12966. Create Unit Tests for "Prompt user to save checkpoint before shutdown HDFS if last checkpoint is too old". (xiwang via yusaku)
Date Wed, 09 Sep 2015 23:58:28 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 34180fb27 -> 55faab3df


AMBARI-12966. Create Unit Tests for "Prompt user to save checkpoint before shutdown HDFS if
last checkpoint is too old". (xiwang via yusaku)


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

Branch: refs/heads/branch-2.1
Commit: 55faab3dfbe6a25c31cbb3582b89242d1eb74011
Parents: 34180fb
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Wed Sep 9 16:57:36 2015 -0700
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Wed Sep 9 16:58:17 2015 -0700

----------------------------------------------------------------------
 .../test/controllers/main/host/details_test.js  | 149 ++++++++
 .../main/service/info/config_test.js            |  30 ++
 .../test/controllers/main/service/item_test.js  | 344 ++++++++++++++++++-
 .../test/controllers/main/service_test.js       |  24 ++
 .../views/main/service/info/summary_test.js     |  56 +++
 5 files changed, 599 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/55faab3d/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index fda3eeb..bb6ac65 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -92,6 +92,21 @@ describe('App.MainHostDetailsController', function () {
       App.showConfirmationPopup.restore();
       controller.sendComponentCommand.restore();
     });
+
+    it('stop NN, should check last NN checkpoint before stop', function () {
+      var event = {
+        context: Em.Object.create({
+          displayName: 'NameNode',
+          componentName: 'NAMENODE'
+        })
+      };
+      sinon.stub(controller, 'checkNnLastCheckpointTime', function() {
+        return true;
+      });
+      controller.stopComponent(event);
+      expect(controller.checkNnLastCheckpointTime.calledOnce).to.equal(true);
+      controller.checkNnLastCheckpointTime.restore();
+    });
   });
 
   describe('#sendComponentCommand()', function () {
@@ -440,6 +455,21 @@ describe('App.MainHostDetailsController', function () {
       popup.onPrimary();
       expect(batchUtils.restartHostComponents.calledOnce).to.be.true;
     });
+
+    it('restart NN, should check last NN checkpoint before restart', function () {
+      var event = {
+        context: Em.Object.create({
+          displayName: 'NameNode',
+          componentName: 'NAMENODE'
+        })
+      };
+      sinon.stub(controller, 'checkNnLastCheckpointTime', function() {
+        return true;
+      });
+      controller.restartComponent(event);
+      expect(controller.checkNnLastCheckpointTime.calledOnce).to.equal(true);
+      controller.checkNnLastCheckpointTime.restore();
+    });
   });
 
   describe('#securityEnabled', function () {
@@ -2882,4 +2912,123 @@ describe('App.MainHostDetailsController', function () {
       expect(controller.loadConfigs.calledWith('loadStormConfigs')).to.be.true;
     });
   });
+
+  describe("#parseNnCheckPointTime", function () {
+    var tests = [
+      {
+        m: "NameNode on this host has JMX data, the last checkpoint time is less than 12
hours ago",
+        data:
+        {
+          "href" : "",
+          "HostRoles" : {
+            "cluster_name" : "c123",
+            "component_name" : "NAMENODE",
+            "host_name" : "c6401.ambari.apache.org"
+          },
+          "metrics" : {
+            "dfs" : {
+              "FSNamesystem" : {
+                "HAState" : "active",
+                "LastCheckpointTime" : 1435775648000
+              }
+            }
+          }
+        },
+        result: false
+      },
+      {
+        m: "NameNode on this host has JMX data, the last checkpoint time is > 12 hours
ago",
+        data:
+        {
+          "href" : "",
+          "HostRoles" : {
+            "cluster_name" : "c123",
+            "component_name" : "NAMENODE",
+            "host_name" : "c6401.ambari.apache.org"
+          },
+          "metrics" : {
+            "dfs" : {
+              "FSNamesystem" : {
+                "HAState" : "active",
+                "LastCheckpointTime" : 1435617248000
+              }
+            }
+          }
+        },
+        result: "c6401.ambari.apache.org"
+      },
+      {
+        m: "NameNode(standby) on this host has JMX data",
+        data:
+        {
+          "href" : "",
+          "HostRoles" : {
+            "cluster_name" : "c123",
+            "component_name" : "NAMENODE",
+            "host_name" : "c6401.ambari.apache.org"
+          },
+          "metrics" : {
+            "dfs" : {
+              "FSNamesystem" : {
+                "HAState" : "standby",
+                "LastCheckpointTime" : 1435617248000
+              }
+            }
+          }
+        },
+        result: false
+      },
+      {
+        m: "NameNode on this host has no JMX data",
+        data:
+        {
+          "href" : "",
+          "HostRoles" : {
+            "cluster_name" : "c123",
+            "component_name" : "NAMENODE",
+            "host_name" : "c6401.ambari.apache.org"
+          },
+          "metrics" : {
+            "dfs" : {
+              "FSNamesystem" : {
+                "HAState" : "active"
+              }
+            }
+          }
+        },
+        result: null
+      },
+      {
+        m: "NameNode on this host has no JMX data",
+        data:
+        {
+          "href" : "",
+          "HostRoles" : {
+            "cluster_name" : "c123",
+            "component_name" : "NAMENODE",
+            "host_name" : "c6401.ambari.apache.org"
+          },
+          "metrics" : {
+          }
+        },
+        result: null
+      }
+    ];
+
+    beforeEach(function () {
+      sinon.stub(App, 'dateTime').returns(1435790048000);
+    });
+
+    afterEach(function () {
+      App.dateTime.restore();
+    });
+
+    tests.forEach(function (test) {
+      it(test.m, function () {
+        var mainHostDetailsController = App.MainHostDetailsController.create({isNNCheckpointTooOld:
null});
+        mainHostDetailsController.parseNnCheckPointTime(test.data);
+        expect(mainHostDetailsController.get('isNNCheckpointTooOld')).to.equal(test.result);
+      });
+    });
+  });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/55faab3d/ambari-web/test/controllers/main/service/info/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js
index cccefa8..6c6c459 100644
--- a/ambari-web/test/controllers/main/service/info/config_test.js
+++ b/ambari-web/test/controllers/main/service/info/config_test.js
@@ -321,6 +321,36 @@ describe("App.MainServiceInfoConfigsController", function () {
       mainServiceInfoConfigsController.restartAllStaleConfigComponents().onPrimary();
       expect(batchUtils.restartAllServiceHostComponents.calledOnce).to.equal(true);
     });
+    it("trigger check last check point warning before triggering restartAllServiceHostComponents",
function () {
+      var mainConfigsControllerHdfsStarted = App.MainServiceInfoConfigsController.create({
+        content: {
+          serviceName: "HDFS",
+          hostComponents: [{
+            componentName: 'NAMENODE',
+            workStatus: 'STARTED'
+          }],
+          restartRequiredHostsAndComponents: {
+            "host1": ['NameNode'],
+            "host2": ['DataNode', 'ZooKeeper']
+          }
+        }
+      });
+      var mainServiceItemController = App.MainServiceItemController.create({});
+      sinon.stub(mainServiceItemController, 'checkNnLastCheckpointTime', function() {
+        return true;
+      });
+      sinon.stub(App.router, 'get', function(k) {
+        if ('mainServiceItemController' === k) {
+          return mainServiceItemController;
+        }
+        return Em.get(App.router, k);
+      });
+
+      mainConfigsControllerHdfsStarted.restartAllStaleConfigComponents();
+      expect(mainServiceItemController.checkNnLastCheckpointTime.calledOnce).to.equal(true);
+      mainServiceItemController.checkNnLastCheckpointTime.restore();
+      App.router.get.restore();
+    });
   });
 
   describe("#doCancel", function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/55faab3d/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index d80d3ff..f27508b 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -398,12 +398,27 @@ describe('App.MainServiceItemController', function () {
         }]
       }
     });
+    var mainServiceItemControllerHdfsStarted = App.MainServiceItemController.create({
+      content: {
+        serviceName: "HDFS",
+        hostComponents: [ {
+          componentName: 'NAMENODE',
+          workStatus: 'STARTED'
+        }]
+      }
+    });
     beforeEach(function () {
       sinon.spy(mainServiceItemController, "startStopPopupPrimary");
+      sinon.spy(mainServiceItemControllerHdfsStarted, "startStopPopupPrimary");
       sinon.spy(Em.I18n, "t");
+      sinon.stub(mainServiceItemControllerHdfsStarted, 'checkNnLastCheckpointTime', function(callback)
{
+        return callback;
+      });
     });
     afterEach(function () {
       mainServiceItemController.startStopPopupPrimary.restore();
+      mainServiceItemControllerHdfsStarted.startStopPopupPrimary.restore();
+      mainServiceItemControllerHdfsStarted.checkNnLastCheckpointTime.restore();
       Em.I18n.t.restore();
     });
     it("start start/stop service popup", function () {
@@ -411,6 +426,11 @@ describe('App.MainServiceItemController', function () {
       expect(mainServiceItemController.startStopPopupPrimary.calledOnce).to.equal(true);
     });
 
+    it ("should popup warning to check last checkpoint time if work status is STARTED", function()
{
+      mainServiceItemControllerHdfsStarted.startStopPopup(event, "INSTALLED");
+      expect(mainServiceItemControllerHdfsStarted.checkNnLastCheckpointTime.calledOnce).to.equal(true);
+    });
+
     describe("modal messages", function() {
       
       beforeEach(function () {
@@ -512,25 +532,50 @@ describe('App.MainServiceItemController', function () {
 
   describe("#restartAllHostComponents", function () {
     var temp = batchUtils.restartAllServiceHostComponents;
+    var mainServiceItemController = App.MainServiceItemController.create({
+      content: {
+        serviceName: "HDFS",
+        hostComponents: [{
+          componentName: 'NAMENODE',
+          workStatus: 'STARTED'
+        }]
+      }
+    });
     beforeEach(function () {
       batchUtils.restartAllServiceHostComponents = Em.K;
       sinon.spy(batchUtils, "restartAllServiceHostComponents");
       sinon.stub(App.Service, 'find', function() {
         return Em.Object.create({serviceTypes: []});
       });
+      sinon.stub(mainServiceItemController, 'checkNnLastCheckpointTime', function() {
+        return true;
+      });
     });
     afterEach(function () {
       batchUtils.restartAllServiceHostComponents.restore();
       batchUtils.restartAllServiceHostComponents = temp;
       App.Service.find.restore();
+      mainServiceItemController.checkNnLastCheckpointTime.restore();
     });
 
-    var mainServiceItemController = App.MainServiceItemController.create({content: {displayName:
"HDFS"}});
-
     it("start restartAllHostComponents for service", function () {
-      mainServiceItemController.restartAllHostComponents({}).onPrimary();
+      var controller = App.MainServiceItemController.create({
+        content: {
+          serviceName: "HDFS",
+          hostComponents: [{
+            componentName: 'NAMENODE',
+            workStatus: 'INSTALLED'
+          }]
+        }
+      });
+      controller.restartAllHostComponents({}).onPrimary();
       expect(batchUtils.restartAllServiceHostComponents.calledOnce).to.equal(true);
     });
+
+    it("check last checkpoint time for NameNode before start restartAllHostComponents for
service", function () {
+      mainServiceItemController.restartAllHostComponents({});
+      expect(mainServiceItemController.checkNnLastCheckpointTime.calledOnce).to.equal(true);
+    });
   });
 
   describe("#rollingRestart", function () {
@@ -552,6 +597,297 @@ describe('App.MainServiceItemController', function () {
     });
   });
 
+  describe("#parseNnCheckPointTime", function () {
+    var tests = [
+      {
+        m: "NameNode has JMX data, the last checkpoint time is less than 12 hours ago",
+        data:
+        {"href" : "",
+          "ServiceComponentInfo" : {
+            "cluster_name" : "c123",
+            "component_name" : "NAMENODE",
+            "service_name" : "HDFS"
+          },
+          "host_components" : [
+            {
+              "href" : "",
+              "HostRoles" : {
+                "cluster_name" : "c123",
+                "component_name" : "NAMENODE",
+                "host_name" : "c6401.ambari.apache.org"
+              },
+              "metrics" : {
+                "dfs" : {
+                  "FSNamesystem" : {
+                    "HAState" : "active",
+                    "LastCheckpointTime" : 1435775648000
+                  }
+                }
+              }
+            }
+          ]
+        },
+        result: false
+      },
+      {
+        m: "NameNode has JMX data, the last checkpoint time is > 12 hours ago",
+        data:
+          {"href" : "",
+            "ServiceComponentInfo" : {
+              "cluster_name" : "c123",
+              "component_name" : "NAMENODE",
+              "service_name" : "HDFS"
+            },
+            "host_components" : [
+              {
+                "href" : "",
+                "HostRoles" : {
+                  "cluster_name" : "c123",
+                  "component_name" : "NAMENODE",
+                  "host_name" : "c6401.ambari.apache.org"
+                },
+                "metrics" : {
+                  "dfs" : {
+                    "FSNamesystem" : {
+                      "HAState" : "active",
+                      "LastCheckpointTime" : 1435617248000
+                    }
+                  }
+                }
+              }
+            ]
+          },
+        result: "c6401.ambari.apache.org"
+      },
+      {
+        m: "NameNode has no JMX data available",
+        data:
+        {"href" : "",
+          "ServiceComponentInfo" : {
+            "cluster_name" : "c123",
+            "component_name" : "NAMENODE",
+            "service_name" : "HDFS"
+          },
+          "host_components" : [
+            {
+              "href" : "",
+              "HostRoles" : {
+                "cluster_name" : "c123",
+                "component_name" : "NAMENODE",
+                "host_name" : "c6401.ambari.apache.org"
+              },
+              "metrics" : {
+                "dfs" : {
+                  "FSNamesystem" : {
+                    "HAState" : "active"
+                  }
+                }
+              }
+            }
+          ]
+        },
+        result: null
+      },
+      {
+        m: "HA enabled, both active and standby NN has JMX data normally.",
+        data:
+        {"href" : "",
+          "ServiceComponentInfo" : {
+            "cluster_name" : "c123",
+            "component_name" : "NAMENODE",
+            "service_name" : "HDFS"
+          },
+          "host_components" : [
+            {
+              "href" : "",
+              "HostRoles" : {
+                "cluster_name" : "c123",
+                "component_name" : "NAMENODE",
+                "host_name" : "c6401.ambari.apache.org"
+              },
+              "metrics" : {
+                "dfs" : {
+                  "FSNamesystem" : {
+                    "HAState" : "active",
+                    "LastCheckpointTime" : 1435775648000
+                  }
+                }
+              }
+            },
+            {
+              "href" : "",
+              "HostRoles" : {
+                "cluster_name" : "c123",
+                "component_name" : "NAMENODE",
+                "host_name" : "c6402.ambari.apache.org"
+              },
+              "metrics" : {
+                "dfs" : {
+                  "FSNamesystem" : {
+                    "HAState" : "standby",
+                    "LastCheckpointTime" : 1435775648000
+                  }
+                }
+              }
+            }
+          ]
+        },
+        result: false
+      },
+      {
+        m: "HA enabled, both NamoNodes are standby NN",
+        data:
+        {"href" : "",
+          "ServiceComponentInfo" : {
+            "cluster_name" : "c123",
+            "component_name" : "NAMENODE",
+            "service_name" : "HDFS"
+          },
+          "host_components" : [
+            {
+              "href" : "",
+              "HostRoles" : {
+                "cluster_name" : "c123",
+                "component_name" : "NAMENODE",
+                "host_name" : "c6401.ambari.apache.org"
+              },
+              "metrics" : {
+                "dfs" : {
+                  "FSNamesystem" : {
+                    "HAState" : "standby",
+                    "LastCheckpointTime" : 1435775648000
+                  }
+                }
+              }
+            },
+            {
+              "href" : "",
+              "HostRoles" : {
+                "cluster_name" : "c123",
+                "component_name" : "NAMENODE",
+                "host_name" : "c6402.ambari.apache.org"
+              },
+              "metrics" : {
+                "dfs" : {
+                  "FSNamesystem" : {
+                    "HAState" : "standby",
+                    "LastCheckpointTime" : 1435775648000
+                  }
+                }
+              }
+            }
+          ]
+        },
+        result: false
+      },
+      {
+        m: "HA enabled, active NN has no JMX data, use the standby's data",
+        data:
+        {"href" : "",
+          "ServiceComponentInfo" : {
+            "cluster_name" : "c123",
+            "component_name" : "NAMENODE",
+            "service_name" : "HDFS"
+          },
+          "host_components" : [
+            {
+              "href" : "",
+              "HostRoles" : {
+                "cluster_name" : "c123",
+                "component_name" : "NAMENODE",
+                "host_name" : "c6401.ambari.apache.org"
+              },
+              "metrics" : {
+                "dfs" : {
+                  "FSNamesystem" : {
+                    "HAState" : "active"
+                  }
+                }
+              }
+            },
+            {
+              "href" : "",
+              "HostRoles" : {
+                "cluster_name" : "c123",
+                "component_name" : "NAMENODE",
+                "host_name" : "c6402.ambari.apache.org"
+              },
+              "metrics" : {
+                "dfs" : {
+                  "FSNamesystem" : {
+                    "HAState" : "standby",
+                    "LastCheckpointTime" : 1435775648000
+                  }
+                }
+              }
+            }
+          ]
+        },
+        result: false
+      },
+      {
+        m: "HA enabled, both NamoNodes no JMX data",
+        data:
+        {"href" : "",
+          "ServiceComponentInfo" : {
+            "cluster_name" : "c123",
+            "component_name" : "NAMENODE",
+            "service_name" : "HDFS"
+          },
+          "host_components" : [
+            {
+              "href" : "",
+              "HostRoles" : {
+                "cluster_name" : "c123",
+                "component_name" : "NAMENODE",
+                "host_name" : "c6401.ambari.apache.org"
+              },
+              "metrics" : {
+                "dfs" : {
+                  "FSNamesystem" : {
+                    "HAState" : "active"
+                  }
+                }
+              }
+            },
+            {
+              "href" : "",
+              "HostRoles" : {
+                "cluster_name" : "c123",
+                "component_name" : "NAMENODE",
+                "host_name" : "c6402.ambari.apache.org"
+              },
+              "metrics" : {
+                "dfs" : {
+                  "FSNamesystem" : {
+                    "HAState" : "standby"
+                  }
+                }
+              }
+            }
+          ]
+        },
+        result: null
+      }
+    ];
+
+    beforeEach(function () {
+      sinon.stub(App, 'dateTime').returns(1435790048000);
+    });
+
+    afterEach(function () {
+      App.dateTime.restore();
+    });
+
+    tests.forEach(function (test) {
+      it(test.m, function () {
+        var mainServiceItemController = App.MainServiceItemController.create({isNNCheckpointTooOld:
null});
+        mainServiceItemController.parseNnCheckPointTime(test.data);
+        expect(mainServiceItemController.get('isNNCheckpointTooOld')).to.equal(test.result);
+      });
+    });
+  });
+
   describe("#isStartDisabled", function () {
     var tests = [
       {
@@ -587,7 +923,7 @@ describe('App.MainServiceItemController', function () {
     });
   });
 
-  describe("#isSopDisabled", function () {
+  describe("#isStopDisabled", function () {
     var tests = [
       {
         content: {

http://git-wip-us.apache.org/repos/asf/ambari/blob/55faab3d/ambari-web/test/controllers/main/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service_test.js b/ambari-web/test/controllers/main/service_test.js
index 0b3b40c..b228279 100644
--- a/ambari-web/test/controllers/main/service_test.js
+++ b/ambari-web/test/controllers/main/service_test.js
@@ -235,6 +235,30 @@ describe('App.MainServiceController', function () {
       expect(Em.I18n.t.calledWith('services.service.stop.confirmButton')).to.be.ok;
     });
 
+    it ("should check last checkpoint for NN before confirming stop", function() {
+      var mainServiceItemController = App.MainServiceItemController.create({});
+      sinon.stub(mainServiceItemController, 'checkNnLastCheckpointTime', function() {
+        return true;
+      });
+      sinon.stub(App.router, 'get', function(k) {
+        if ('mainServiceItemController' === k) {
+          return mainServiceItemController;
+        }
+        return Em.get(App.router, k);
+      });
+      sinon.stub(App.Service, 'find', function() {
+        return [{
+          serviceName: "HDFS",
+          workStatus: "STARTED"
+        }];
+      });
+      mainServiceController.startStopAllService(event, "INSTALLED");
+      expect(mainServiceItemController.checkNnLastCheckpointTime.calledOnce).to.equal(true);
+      mainServiceItemController.checkNnLastCheckpointTime.restore();
+      App.router.get.restore();
+      App.Service.find.restore();
+    });
+
     it ("should confirm start if state is not INSTALLED", function() {
       mainServiceController.startStopAllService(event, "STARTED");
       expect(Em.I18n.t.calledWith('services.service.startAll.confirmMsg')).to.be.ok;

http://git-wip-us.apache.org/repos/asf/ambari/blob/55faab3d/ambari-web/test/views/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/summary_test.js b/ambari-web/test/views/main/service/info/summary_test.js
index b6ac8d3..1db8c1a 100644
--- a/ambari-web/test/views/main/service/info/summary_test.js
+++ b/ambari-web/test/views/main/service/info/summary_test.js
@@ -19,6 +19,7 @@
 
 var App = require('app');
 require('views/main/service/info/summary');
+var batchUtils = require('utils/batch_scheduled_requests');
 
 describe('App.MainServiceInfoSummaryView', function() {
 
@@ -387,4 +388,59 @@ describe('App.MainServiceInfoSummaryView', function() {
     });
 
   });
+
+  describe("#restartAllStaleConfigComponents", function () {
+    it("trigger restartAllServiceHostComponents", function () {
+      var view = App.MainServiceInfoSummaryView.create({
+        controller: Em.Object.create({
+          content: {
+            serviceName: "HDFS"
+          },
+          getActiveWidgetLayout: Em.K
+        }),
+        service: Em.Object.create({
+          displayName: 'HDFS'
+        })
+      });
+      sinon.stub(batchUtils, "restartAllServiceHostComponents", Em.K);
+      view.restartAllStaleConfigComponents().onPrimary();
+      expect(batchUtils.restartAllServiceHostComponents.calledOnce).to.equal(true);
+      batchUtils.restartAllServiceHostComponents.restore();
+    });
+    it("trigger check last check point warning before triggering restartAllServiceHostComponents",
function () {
+      var view = App.MainServiceInfoSummaryView.create({
+        controller: Em.Object.create({
+          content: {
+            serviceName: "HDFS",
+            hostComponents: [{
+              componentName: 'NAMENODE',
+              workStatus: 'STARTED'
+            }],
+            restartRequiredHostsAndComponents: {
+              "host1": ['NameNode'],
+              "host2": ['DataNode', 'ZooKeeper']
+            }
+          },
+          getActiveWidgetLayout: Em.K
+        }),
+        service: Em.Object.create({
+          displayName: 'HDFS'
+        })
+      });
+      var mainServiceItemController = App.MainServiceItemController.create({});
+      sinon.stub(mainServiceItemController, 'checkNnLastCheckpointTime', function() {
+        return true;
+      });
+      sinon.stub(App.router, 'get', function(k) {
+        if ('mainServiceItemController' === k) {
+          return mainServiceItemController;
+        }
+        return Em.get(App.router, k);
+      });
+      view.restartAllStaleConfigComponents();
+      expect(mainServiceItemController.checkNnLastCheckpointTime.calledOnce).to.equal(true);
+      mainServiceItemController.checkNnLastCheckpointTime.restore();
+      App.router.get.restore();
+    });
+  });
 });
\ No newline at end of file


Mime
View raw message