You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2014/11/23 23:49:13 UTC

[jira] [Comment Edited] (LUCENE-6072) Use mock filesystem in tests

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

Uwe Schindler edited comment on LUCENE-6072 at 11/23/14 10:48 PM:
------------------------------------------------------------------

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


was (Author: thetaphi):
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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org