Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1901

[JDK8] Sort children for comparison in AsyncOps tests

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.4.6
    • 3.4.7, 3.5.0
    • tests
    • None

    Description

      AsyncOpsTest, ChrootAsyncTest, and NioNettySuiteTest can fail running on Java 8 if child znodes are not added to a list in the same order as expected.

      For example

      Testcase: testAsyncGetChildrenTwo took 0.166 sec
              FAILED
      expected:<OK:/foo:[child[1, child2]]> but was:<OK:/foo:[child[2, child1]]>
      junit.framework.AssertionFailedError: expected:<OK:/foo:[child[1, child2]]> but was:<OK:/foo:[child[2, child1]]>
              at org.apache.zookeeper.test.AsyncOps$AsyncCB.verify(AsyncOps.java:113)
              at org.apache.zookeeper.test.AsyncOps$ChildrenCB.verify(AsyncOps.java:298)
              at org.apache.zookeeper.test.AsyncOps$ChildrenCB.verifyGetChildrenTwo(AsyncOps.java:287)
              at org.apache.zookeeper.test.AsyncOpsTest.testAsyncGetChildrenTwo(AsyncOpsTest.java:155)
              at org.apache.zookeeper.JUnit4ZKTestRunner$LoggedInvokeMethod.evaluate(JUnit4ZKTestRunner.java:52)
      
      Testcase: testAsyncGetChildren2Two took 0.154 sec
              FAILED
      expected:<OK:/foo:[child[1, child2]]> but was:<OK:/foo:[child[2, child1]]>
      junit.framework.AssertionFailedError: expected:<OK:/foo:[child[1, child2]]> but was:<OK:/foo:[child[2, child1]]>
              at org.apache.zookeeper.test.AsyncOps$AsyncCB.verify(AsyncOps.java:113)
              at org.apache.zookeeper.test.AsyncOps$Children2CB.verify(AsyncOps.java:383)
              at org.apache.zookeeper.test.AsyncOps$Children2CB.verifyGetChildrenTwo(AsyncOps.java:372)
              at org.apache.zookeeper.test.AsyncOpsTest.testAsyncGetChildren2Two(AsyncOpsTest.java:175)
      	at org.apache.zookeeper.JUnit4ZKTestRunner$LoggedInvokeMethod.evaluate(JUnit4ZKTestRunner.java:52)
      

      This seems like a test only issue because getChildren javadoc says "The list of children returned is not sorted and no guarantee is provided as to its natural or lexical order." So, fix the tests by sorting the incoming lists.

      Attachments

        1. ZOOKEEPER-1901.patch
          1 kB
          Andrew Kyle Purtell
        2. ZOOKEEPER-1901-3.4.patch
          1 kB
          Andrew Kyle Purtell

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            apurtell Andrew Kyle Purtell
            apurtell Andrew Kyle Purtell
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment