chenejac / VIVOTestMigrationJIRA

0 stars 0 forks source link

VIVO-2003: Vitro unit tests fail if not run in a certain order #1892

Open chenejac opened 2 years ago

chenejac commented 2 years ago

Brian Lowe (Migrated from VIVO-2003) said:

Initially reported by Dang Vu Nguyen Hai and Christoph Göpfert on #develop channel on Slack.  Several unit tests were failing on an installation from the rel-1.12.0-RC branches on a Linux Mint VM, but not on Windows.

[https://vivo-project.slack.com/files/U02653DME6M/F0288KNF9EV/vivo-install-log.txt?origin_team=T8RJ13B6W&origin_channel=Vall_threads]

This appears to be caused by dependencies between unit tests related to I18n bundle and/or model setup.  The failing build was running the tests in a different order than were the successful builds.

Setting the runOrder to random in Vitro/api/pom.xml is one way to reproduce failing unit tests.  I was able to get a failure after about 5 or 6 runs:

<plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-surefire-plugin</artifactId>  <configuration>   <runOrder>random</runOrder>  </configuration> </plugin>

Running individual unit tests in isolation in the IDE will also cause failures, e.g.:

edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidationTest:

java.lang.NullPointerException at edu.cornell.mannlib.vitro.webapp.i18n.I18n.bundle(I18n.java:103) at edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.MultiValueEditSubmission.(MultiValueEditSubmission.java:105) at edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidationTest.testURI(AntiXssValidationTest.java:85) at edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidationTest.testURIValidation(AntiXssValidationTest.java:92) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)

or

edu.cornell.mannlib.vitro.webapp.dao.jena.VClassDaoTest:

java.lang.NullPointerException at edu.cornell.mannlib.vitro.webapp.modelaccess.impl.ContextModelAccessImpl.(ContextModelAccessImpl.java:93) at edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess$ModelAccessFactory.buildContextModelAccess(ModelAccess.java:185) at edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess.on(ModelAccess.java:173) at edu.cornell.mannlib.vitro.webapp.i18n.I18n.checkForChangeInThemeDirectory(I18n.java:230) at edu.cornell.mannlib.vitro.webapp.i18n.I18n.getBundle(I18n.java:161) at edu.cornell.mannlib.vitro.webapp.i18n.I18n.bundle(I18n.java:110) at edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena.getI18nBundle(WebappDaoFactoryJena.java:619) at edu.cornell.mannlib.vitro.webapp.dao.jena.VClassDaoJena.(VClassDaoJena.java:76) at edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactoryJena.getVClassDao(WebappDaoFactoryJena.java:413) at edu.cornell.mannlib.vitro.webapp.dao.jena.VClassDaoTest.getVClassesForPropertyTest(VClassDaoTest.java:198) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.rules.ExpectedException$ExpectedExceptionStatement.evaluate(ExpectedException.java:168) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)

{{}}

 

{{}}

chenejac commented 2 years ago

Brian Lowe said:

Alphabetical order appears to be a successful ordering of tests, so a temporary workaround is to add this to Vitro/api/pom.xml:

<plugin>  <groupId>org.apache.maven.plugins</groupId>  <artifactId>maven-surefire-plugin</artifactId>  <configuration>   <runOrder>alphabetical</runOrder>  </configuration> </plugin>

chenejac commented 2 years ago

Brian Lowe said:

Downgrading to critical; added blocker issue for 1.12.1 which is strictly for the incorporation of the runOrder.

See https://jira.lyrasis.org/browse/VIVO-2005

chenejac commented 2 years ago

Brian Lowe said:

Georgy's PR: https://github.com/vivo-project/Vitro/pull/245