[xwiki/xwiki-commons] 436b01: XCOMMONS-2092: Possible race condition in ReadWrit...
Branch: refs/heads/XCOMMONS-2092 Home: https://github.com/xwiki/xwiki-commons Commit: 436b01d4797001e85faaec3192666367b2039c37 https://github.com/xwiki/xwiki-commons/commit/436b01d4797001e85faaec31926663... Author: Vincent Massol <[email protected]> Date: 2026-09-17 (Thu, 17 Sep 2026) Changed paths: M xwiki-commons-core/xwiki-commons-job/xwiki-commons-job-default/src/test/java/org/xwiki/job/internal/DefaultJobExecutorTest.java Log Message: ----------- XCOMMONS-2092: Possible race condition in ReadWriteSemaphore Follow-up to the review of the previous commit: restore every assertion it had removed from DefaultJobExecutorTest, and clear java:S5961 by fixing what actually inflated the count instead. * waitJobState() reported its timeout through fail(), and assertion-aware analysis resolves helper methods transitively, so every waitJobWaiting()/waitJobFinished() call counted as an assertion of the calling test. Each checkpoint of these tests was therefore counted twice: once for the barrier that drives the choreography to its next step, and once for the assertion that states what is expected there. That is what took matchingGroupPathAreBlockedPoolMultiSizeParentFirst to 28 for a method stating 18 expectations. * Raise that timeout by throwing instead. Assertions.fail() is itself a throw of an AssertionError subclass, so behaviour and Surefire reporting are unchanged, and the count now equals the number of expectations each test states: 28 -> 18, 29 -> 17 and 18 -> 12. The java:S5961 suppression added by the previous commit is dropped. * The same helper resolution applies to "tests should include assertions", where the effect is worse: a test whose only assertion-like call is a wait would have looked like it verifies something. It no longer does. * Restore the interrupt flag and keep the InterruptedException as the cause, instead of swallowing both. * Extract the repeated GroupedJobInitializer stubbing into mockPool(poolSize, path...) and mockAllPools(poolSize), so each test opens with the pool sizes its scenario comment describes. * Fix the last assertion of matchingGroupPathAreBlocked, which was on job1 twice instead of job12 and job1. * Fix two comments mangled by a search and replace ("taken into ABcount", "they are ABtually after"). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> To unsubscribe from these emails, change your notification settings at https://github.com/xwiki/xwiki-commons/settings/notifications
participants (1)
-
XWiki Notifications