details: https://code.openbravo.com/erp/devel/pi/rev/2da162a5e213 changeset: 35241:2da162a5e213 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Fri Dec 14 11:43:52 2018 +0100 summary: related with issue 39755: preventing false test positives
T1 and T2 could finish exactly at the same time, now the chances are reduced by adding a short delay to T2 after finalization. Also synchronizing on exectionOrder diffstat: src-test/src/org/openbravo/test/dal/DalLockingTest.java | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diffs (29 lines): diff -r ad2f7d3fc905 -r 2da162a5e213 src-test/src/org/openbravo/test/dal/DalLockingTest.java --- a/src-test/src/org/openbravo/test/dal/DalLockingTest.java Thu Dec 13 14:29:16 2018 +0000 +++ b/src-test/src/org/openbravo/test/dal/DalLockingTest.java Fri Dec 14 11:43:52 2018 +0100 @@ -106,7 +106,7 @@ CountDownLatch latch = new CountDownLatch(1); List<Callable<Void>> threads = Arrays.asList( // doWithDAL(() -> acquireLock(latch), "T1", 200), // - doWithDAL(this::acquireLock, "T2", latch)); + doWithDAL(this::acquireLock, "T2", latch, 10)); executeAndGetResults(threads); assertThat( @@ -202,12 +202,14 @@ errorOccurred = true; throw new OBException(e); } finally { + synchronized (executionOrder) { + log.info("Completed thread {}", name); + executionOrder.add(name); + } if (!errorOccurred) { OBDal.getInstance().commitAndClose(); } OBContext.restorePreviousMode(); - log.info("Completed thread {}", name); - executionOrder.add(name); } }; } _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits