Explorar o código

HADOOP-9574. Fix for timing issues in the original patch's test-case.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1487722 13f79535-47bb-0310-9956-ffa450edef68
Vinod Kumar Vavilapalli %!s(int64=12) %!d(string=hai) anos
pai
achega
9ae713ef58

+ 5 - 5
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/token/delegation/TestDelegationToken.java

@@ -342,7 +342,7 @@ public class TestDelegationToken {
     }
   }
 
-  @Test
+  @Test(timeout = 10000)
   public void testRollMasterKey() throws Exception {
     TestDelegationTokenSecretManager dtSecretManager = 
       new TestDelegationTokenSecretManager(800,
@@ -375,10 +375,10 @@ public class TestDelegationToken {
         dtSecretManager.retrievePassword(identifier);
       //compare the passwords
       Assert.assertEquals(oldPasswd, newPasswd);
-      // wait for keys to exipire
-      Thread.sleep(2200);
-      Assert.assertTrue(dtSecretManager.isRemoveStoredMasterKeyCalled);
-
+      // wait for keys to expire
+      while(!dtSecretManager.isRemoveStoredMasterKeyCalled) {
+        Thread.sleep(200);
+      }
     } finally {
       dtSecretManager.stopThreads();
     }