webapp
webapp copied to clipboard
Fix random failure in WordContributionEventDaoTest
The unit test at WordContributionEventDaoTest fails randomly, so it probably has something to do with the random execution order of the tests.
https://github.com/elimu-ai/webapp/actions/runs/7737336544/job/21096137074?pr=1643
[INFO] Tests run: 4, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 s - in ai.elimu.web.SignOnControllerWeb3Test
06:47:17.917 [SpringContextShutdownHook] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'default'
[INFO]
[INFO] Results:
[INFO]
Error: Failures:
Error: WordContributionEventDaoTest.testReadMostRecentPerWord:111
Expected: is <2>
but: was <3>
[INFO]
Error: Tests run: 122, Failures: 1, Errors: 0, Skipped: 2
https://github.com/elimu-ai/webapp/actions/runs/7754162700/job/21146934845?pr=1646
09:50:52.[141](https://github.com/elimu-ai/webapp/actions/runs/7754162700/job/21146934845?pr=1646#step:7:142) [main] INFO ai.elimu.dao.WordContributionEventDaoTest - testReadMostRecentPerWord
09:50:52.141 [main] INFO ai.elimu.dao.WordContributionEventDaoTest - numberOfWordContributionEventsBefore: 0
09:50:52.157 [main] INFO ai.elimu.dao.WordContributionEventDaoTest - numberOfWordContributionEventsAfter: 1
09:50:52.172 [main] INFO ai.elimu.dao.WordContributionEventDaoTest - numberOfWordContributionEventsAfter: 2
09:50:52.188 [main] INFO ai.elimu.dao.WordContributionEventDaoTest - numberOfWordContributionEventsAfter: 3
09:50:52.188 [main] INFO ai.elimu.dao.WordContributionEventDaoTest - testReadMostRecent
09:50:52.204 [main] INFO ai.elimu.dao.WordContributionEventDaoTest - numberOfWordContributionEventsBefore: 3
09:50:52.219 [main] INFO ai.elimu.dao.WordContributionEventDaoTest - numberOfWordContributionEventsAfter: 4
Error: Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.109 s <<< FAILURE! - in ai.elimu.dao.WordContributionEventDaoTest
Error: testReadMostRecentPerWord(ai.elimu.dao.WordContributionEventDaoTest) Time elapsed: 0.063 s <<< FAILURE!
java.lang.AssertionError:
Expected: is <2>
but: was <3>
at ai.elimu.dao.WordContributionEventDaoTest.testReadMostRecentPerWord(WordContributionEventDaoTest.java:122)