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

Dawid Weiss commented on LUCENE-6431:
-------------------------------------

I see the problem... You'd like to "reset" the state of this thing before every 
test (and likely after, for hook methods) so that it doesn't rely on any 
previous calls within the suite. I don't see the point of this though:
{code}
+    // a little funky: we only look at hashcode (well-defined) of the target 
class name.
+    // using a generator won't reproduce, because we are a per-class resource.
+    // using hashing on filenames won't reproduce, because many of the names 
rely on other things
+    // the test class did.
+    // so a test gets terrorized with extras or gets none at all depending on 
the initial seed.
+    int hash = 
RandomizedContext.current().getTargetClass().toString().hashCode() ^ seed;
+    if ((hash & 3) == 0) {
{code}

the class is going to be the same for every instantiation of the ExtraFS class. 
You might as well just initialize it in the constructor -- it's never going to 
change for the same suite (?).

Thinking if there's any other way to have it consistently reset its state.

> Make extrasfs reproducible
> --------------------------
>
>                 Key: LUCENE-6431
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6431
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>         Attachments: LUCENE-6431.patch
>
>
> Today this is really bad, it can easily cause non-reproducible test failures. 
> Its a per-class thing, but its decisions are based on previous events 
> happening for that class (e.g. directory operations). 
> Even using the filename can't work, its setup so early in the process, before 
> test framework even ensures java.io.tempdir and similar exist. Even 
> disregarding that, test files use a temp directory facility and those names 
> are not reproducible (they depend on what already exists, e.g. from a 
> previous test run).



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to