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

    https://github.com/apache/spark/pull/1165#discussion_r15383242
  
    --- Diff: core/src/test/scala/org/apache/spark/CacheManagerSuite.scala ---
    @@ -52,22 +50,21 @@ class CacheManagerSuite extends FunSuite with 
BeforeAndAfter with EasyMockSugar
       }
     
       test("get uncached rdd") {
    -    expecting {
    -      blockManager.get(RDDBlockId(0, 0)).andReturn(None)
    -      blockManager.put(RDDBlockId(0, 0), ArrayBuffer[Any](1, 2, 3, 4), 
StorageLevel.MEMORY_ONLY,
    -        true).andStubReturn(Seq[(BlockId, BlockStatus)]())
    -    }
    -
    -    whenExecuting(blockManager) {
    -      val context = new TaskContext(0, 0, 0)
    -      val value = cacheManager.getOrCompute(rdd, split, context, 
StorageLevel.MEMORY_ONLY)
    -      assert(value.toList === List(1, 2, 3, 4))
    -    }
    +    // Do not mock this test, because attempting to match Array[Any], 
which is not covariant,
    +    // in blockManager.put is a losing battle. You have been warned.
    +    blockManager = sc.env.blockManager
    +    cacheManager = sc.env.cacheManager
    +    val context = new TaskContext(0, 0, 0)
    +    val computeValue = cacheManager.getOrCompute(rdd, split, context, 
StorageLevel.MEMORY_ONLY)
    +    val getValue = blockManager.get(RDDBlockId(rdd.id, split.index))
    +    assert(computeValue.toList === List(1, 2, 3, 4))
    +    assert(getValue.isDefined, "Block cached from getOrCompute is not 
found!")
    +    assert(getValue.get.data.toArray === List(1, 2, 3, 4))
    --- End diff --
    
    Kind of weird, how can the result of toArray be equal to a List? I guess it 
compares Seqs? Maybe it's better to say toList here


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to