From db891f51d0b76a199a85c98319764bb115626a47 Mon Sep 17 00:00:00 2001 From: Sangjin Lee Date: Wed, 27 May 2015 20:28:04 -0700 Subject: [PATCH] YARN-3726. Fix TestHBaseTimelineWriterImpl unit test failure by fixing its test data (Vrushali C via sjlee) (cherry picked from commit 4c0b6d73914f2e249795deb292f508177ea54884) --- .../storage/TestHBaseTimelineWriterImpl.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineWriterImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineWriterImpl.java index 48bacd6f66..f999b4d9ab 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineWriterImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/test/java/org/apache/hadoop/yarn/server/timelineservice/storage/TestHBaseTimelineWriterImpl.java @@ -121,12 +121,13 @@ public void testWriteEntityToHBase() throws Exception { TimelineMetric m1 = new TimelineMetric(); m1.setId("MAP_SLOT_MILLIS"); Map metricValues = new HashMap(); - metricValues.put(1429741609000L, 100000000); - metricValues.put(1429742609000L, 200000000); - metricValues.put(1429743609000L, 300000000); - metricValues.put(1429744609000L, 400000000); - metricValues.put(1429745609000L, 50000000000L); - metricValues.put(1429746609000L, 60000000000L); + long ts = System.currentTimeMillis(); + metricValues.put(ts - 120000, 100000000); + metricValues.put(ts - 100000, 200000000); + metricValues.put(ts - 80000, 300000000); + metricValues.put(ts - 60000, 400000000); + metricValues.put(ts - 40000, 50000000000L); + metricValues.put(ts - 20000, 60000000000L); m1.setType(Type.TIME_SERIES); m1.setValues(metricValues); metrics.add(m1); @@ -216,7 +217,7 @@ public void testWriteEntityToHBase() throws Exception { private void checkMetricsTimeseries(List metricCells, TimelineMetric m1) throws IOException { Map timeseries = m1.getValues(); - assertEquals(metricCells.size(), timeseries.size()); + assertEquals(timeseries.size(), metricCells.size()); for (Cell c1 : metricCells) { assertTrue(timeseries.containsKey(c1.getTimestamp())); assertEquals(GenericObjectMapper.read(CellUtil.cloneValue(c1)),