Skip to content

Commit

Permalink
HDFS-14029. Sleep in TestLazyPersistFiles should be put into a loop. …
Browse files Browse the repository at this point in the history
…Contributed by Adam Antal.
  • Loading branch information
arp7 committed Oct 25, 2018
1 parent 34b2521 commit 9b899f1
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void testDisableLazyPersistFileScrubber()
/**
* If NN restarted then lazyPersist files should not deleted
*/
@Test
@Test(timeout = 20000)
public void testFileShouldNotDiscardedIfNNRestarted()
throws IOException, InterruptedException, TimeoutException {
getClusterBuilder().setRamDiskReplicaCapacity(2).build();
Expand All @@ -165,13 +165,12 @@ public void testFileShouldNotDiscardedIfNNRestarted()
cluster.restartNameNodes();

// wait for the redundancy monitor to mark the file as corrupt.
Thread.sleep(2 * DFS_NAMENODE_REDUNDANCY_INTERVAL_SECONDS_DEFAULT * 1000);

Long corruptBlkCount = (long) Iterators.size(cluster.getNameNode()
.getNamesystem().getBlockManager().getCorruptReplicaBlockIterator());

// Check block detected as corrupted
assertThat(corruptBlkCount, is(1L));
Long corruptBlkCount;
do {
Thread.sleep(DFS_NAMENODE_REDUNDANCY_INTERVAL_SECONDS_DEFAULT * 1000);
corruptBlkCount = (long) Iterators.size(cluster.getNameNode()
.getNamesystem().getBlockManager().getCorruptReplicaBlockIterator());
} while (corruptBlkCount != 1L);

// Ensure path1 exist.
Assert.assertTrue(fs.exists(path1));
Expand Down

0 comments on commit 9b899f1

Please sign in to comment.