From 49570ed05d44f96549c49929f35c1c202556731a Mon Sep 17 00:00:00 2001
From: uncleGen <hustyugm@gmail.com>
Date: Tue, 7 Mar 2017 12:24:53 -0800
Subject: [PATCH] [SPARK-19803][TEST] flaky BlockManagerReplicationSuite test
 failure

## What changes were proposed in this pull request?

200ms may be too short. Give more time for replication to happen and new block be reported to master

## How was this patch tested?

test manully

Author: uncleGen <hustyugm@gmail.com>
Author: dylon <hustyugm@gmail.com>

Closes #17144 from uncleGen/SPARK-19803.
---
 .../spark/storage/BlockManagerReplicationSuite.scala   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/core/src/test/scala/org/apache/spark/storage/BlockManagerReplicationSuite.scala b/core/src/test/scala/org/apache/spark/storage/BlockManagerReplicationSuite.scala
index ccede34b8c..75dc04038d 100644
--- a/core/src/test/scala/org/apache/spark/storage/BlockManagerReplicationSuite.scala
+++ b/core/src/test/scala/org/apache/spark/storage/BlockManagerReplicationSuite.scala
@@ -489,12 +489,12 @@ class BlockManagerProactiveReplicationSuite extends BlockManagerReplicationBehav
       Thread.sleep(200)
     }
 
-    // giving enough time for replication complete and locks released
-    Thread.sleep(500)
-
-    val newLocations = master.getLocations(blockId).toSet
+    val newLocations = eventually(timeout(5 seconds), interval(10 millis)) {
+      val _newLocations = master.getLocations(blockId).toSet
+      assert(_newLocations.size === replicationFactor)
+      _newLocations
+    }
     logInfo(s"New locations : $newLocations")
-    assert(newLocations.size === replicationFactor)
     // there should only be one common block manager between initial and new locations
     assert(newLocations.intersect(blockLocations.toSet).size === 1)
 
-- 
GitLab