ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-19560. Timezone for timestamps in Upgrade History not consistent with Background Operations (onechiporenko)
Date Thu, 19 Jan 2017 13:03:47 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 a29f1499b -> 6061a677e


AMBARI-19560. Timezone for timestamps in Upgrade History not consistent with Background Operations
(onechiporenko)


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

Branch: refs/heads/branch-2.5
Commit: 6061a677ed43cc354715de934789fa1b590897a0
Parents: a29f149
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Thu Jan 19 14:06:17 2017 +0200
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Thu Jan 19 14:06:17 2017 +0200

----------------------------------------------------------------------
 .../admin/stack_upgrade/upgrade_history_view.js |  4 +-
 .../stack_upgrade/upgrade_history_view_test.js  | 76 ++++++++++++++++++--
 2 files changed, 72 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6061a677/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
index 2137f46..5954673 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/upgrade_history_view.js
@@ -133,8 +133,8 @@ App.MainAdminStackUpgradeHistoryView = App.TableView.extend(App.TableServerViewM
       item.setProperties({
         directionLabel: direction,
         upgradeTypeLabel: method ? method.get('displayName') : method,
-        startTimeLabel: App.dateTimeWithTimeZone(item.get('startTime')),
-        endTimeLabel: App.dateTimeWithTimeZone(item.get('endTime')),
+        startTimeLabel: date.startTime(App.dateTimeWithTimeZone(item.get('startTime'))),
+        endTimeLabel: date.startTime(App.dateTimeWithTimeZone(item.get('endTime'))),
         duration: date.durationSummary(item.get('startTime'), item.get('endTime'))
       });
       processedContent.push(item);

http://git-wip-us.apache.org/repos/asf/ambari/blob/6061a677/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
index d68a854..d13ccd5 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_history_view_test.js
@@ -19,7 +19,6 @@
 
 var App = require('app');
 require('views/main/admin/stack_upgrade/upgrade_history_view');
-var testHelpers = require('test/helpers');
 
 describe('App.MainAdminStackUpgradeHistoryView', function () {
   var view;
@@ -64,31 +63,31 @@ describe('App.MainAdminStackUpgradeHistoryView', function () {
     it('All should return all records', function(){
       this.mock.returns(records);
       var filteredResults = view.filterBy('ALL')
-      expect(filteredResults.length == 4).to.be.true
+      expect(filteredResults.length).to.be.equal(4);
     });
 
     it('Filter aborted upgrades', function(){
       this.mock.returns(records);
       var filteredResults = view.filterBy('UPGRADE_ABORTED')
-      expect(filteredResults.length == 1).to.be.true
+      expect(filteredResults.length).to.be.equal(1);
     });
 
     it('Filter completed upgrades', function(){
       this.mock.returns(records);
       var filteredResults = view.filterBy('UPGRADE_COMPLETED')
-      expect(filteredResults.length == 1).to.be.true
+      expect(filteredResults.length).to.be.equal(1);
     });
 
     it('Filter aborted downgrades', function(){
       this.mock.returns(records);
       var filteredResults = view.filterBy('DOWNGRADE_ABORTED')
-      expect(filteredResults.length == 1).to.be.true
+      expect(filteredResults.length).to.be.equal(1);
     });
 
     it('Filter completed downgrades', function(){
       this.mock.returns(records);
       var filteredResults = view.filterBy('DOWNGRADE_COMPLETED')
-      expect(filteredResults.length == 1).to.be.true
+      expect(filteredResults.length).to.be.equal(1);
     });
   });
 
@@ -170,4 +169,69 @@ describe('App.MainAdminStackUpgradeHistoryView', function () {
       expect(view.get('controller').loadStackUpgradeHistoryToModel.calledOnce).to.be.true;
     });
   });
+
+  describe('#processForDisplay', function () {
+
+    var timestamp = 1484698121448;
+
+    var content = [
+      Em.Object.create({
+        direction: 'UPGRADE',
+        upgradeType: 'ROLLING',
+        startTime: timestamp,
+        endTime: timestamp + 3600 * 1000
+      }),
+      Em.Object.create({
+        direction: 'DOWNGRADE',
+        upgradeType: 'HOST_ORDERED',
+        startTime: timestamp,
+        endTime: timestamp + 3600 * 1000 * 2
+      })
+    ];
+
+    var expected = [
+      Em.Object.create({
+        directionLabel: Em.I18n.t('common.upgrade'),
+        upgradeTypeLabel: Em.I18n.t('common.rolling'),
+        duration: '1.00 hours'
+      }),
+      Em.Object.create({
+        directionLabel: Em.I18n.t('common.downgrade'),
+        upgradeTypeLabel: Em.I18n.t('common.hostOrdered'),
+        duration: '2.00 hours'
+      })
+    ];
+
+    var fields = ['directionLabel', 'upgradeTypeLabel', 'duration'];
+
+    var processedContent;
+
+    beforeEach(function () {
+      sinon.stub(App, 'dateTimeWithTimeZone', function (ts) {
+        return ts - 3600 * 1000 * 2
+      });
+      processedContent = view.processForDisplay(content);
+    });
+
+    afterEach(function () {
+      App.dateTimeWithTimeZone.restore();
+    });
+
+    expected.forEach(function (item, index) {
+
+      describe('test #' + (index + 1), function () {
+
+        fields.forEach(function (field) {
+          it('#' + field, function () {
+            expect(processedContent[index].get(field)).to.be.equal(item.get(field));
+          });
+        });
+
+      });
+
+    });
+
+
+  });
+
 });


Mime
View raw message