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

Fix nuxeo-platform-comment testGetComments* tests

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2023.0, 2021.29
    • Component/s: Comments, Tests
    • Team:
      PLATFORM
    • Sprint:
      nxplatform #75
    • Story Points:
      1

      Description

      The tests getGetComments* present in AbstractTestCommentManager class are random and need to be fixed.

      The tests leverage a sort on the comment creationDate field and sometime two comments can have the same creation date which breaks the assertion.

      We should fix it.

      Example of failing tests:

      [2022-11-15T06:20:56.635Z] [ERROR] testGetCommentsPaginationOrdering(org.nuxeo.ecm.platform.comment.TestBridgeFromRelationToPropertyCommentManager)  Time elapsed: 0.035 s  <<< FAILURE!
      [2022-11-15T06:20:56.635Z] java.lang.AssertionError: expected:<[org.nuxeo.ecm.platform.comment.api.CommentImpl@161ad5b7[id=707bd7c6-4905-4ed8-8874-2a3393c3b5b9], org.nuxeo.ecm.platform.comment.api.CommentImpl@2aa3aa08[id=9c20c2a2-3b42-49de-adb2-6c169592017b], org.nuxeo.ecm.platform.comment.api.CommentImpl@1d372806[id=08732f2a-e7ee-46a4-8d82-8633eb1fbdcc]]> but was:<[org.nuxeo.ecm.platform.comment.api.CommentImpl@21dede96[id=97578fd6-dd66-41d6-8429-e67c7dfb51fc], org.nuxeo.ecm.platform.comment.api.CommentImpl@1e0383cd[id=9c20c2a2-3b42-49de-adb2-6c169592017b], org.nuxeo.ecm.platform.comment.api.CommentImpl@5ef45ad7[id=d917ac8c-c467-4ec1-976e-a30d8cb3abc8]]>
      [2022-11-15T06:20:56.635Z] 	at org.junit.Assert.fail(Assert.java:89)
      [2022-11-15T06:20:56.635Z] 	at org.junit.Assert.failNotEquals(Assert.java:835)
      [2022-11-15T06:20:56.635Z] 	at org.junit.Assert.assertEquals(Assert.java:120)
      [2022-11-15T06:20:56.635Z] 	at org.junit.Assert.assertEquals(Assert.java:146)
      [2022-11-15T06:20:56.635Z] 	at org.nuxeo.ecm.platform.comment.AbstractTestCommentManager.testGetCommentsPaginationOrdering(AbstractTestCommentManager.java:353)
      [2022-11-15T06:20:56.635Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [2022-11-15T06:20:56.635Z] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      [2022-11-15T06:20:56.635Z] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      [2022-11-15T06:20:56.635Z] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      [2022-11-15T06:20:56.635Z] 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
      

      This randomness affects the methods: testGetComments, testGetCommentsOrdering, testGetCommentsPagination and testGetCommentsPaginationOrdering of the abstract class AbstractTestCommentManager, so the classes TestBridgeFromPropertyToTreeCommentManager, TestBridgeFromRelationToPropertyCommentManager, TestCommentManagerImpl, TestPropertyCommentManager and TestTreeCommentManager.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: