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

    https://github.com/apache/spark/pull/288#discussion_r11222683
  
    --- Diff: core/src/test/scala/org/apache/spark/util/UtilsSuite.scala ---
    @@ -154,5 +154,18 @@ class UtilsSuite extends FunSuite {
         val iterator = Iterator.range(0, 5)
         assert(Utils.getIteratorSize(iterator) === 5L)
       }
    +
    +  test("findOldFiles") {
    +    // create some temporary directories and files
    +    val parent: File = Utils.createTempDir()
    +    val child1: File = Utils.createTempDir(parent.getCanonicalPath) // The 
parent directory has two child directories
    +    val child2: File = Utils.createTempDir(parent.getCanonicalPath)
    +    // set the last modified time of child1 to 10 secs old
    +    child1.setLastModified(System.currentTimeMillis() - (1000 * 10))
    +
    +    val result = Utils.findOldFiles(parent, 5) // find files older than 5 
secs
    +    assert(result.size.equals(1))
    +    assert(result(0).getCanonicalPath.equals(child1.getCanonicalPath))
    +  }
    --- End diff --
    
    It would be good to also test the actual "delete recursively" part. Right 
now if the deleting part fails for some reason this test doesn't catch it.


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

Reply via email to