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

Fix TestSQLRepositoryAPI.testCopy

    XMLWordPrintable

    Details

    • Type: Clean up
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 6.0
    • Fix Version/s: 6.0-HF12, 7.3
    • Component/s: Core VCS, Tests

      Description

      This test sometimes fails:

      Tests run: 98, Failures: 0, Errors: 1, Skipped: 6, Time elapsed: 2.558 sec <<< FAILURE! - in org.nuxeo.ecm.core.TestSQLRepositoryAPI
      testCopy(org.nuxeo.ecm.core.TestSQLRepositoryAPI)  Time elapsed: 0.009 sec  <<< ERROR!
      org.nuxeo.ecm.core.api.ClientException: Failed to copy document: org.nuxeo.ecm.core.storage.StorageException: Destination name already exists: file.1431340743437
      	at org.nuxeo.ecm.core.api.AbstractSession.copy(AbstractSession.java:435)
      	at org.nuxeo.ecm.core.api.AbstractSession.copy(AbstractSession.java:441)
      	at org.nuxeo.ecm.core.TestSQLRepositoryAPI.testCopy(TestSQLRepositoryAPI.java:2197)
      	...
      Caused by: org.nuxeo.ecm.core.api.DocumentException: org.nuxeo.ecm.core.storage.StorageException: Destination name already exists: file.1431340743437
      	at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.copy(SQLSession.java:328)
      	at org.nuxeo.ecm.core.api.AbstractSession.copy(AbstractSession.java:418)
      	... 50 more
      Caused by: org.nuxeo.ecm.core.storage.StorageException: Destination name already exists: file.1431340743437
      	at org.nuxeo.ecm.core.storage.sql.PersistenceContext.checkFreeName(PersistenceContext.java:1290)
      	at org.nuxeo.ecm.core.storage.sql.PersistenceContext.copy(PersistenceContext.java:1346)
      	at org.nuxeo.ecm.core.storage.sql.SessionImpl.copy(SessionImpl.java:1015)
      	at org.nuxeo.ecm.core.storage.sql.ra.ConnectionImpl.copy(ConnectionImpl.java:271)
      	at org.nuxeo.ecm.core.storage.sql.coremodel.SQLSession.copy(SQLSession.java:325)
      	... 51 more
      

      This is due to the fact that copy() tries to find a free name if copying to a folder with a document of the same name as the source. But if the test runs really fast and the second copy happens in the same millisecond as the first one, we get the same name chosen twice in SQLSession.findFreeName.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: