Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-30437

Fix GroupChangesTestSuite.testGroupChangesOnSyncRoot randomly failing with PostgreSQL

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.10-HF48, 11.x, 2021.4
    • Component/s: CI/CD, Tests

      Description

      The fix made for NXP-30399, replacing the forEach loop in NuxeoDriveGroupUpdateListener by a bulk action, introduced a random test error in GroupChangesTestSuite.testGroupChangesOnSyncRoot:

      java.lang.AssertionError: expected:<1> but was:<0>
      	at org.junit.Assert.fail(Assert.java:89)
      	at org.junit.Assert.failNotEquals(Assert.java:835)
      	at org.junit.Assert.assertEquals(Assert.java:647)
      	at org.junit.Assert.assertEquals(Assert.java:633)
      	at org.nuxeo.drive.fixtures.GroupChangesTestSuite.testGroupChanges(GroupChangesTestSuite.java:312)
      	at org.nuxeo.drive.fixtures.GroupChangesTestSuite.testGroupChangesOnSyncRoot(GroupChangesTestSuite.java:160)
      

      This is probably because the call to TransactionalFeature#nextTransaction() waits for the NuxeoDriveGroupUpdateListener async listener and the subsequent FireGroupUpdatedEventAction bulk action, but not always for the NuxeoDriveVirtualEventLogger async listener triggered afterwards.

      Indeed, the call sequence is quite complex:

      NuxeoDriveGroupUpdateListener (async)
        -> FireGroupUpdatedEventAction
          -> NuxeoDriveFileSystemDeletionListener (sync)
            -> NuxeoDriveVirtualEventLogger (async)
              -> AuditLogger#addLogEntries
      

      A possible solution is to double the calls to TransactionalFeature#nextTransaction() in GroupChangesTestSuite#commitAndWaitForAsyncCompletion().

      In the future, we'll want to avoid having such a stack of async processing as it's very difficult to analyze and test.
      BAF triggering WorkManager is not a good idea.
      Using BAF everywhere should solve the problem.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: