lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dawid Weiss (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3847) LuceneTestCase should check for modifications on System properties
Date Sun, 04 Mar 2012 21:22:59 GMT


Dawid Weiss commented on LUCENE-3847:

I've implemented this invariant and it works as a charm. Did you know TimeZone.getDefault()
has a side-effect of setting (!) user.timezone system property? If you did, I'll buy you a
beer next time we meet :)

Anyway, lots of Solr tests leave behind system properties. Instead of trying to fix them one
by one I went kind of the easy route and created a class and test rule that simply reverts
all system properties from before the entry scope. This has been applied to AbstractSolrTestCase
and SolrTestCaseJ4 and since these are subclasses of LuceneTestCase, the invariant will always
hold, no matter what.

If Solr folks wish to fix tests one by one (which may be a good idea or a bad idea -- there's
lots of them), then comment out these two:
  public static TestRule solrClassRules = 
    RuleChain.outerRule(new SystemPropertiesRestoreRule());

  public TestRule solrTestRules = 
    RuleChain.outerRule(new SystemPropertiesRestoreRule());
> LuceneTestCase should check for modifications on System properties
> ------------------------------------------------------------------
>                 Key: LUCENE-3847
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: general/test
>            Reporter: Dawid Weiss
>            Assignee: Dawid Weiss
>            Priority: Minor
>             Fix For: 3.6, 4.0
> - fail the test if changes have been detected.
> - revert the state of system properties before the suite.
> - cleanup after the suite.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message