Re: java.lang.AssertionError: System properties invariant violated.

2012-07-18 Thread Chris Hostetter

: I am porting 3x unittests to the solr/lucene trunk. My unittests are
: OK and pass, but in the end fail because the new rule checks for
: modifier properties. I know what the problem is, I am creating new
: system properties in the @beforeClass, but I think I need to do it
: there, because the project loads C library before initializing tests.

The purpose ot the assertion is to verify that no code being tested is 
modifying system properties -- if you are setting hte properties yourself 
in some @BeforeClass methods, just use System.clearProperty to unset them 
in corrisponding @AfterClass methods


-Hoss


Re: java.lang.AssertionError: System properties invariant violated.

2012-07-18 Thread Roman Chyla
Thank you! I haven't really understood the LuceneTestCase.classRules
before this.

roman

On Wed, Jul 18, 2012 at 3:11 PM, Chris Hostetter
hossman_luc...@fucit.org wrote:

 : I am porting 3x unittests to the solr/lucene trunk. My unittests are
 : OK and pass, but in the end fail because the new rule checks for
 : modifier properties. I know what the problem is, I am creating new
 : system properties in the @beforeClass, but I think I need to do it
 : there, because the project loads C library before initializing tests.

 The purpose ot the assertion is to verify that no code being tested is
 modifying system properties -- if you are setting hte properties yourself
 in some @BeforeClass methods, just use System.clearProperty to unset them
 in corrisponding @AfterClass methods


 -Hoss


java.lang.AssertionError: System properties invariant violated.

2012-07-17 Thread Roman Chyla
Hello,

(Please excuse cross-posting, my problem is with a solr component, but
the underlying issue is inside the lucene test-framework)

I am porting 3x unittests to the solr/lucene trunk. My unittests are
OK and pass, but in the end fail because the new rule checks for
modifier properties. I know what the problem is, I am creating new
system properties in the @beforeClass, but I think I need to do it
there, because the project loads C library before initializing tests.

Anybody knows how to work around it cleanly? There is a property that
can be set to ignore certain names
(LuceneTestCase.IGNORED_INVARIANT_PROPERTIES), but unfortunately it is
declared as private.

Thank you,

  Roman


Exception:

java.lang.AssertionError: System properties invariant violated.
New keys:
  montysolr.bridge=montysolr.java_bridge.SimpleBridge
  montysolr.home=/dvt/workspace/montysolr
  montysolr.modulepath=/dvt/workspace/montysolr/src/python/montysolr
  solr.test.sys.prop1=propone
  solr.test.sys.prop2=proptwo

at 
com.carrotsearch.randomizedtesting.rules.SystemPropertiesInvariantRule$1.evaluate(SystemPropertiesInvariantRule.java:66)
at 
org.apache.lucene.util.TestRuleNoInstanceHooksOverrides$1.evaluate(TestRuleNoInstanceHooksOverrides.java:53)
at 
org.apache.lucene.util.TestRuleNoStaticHooksShadowing$1.evaluate(TestRuleNoStaticHooksShadowing.java:52)
at 
org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:36)
at 
org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:48)
at 
org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:70)
at 
org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:55)
at 
com.carrotsearch.randomizedtesting.RandomizedRunner.runSuite(RandomizedRunner.java:605)
at 
com.carrotsearch.randomizedtesting.RandomizedRunner.access$400(RandomizedRunner.java:132)
at 
com.carrotsearch.randomizedtesting.RandomizedRunner$2.run(RandomizedRunner.java:551)