Github user andrewor14 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11241#discussion_r55767768
  
    --- Diff: 
core/src/test/scala/org/apache/spark/storage/BlockManagerSuite.scala ---
    @@ -1287,6 +1291,84 @@ class BlockManagerSuite extends SparkFunSuite with 
Matchers with BeforeAndAfterE
         assert(store.getSingle("a1").isDefined, "a1 was not in store")
         assert(store.getSingle("a3").isDefined, "a3 was not in store")
       }
    +
    +  test("SPARK-13328: refresh block locations (fetch should fail after 
hitting a threshold)") {
    +    store = makeBlockManager(8000, "executor1")
    +    val mockBlockTransferService =
    +      new 
MockBlockTransferService(conf.getInt("spark.block.failures.beforeLocationRefresh",
 5))
    +
    +    store.putSingle("item", 999L, StorageLevel.MEMORY_ONLY, tellMaster = 
true)
    +
    +    intercept[BlockFetchException] {
    +      store.doGetRemote("item", mockBlockTransferService, asBlockResult = 
false)
    +    }
    +  }
    +
    +  test("SPARK-13328: refresh block locations (fetch should succeed after 
location refresh)") {
    +    val maxFailuresBeforeLocationRefresh =
    +      conf.getInt("spark.block.failures.beforeLocationRefresh", 5)
    +
    +    val mockBlockManagerMaster = mock(classOf[BlockManagerMaster])
    +    val mockBlockTransferService =
    +      new MockBlockTransferService(maxFailuresBeforeLocationRefresh)
    +
    +    // make sure we have more than maxFailuresBeforeLocationRefresh 
locations
    +    // so that we have a chance to do location refresh
    +    val blockManagerIds = (0 to maxFailuresBeforeLocationRefresh)
    +      .map { i => BlockManagerId(s"id-$i", s"host-$i", i + 1) }
    +
    +    
when(mockBlockManagerMaster.getLocations(mc.any[BlockId])).thenReturn(blockManagerIds)
    +
    --- End diff --
    
    style nit: can you remove all these empty blank lines within a test?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to