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

    https://github.com/apache/spark/pull/6614#discussion_r31857663
  
    --- Diff: 
streaming/src/test/scala/org/apache/spark/streaming/ReceivedBlockHandlerSuite.scala
 ---
    @@ -113,6 +129,78 @@ class ReceivedBlockHandlerSuite
         }
       }
     
    +  test("BlockManagerBasedBlockHandler - count messages MEMORY_ONLY") {
    +    handler = makeBlockManagerBasedBlockHandler(blockManager, 
StorageLevel.MEMORY_ONLY)
    +    val block1 = List.fill(100)(new Array[Byte](100))
    +    val blockId1 = generateBlockId()
    +    val blockStoreResult1 = handler.storeBlock(blockId1, 
IteratorBlock(block1.iterator))
    +    val block2 = collection.mutable.ArrayBuffer.fill(100)(0)
    +    val blockId2 = generateBlockId()
    +    val blockStoreResult2 = handler.storeBlock(blockId2, 
ArrayBufferBlock(block2))
    +    assert(blockStoreResult1.numRecords === 100)
    +    assert(blockStoreResult2.numRecords === 100)
    +  }
    +
    +  test("BlockManagerBasedBlockHandler - count messages DISK_ONLY") {
    +    handler = makeBlockManagerBasedBlockHandler(blockManager, 
StorageLevel.DISK_ONLY)
    +    val block1 = List.fill(100)(new Array[Byte](100))
    +    val blockId1 = generateBlockId()
    +    val blockStoreResult1 = handler.storeBlock(blockId1, 
IteratorBlock(block1.iterator))
    +    val block2 = collection.mutable.ArrayBuffer.fill(100)(0)
    +    val blockId2 = generateBlockId()
    +    val blockStoreResult2 = handler.storeBlock(blockId2, 
ArrayBufferBlock(block2))
    +    assert(blockStoreResult1.numRecords === 100)
    +    assert(blockStoreResult2.numRecords === 100)
    +  }
    +
    +  test("BlockManagerBasedBlockHandler - count messages MEMORY_AND_DISK") {
    +    handler = makeBlockManagerBasedBlockHandler(blockManager, 
StorageLevel.MEMORY_AND_DISK)
    --- End diff --
    
    This is repeated code! Cant these be made into a function which take 
storage level as a parameter? Each of these unit tests then just calls that 
function with appropriate parameters.


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