GitHub user anmolnar opened a pull request:

    https://github.com/apache/zookeeper/pull/651

    ZOOKEEPER-3113 EphemeralType.get() fails to verify ephemeralOwner when 
currentElapsedTime() is small enough

    I refactored the unit test `testServerIds` to verify server id verification 
code explicitly instead of through `EphemeralType.get()` method. 
    
    Reasons:
    - The original test doesn't work on machines which booted recently, because 
the generated `Time.currentElapsedTime()` value is not high enough and it's 
possible to generate a valid ephemeralOwner even with high 0xff byte. Server ID 
cannot be verified reliably this way.
    - EphemeralType.get() is already covered in other unit tests,  
    - Unit tests should test the smallest piece of logic and call the method 
under testing directly.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/anmolnar/zookeeper ZOOKEEPER-3113

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/zookeeper/pull/651.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #651
    
----
commit 659fc9a4158fed6a6c9eaca8b6725bdbdb9435c0
Author: Andor Molnar <andor@...>
Date:   2018-10-01T14:42:02Z

    ZOOKEEPER-3113. Refactored unit test to validate server Id verification 
code explicitly

----


---

Reply via email to