lucene-dev mailing list archives

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

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

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:
{code}
  @ClassRule
  public static TestRule solrClassRules = 
    RuleChain.outerRule(new SystemPropertiesRestoreRule());

  @Rule
  public TestRule solrTestRules = 
    RuleChain.outerRule(new SystemPropertiesRestoreRule());
{code}
                
> LuceneTestCase should check for modifications on System properties
> ------------------------------------------------------------------
>
>                 Key: LUCENE-3847
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3847
>             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: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Mime
View raw message