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

    https://github.com/apache/spark/pull/5572#discussion_r28645695
  
    --- Diff: core/src/test/scala/org/apache/spark/CacheManagerSuite.scala ---
    @@ -82,6 +84,33 @@ class CacheManagerSuite extends FunSuite with 
LocalSparkContext with BeforeAndAf
         assert(value.toList === List(5, 6, 7))
       }
     
    +  test("cache remotely block") {
    +    val blockInfo = new TimeStampedHashMap[BlockId, Boolean]
    +    val result = new BlockResult(Array(5, 6, 7).iterator, 
DataReadMethod.Memory, 12)
    +    // mock remotely received block
    +    when(blockManager.get(RDDBlockId(0, 0))).thenReturn(Some(result))
    +    when(blockManager.containsBlockId(RDDBlockId(0, 0)))
    +      .thenReturn(false)
    +    when(blockManager.putArray(RDDBlockId(0, 0), Array(5, 6, 7), 
StorageLevel.MEMORY_ONLY))
    +      .thenThrow(new RuntimeException("putArray"))
    +
    +    assert(blockInfo.contains(RDDBlockId(0, 0)) === false)
    +
    +    val context = new TaskContextImpl(0, 0, 0, 0)
    +    try {
    +      val computeValue =
    +        cacheManager.getOrCompute(rdd, split, context, 
StorageLevel.MEMORY_ONLY, cacheRemote = true)
    +    } catch {
    +      case e: RuntimeException =>
    +        if (e.getMessage().contains("putArray")) {
    +          blockInfo.putIfAbsent(RDDBlockId(0, 0), true)
    +        }
    +    }
    +
    +    // remotely block is cached now
    +    assert(blockInfo.contains(RDDBlockId(0, 0)) === true)
    --- End diff --
    
    Why the `=== true` and not just `assert(blockInfo.contains(RDDBlockId(0, 
0)))`?
    Same above with `=== false`


---
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