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

    https://github.com/apache/spark/pull/7825#discussion_r36199560
  
    --- Diff: 
extras/kinesis-asl/src/test/scala/org/apache/spark/streaming/kinesis/KinesisStreamSuite.scala
 ---
    @@ -74,6 +106,62 @@ class KinesisStreamSuite extends KinesisFunSuite
           "awsAccessKey", "awsSecretKey")
       }
     
    +  test("RDD generation") {
    +    val awsAccessKey = "qqq"
    +    val awsSecretKey = "zzz"
    +    val inputStream = KinesisUtils.createStream(ssc, appName, 
"mySparkStream",
    +      endpointUrl, regionName, InitialPositionInStream.LATEST, Seconds(2),
    +      StorageLevel.MEMORY_AND_DISK_2, awsAccessKey, awsSecretKey)
    +    assert(inputStream.isInstanceOf[KinesisInputDStream])
    +
    +    val kinesisStream = inputStream.asInstanceOf[KinesisInputDStream]
    +    val time = Time(1000)
    +
    +    // Generate block info data for testing
    +    val seqNumRanges1 = SequenceNumberRanges(
    +      SequenceNumberRange("fakeStream", "fakeShardId", "xxx", "yyy"))
    +    val blockId1 = StreamBlockId(kinesisStream.id, 123)
    +    val blockInfo1 = ReceivedBlockInfo(
    +      0, None, Some(seqNumRanges1), new 
BlockManagerBasedStoreResult(blockId1, None))
    +
    +    val seqNumRanges2 = SequenceNumberRanges(
    +      SequenceNumberRange("fakeStream", "fakeShardId", "aaa", "bbb"))
    +    val blockId2 = StreamBlockId(kinesisStream.id, 345)
    +    val blockInfo2 = ReceivedBlockInfo(
    +      0, None, Some(seqNumRanges2), new 
BlockManagerBasedStoreResult(blockId2, None))
    +
    +    // Verify that the generated KinesisBackedBlockRDD has the all the 
right information
    +    val blockInfos = Seq(blockInfo1, blockInfo2)
    +    val nonEmptyRDD = kinesisStream.createBlockRDD(time, blockInfos)
    +    assert(nonEmptyRDD.isInstanceOf[KinesisBackedBlockRDD])
    +    val kinesisRDD = nonEmptyRDD.asInstanceOf[KinesisBackedBlockRDD]
    +    assert(kinesisRDD.regionName === regionName)
    +    assert(kinesisRDD.endpointUrl === endpointUrl)
    +    assert(kinesisRDD.retryTimeoutMs === batchDuration.milliseconds)
    +    assert(kinesisRDD.awsCredentialsOption ===
    +      Some(SerializableAWSCredentials(awsAccessKey, awsSecretKey)))
    +    assert(nonEmptyRDD.partitions.size === blockInfos.size)
    +    assert(nonEmptyRDD.partitions.forall( 
_.isInstanceOf[KinesisBackedBlockRDDPartition]))
    --- End diff --
    
    nit: extra space before `_`


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