spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kevinpetersavage <...@git.apache.org>
Subject [GitHub] spark pull request: Spark 5659 Flaky test: o.a.s.streaming.Receive...
Date Tue, 10 Mar 2015 11:10:56 GMT
Github user kevinpetersavage commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4957#discussion_r26113001
  
    --- Diff: streaming/src/test/scala/org/apache/spark/streaming/ReceiverSuite.scala ---
    @@ -161,50 +161,27 @@ class ReceiverSuite extends TestSuiteBase with Timeouts with Serializable
{
         val maxRate = 100
         val conf = new SparkConf().set("spark.streaming.blockInterval", blockInterval.toString).
           set("spark.streaming.receiver.maxRate", maxRate.toString)
    -    val blockGenerator = new BlockGenerator(blockGeneratorListener, 1, conf)
         val expectedBlocks = 20
         val waitTime = expectedBlocks * blockInterval
         val expectedMessages = maxRate * waitTime / 1000
    -    val expectedMessagesPerBlock = maxRate * blockInterval / 1000
    -    val generatedData = new ArrayBuffer[Int]
    +    val generatedData = 0 until expectedMessages
     
         // Generate blocks
         val startTime = System.currentTimeMillis()
    +    val blockGenerator = new BlockGenerator(blockGeneratorListener, 1, conf)
         blockGenerator.start()
    -    var count = 0
    -    while(System.currentTimeMillis - startTime < waitTime) {
    -      blockGenerator.addData(count)
    -      generatedData += count
    -      count += 1
    -      Thread.sleep(1)
    -    }
    +    generatedData.foreach(blockGenerator.addData(_))
         blockGenerator.stop()
    +    val endTime = System.currentTimeMillis()
     
    +    // should have been rate limited
    +    assert(endTime - startTime >= waitTime, "Should have taken longer than the theoretical
minimum time")
    --- End diff --
    
    Thanks :-)


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

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message