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

    https://github.com/apache/spark/pull/3726#discussion_r22276050
  
    --- Diff: 
streaming/src/test/scala/org/apache/spark/streaming/util/WriteAheadLogSuite.scala
 ---
    @@ -182,16 +182,34 @@ class WriteAheadLogSuite extends FunSuite with 
BeforeAndAfter {
       }
     
       test("WriteAheadLogManager - cleanup old logs") {
    +    logCleanUpTest(waitForCompletion = false)
    +  }
    +
    +  test("WriteAheadLogManager - cleanup old logs synchronously") {
    +    logCleanUpTest(waitForCompletion = true)
    +  }
    +
    +  private def logCleanUpTest(waitForCompletion: Boolean): Unit = {
         // Write data with manager, recover with new manager and verify
         val manualClock = new ManualClock
         val dataToWrite = generateRandomData()
         manager = writeDataUsingManager(testDir, dataToWrite, manualClock, 
stopManager = false)
         val logFiles = getLogFilesInDirectory(testDir)
         assert(logFiles.size > 1)
    -    manager.cleanupOldLogs(manualClock.currentTime() / 2)
    -    eventually(timeout(1 second), interval(10 milliseconds)) {
    +
    +    // To avoid code repeat
    +    def cleanUpAndVerify(): Unit = {
    +      manager.cleanupOldLogs(manualClock.currentTime() / 2, 
waitForCompletion)
    --- End diff --
    
    This call should be made only once (as in real use), instead of being 
called multiple times from within a `eventually` block.


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

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

Reply via email to