slfan1989 commented on code in PR #5876:
URL: https://github.com/apache/hadoop/pull/5876#discussion_r1271379772
##########
hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterSafemode.java:
##########
@@ -141,6 +141,31 @@ public void testRouterExitSafemode()
verifyRouter(RouterServiceState.RUNNING);
}
+ @Test
+ public void testRouterExitSafemodeResetUpTime()
+ throws InterruptedException, IllegalStateException, IOException {
+
+ Calendar calendar = Calendar.getInstance();
+ // Get the future times, add one day to the current date.
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
+ long timestampAfterOneDay = calendar.getTimeInMillis();
+ router.getSafemodeService().setStartupTime(timestampAfterOneDay);
+
+ assertTrue(router.getSafemodeService().isInSafeMode());
+ verifyRouter(RouterServiceState.SAFEMODE);
+
+ // Wait for initial time in milliseconds
+ long interval =
+ conf.getTimeDuration(DFS_ROUTER_SAFEMODE_EXTENSION,
+ TimeUnit.SECONDS.toMillis(2), TimeUnit.MILLISECONDS) +
+ conf.getTimeDuration(DFS_ROUTER_CACHE_TIME_TO_LIVE_MS,
+ TimeUnit.SECONDS.toMillis(1), TimeUnit.MILLISECONDS) * 2;
+ Thread.sleep(interval);
Review Comment:
Use GenericTestUtils.waitFor
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]