[ 
https://issues.apache.org/jira/browse/LUCENE-6072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14222526#comment-14222526
 ] 

Uwe Schindler commented on LUCENE-6072:
---------------------------------------

One small thing: Should FilterFSProver.onClose not be protected instead of 
public?

> Use mock filesystem in tests
> ----------------------------
>
>                 Key: LUCENE-6072
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6072
>             Project: Lucene - Core
>          Issue Type: Test
>            Reporter: Robert Muir
>         Attachments: LUCENE-6072.patch, LUCENE-6072.patch, LUCENE-6072.patch
>
>
> We went through the trouble to convert to NIO.2, but we don't take advantage 
> of it in tests...
> Since everything boils down to LuceneTestCase's temp dir (which is just 
> Path), we can wrap the filesystem with useful stuff:
> * detect file handle leaks (better than mockdir: not just index files)
> * act like windows (don't delete open files, case-insensitivity, etc)
> * verbosity (add what is going on to infostream for debugging)
> I prototyped some of this in a patch. Currently it makes a chain like this:
> {code}
>   private FileSystem initializeFileSystem() {
>     FileSystem fs = FileSystems.getDefault();
>     if (LuceneTestCase.VERBOSE) {
>       fs = new VerboseFS(fs,
>                 new PrintStreamInfoStream(System.out)).getFileSystem(null);
>     }
>     fs = new LeakFS(fs).getFileSystem(null);
>     fs = new WindowsFS(fs).getFileSystem(null);
>     return fs.provider().getFileSystem(URI.create("file:///"));
>   }
> {code}
> Some things to figure out:
> * I don't think we want to wrap all the time (worry about hiding bugs)
> * its currently a bit lenient (e.g. these filesystems allow calling toFile, 
> which can "escape" and allow you to do broken things). But only 2 or 3 tests 
> really need File, so we could fix that.
> * its currently complicated and messy (i blame the jdk api here, but maybe we 
> can simplify it)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to